001
014
015 package com.liferay.portlet.shopping.service.http;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.BooleanWrapper;
020 import com.liferay.portal.kernel.util.LongWrapper;
021 import com.liferay.portal.kernel.util.MethodWrapper;
022 import com.liferay.portal.kernel.util.NullWrapper;
023 import com.liferay.portal.security.auth.HttpPrincipal;
024 import com.liferay.portal.service.http.TunnelUtil;
025
026 import com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil;
027
028
058 public class ShoppingCategoryServiceHttp {
059 public static com.liferay.portlet.shopping.model.ShoppingCategory addCategory(
060 HttpPrincipal httpPrincipal, long parentCategoryId,
061 java.lang.String name, java.lang.String description,
062 com.liferay.portal.service.ServiceContext serviceContext)
063 throws com.liferay.portal.kernel.exception.PortalException,
064 com.liferay.portal.kernel.exception.SystemException {
065 try {
066 Object paramObj0 = new LongWrapper(parentCategoryId);
067
068 Object paramObj1 = name;
069
070 if (name == null) {
071 paramObj1 = new NullWrapper("java.lang.String");
072 }
073
074 Object paramObj2 = description;
075
076 if (description == null) {
077 paramObj2 = new NullWrapper("java.lang.String");
078 }
079
080 Object paramObj3 = serviceContext;
081
082 if (serviceContext == null) {
083 paramObj3 = new NullWrapper(
084 "com.liferay.portal.service.ServiceContext");
085 }
086
087 MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
088 "addCategory",
089 new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
090
091 Object returnObj = null;
092
093 try {
094 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
095 }
096 catch (Exception e) {
097 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
098 throw (com.liferay.portal.kernel.exception.PortalException)e;
099 }
100
101 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
102 throw (com.liferay.portal.kernel.exception.SystemException)e;
103 }
104
105 throw new com.liferay.portal.kernel.exception.SystemException(e);
106 }
107
108 return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
109 }
110 catch (com.liferay.portal.kernel.exception.SystemException se) {
111 _log.error(se, se);
112
113 throw se;
114 }
115 }
116
117 public static void deleteCategory(HttpPrincipal httpPrincipal,
118 long categoryId)
119 throws com.liferay.portal.kernel.exception.PortalException,
120 com.liferay.portal.kernel.exception.SystemException {
121 try {
122 Object paramObj0 = new LongWrapper(categoryId);
123
124 MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
125 "deleteCategory", new Object[] { paramObj0 });
126
127 try {
128 TunnelUtil.invoke(httpPrincipal, methodWrapper);
129 }
130 catch (Exception e) {
131 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
132 throw (com.liferay.portal.kernel.exception.PortalException)e;
133 }
134
135 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
136 throw (com.liferay.portal.kernel.exception.SystemException)e;
137 }
138
139 throw new com.liferay.portal.kernel.exception.SystemException(e);
140 }
141 }
142 catch (com.liferay.portal.kernel.exception.SystemException se) {
143 _log.error(se, se);
144
145 throw se;
146 }
147 }
148
149 public static com.liferay.portlet.shopping.model.ShoppingCategory getCategory(
150 HttpPrincipal httpPrincipal, long categoryId)
151 throws com.liferay.portal.kernel.exception.PortalException,
152 com.liferay.portal.kernel.exception.SystemException {
153 try {
154 Object paramObj0 = new LongWrapper(categoryId);
155
156 MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
157 "getCategory", new Object[] { paramObj0 });
158
159 Object returnObj = null;
160
161 try {
162 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
163 }
164 catch (Exception e) {
165 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
166 throw (com.liferay.portal.kernel.exception.PortalException)e;
167 }
168
169 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
170 throw (com.liferay.portal.kernel.exception.SystemException)e;
171 }
172
173 throw new com.liferay.portal.kernel.exception.SystemException(e);
174 }
175
176 return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
177 }
178 catch (com.liferay.portal.kernel.exception.SystemException se) {
179 _log.error(se, se);
180
181 throw se;
182 }
183 }
184
185 public static com.liferay.portlet.shopping.model.ShoppingCategory updateCategory(
186 HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
187 java.lang.String name, java.lang.String description,
188 boolean mergeWithParentCategory,
189 com.liferay.portal.service.ServiceContext serviceContext)
190 throws com.liferay.portal.kernel.exception.PortalException,
191 com.liferay.portal.kernel.exception.SystemException {
192 try {
193 Object paramObj0 = new LongWrapper(categoryId);
194
195 Object paramObj1 = new LongWrapper(parentCategoryId);
196
197 Object paramObj2 = name;
198
199 if (name == null) {
200 paramObj2 = new NullWrapper("java.lang.String");
201 }
202
203 Object paramObj3 = description;
204
205 if (description == null) {
206 paramObj3 = new NullWrapper("java.lang.String");
207 }
208
209 Object paramObj4 = new BooleanWrapper(mergeWithParentCategory);
210
211 Object paramObj5 = serviceContext;
212
213 if (serviceContext == null) {
214 paramObj5 = new NullWrapper(
215 "com.liferay.portal.service.ServiceContext");
216 }
217
218 MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
219 "updateCategory",
220 new Object[] {
221 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
222 paramObj5
223 });
224
225 Object returnObj = null;
226
227 try {
228 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
229 }
230 catch (Exception e) {
231 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
232 throw (com.liferay.portal.kernel.exception.PortalException)e;
233 }
234
235 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
236 throw (com.liferay.portal.kernel.exception.SystemException)e;
237 }
238
239 throw new com.liferay.portal.kernel.exception.SystemException(e);
240 }
241
242 return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
243 }
244 catch (com.liferay.portal.kernel.exception.SystemException se) {
245 _log.error(se, se);
246
247 throw se;
248 }
249 }
250
251 private static Log _log = LogFactoryUtil.getLog(ShoppingCategoryServiceHttp.class);
252 }