1
22
23 package com.liferay.portlet.shopping.service.http;
24
25 import com.liferay.portal.kernel.log.Log;
26 import com.liferay.portal.kernel.log.LogFactoryUtil;
27 import com.liferay.portal.kernel.util.BooleanWrapper;
28 import com.liferay.portal.kernel.util.LongWrapper;
29 import com.liferay.portal.kernel.util.MethodWrapper;
30 import com.liferay.portal.kernel.util.NullWrapper;
31 import com.liferay.portal.security.auth.HttpPrincipal;
32 import com.liferay.portal.service.http.TunnelUtil;
33
34 import com.liferay.portlet.shopping.service.ShoppingCategoryServiceUtil;
35
36
73 public class ShoppingCategoryServiceHttp {
74 public static com.liferay.portlet.shopping.model.ShoppingCategory addCategory(
75 HttpPrincipal httpPrincipal, long parentCategoryId,
76 java.lang.String name, java.lang.String description,
77 com.liferay.portal.service.ServiceContext serviceContext)
78 throws com.liferay.portal.PortalException,
79 com.liferay.portal.SystemException {
80 try {
81 Object paramObj0 = new LongWrapper(parentCategoryId);
82
83 Object paramObj1 = name;
84
85 if (name == null) {
86 paramObj1 = new NullWrapper("java.lang.String");
87 }
88
89 Object paramObj2 = description;
90
91 if (description == null) {
92 paramObj2 = new NullWrapper("java.lang.String");
93 }
94
95 Object paramObj3 = serviceContext;
96
97 if (serviceContext == null) {
98 paramObj3 = new NullWrapper(
99 "com.liferay.portal.service.ServiceContext");
100 }
101
102 MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
103 "addCategory",
104 new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
105
106 Object returnObj = null;
107
108 try {
109 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
110 }
111 catch (Exception e) {
112 if (e instanceof com.liferay.portal.PortalException) {
113 throw (com.liferay.portal.PortalException)e;
114 }
115
116 if (e instanceof com.liferay.portal.SystemException) {
117 throw (com.liferay.portal.SystemException)e;
118 }
119
120 throw new com.liferay.portal.SystemException(e);
121 }
122
123 return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
124 }
125 catch (com.liferay.portal.SystemException se) {
126 _log.error(se, se);
127
128 throw se;
129 }
130 }
131
132 public static void deleteCategory(HttpPrincipal httpPrincipal,
133 long categoryId)
134 throws com.liferay.portal.PortalException,
135 com.liferay.portal.SystemException {
136 try {
137 Object paramObj0 = new LongWrapper(categoryId);
138
139 MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
140 "deleteCategory", new Object[] { paramObj0 });
141
142 try {
143 TunnelUtil.invoke(httpPrincipal, methodWrapper);
144 }
145 catch (Exception e) {
146 if (e instanceof com.liferay.portal.PortalException) {
147 throw (com.liferay.portal.PortalException)e;
148 }
149
150 if (e instanceof com.liferay.portal.SystemException) {
151 throw (com.liferay.portal.SystemException)e;
152 }
153
154 throw new com.liferay.portal.SystemException(e);
155 }
156 }
157 catch (com.liferay.portal.SystemException se) {
158 _log.error(se, se);
159
160 throw se;
161 }
162 }
163
164 public static com.liferay.portlet.shopping.model.ShoppingCategory getCategory(
165 HttpPrincipal httpPrincipal, long categoryId)
166 throws com.liferay.portal.PortalException,
167 com.liferay.portal.SystemException {
168 try {
169 Object paramObj0 = new LongWrapper(categoryId);
170
171 MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
172 "getCategory", new Object[] { paramObj0 });
173
174 Object returnObj = null;
175
176 try {
177 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
178 }
179 catch (Exception e) {
180 if (e instanceof com.liferay.portal.PortalException) {
181 throw (com.liferay.portal.PortalException)e;
182 }
183
184 if (e instanceof com.liferay.portal.SystemException) {
185 throw (com.liferay.portal.SystemException)e;
186 }
187
188 throw new com.liferay.portal.SystemException(e);
189 }
190
191 return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
192 }
193 catch (com.liferay.portal.SystemException se) {
194 _log.error(se, se);
195
196 throw se;
197 }
198 }
199
200 public static com.liferay.portlet.shopping.model.ShoppingCategory updateCategory(
201 HttpPrincipal httpPrincipal, long categoryId, long parentCategoryId,
202 java.lang.String name, java.lang.String description,
203 boolean mergeWithParentCategory,
204 com.liferay.portal.service.ServiceContext serviceContext)
205 throws com.liferay.portal.PortalException,
206 com.liferay.portal.SystemException {
207 try {
208 Object paramObj0 = new LongWrapper(categoryId);
209
210 Object paramObj1 = new LongWrapper(parentCategoryId);
211
212 Object paramObj2 = name;
213
214 if (name == null) {
215 paramObj2 = new NullWrapper("java.lang.String");
216 }
217
218 Object paramObj3 = description;
219
220 if (description == null) {
221 paramObj3 = new NullWrapper("java.lang.String");
222 }
223
224 Object paramObj4 = new BooleanWrapper(mergeWithParentCategory);
225
226 Object paramObj5 = serviceContext;
227
228 if (serviceContext == null) {
229 paramObj5 = new NullWrapper(
230 "com.liferay.portal.service.ServiceContext");
231 }
232
233 MethodWrapper methodWrapper = new MethodWrapper(ShoppingCategoryServiceUtil.class.getName(),
234 "updateCategory",
235 new Object[] {
236 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
237 paramObj5
238 });
239
240 Object returnObj = null;
241
242 try {
243 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
244 }
245 catch (Exception e) {
246 if (e instanceof com.liferay.portal.PortalException) {
247 throw (com.liferay.portal.PortalException)e;
248 }
249
250 if (e instanceof com.liferay.portal.SystemException) {
251 throw (com.liferay.portal.SystemException)e;
252 }
253
254 throw new com.liferay.portal.SystemException(e);
255 }
256
257 return (com.liferay.portlet.shopping.model.ShoppingCategory)returnObj;
258 }
259 catch (com.liferay.portal.SystemException se) {
260 _log.error(se, se);
261
262 throw se;
263 }
264 }
265
266 private static Log _log = LogFactoryUtil.getLog(ShoppingCategoryServiceHttp.class);
267 }