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