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