001
014
015 package com.liferay.portal.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.IntegerWrapper;
021 import com.liferay.portal.kernel.util.LongWrapper;
022 import com.liferay.portal.kernel.util.MethodWrapper;
023 import com.liferay.portal.kernel.util.NullWrapper;
024 import com.liferay.portal.security.auth.HttpPrincipal;
025 import com.liferay.portal.service.AddressServiceUtil;
026
027
057 public class AddressServiceHttp {
058 public static com.liferay.portal.model.Address addAddress(
059 HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
060 java.lang.String street1, java.lang.String street2,
061 java.lang.String street3, java.lang.String city, java.lang.String zip,
062 long regionId, long countryId, int typeId, boolean mailing,
063 boolean primary)
064 throws com.liferay.portal.kernel.exception.PortalException,
065 com.liferay.portal.kernel.exception.SystemException {
066 try {
067 Object paramObj0 = className;
068
069 if (className == null) {
070 paramObj0 = new NullWrapper("java.lang.String");
071 }
072
073 Object paramObj1 = new LongWrapper(classPK);
074
075 Object paramObj2 = street1;
076
077 if (street1 == null) {
078 paramObj2 = new NullWrapper("java.lang.String");
079 }
080
081 Object paramObj3 = street2;
082
083 if (street2 == null) {
084 paramObj3 = new NullWrapper("java.lang.String");
085 }
086
087 Object paramObj4 = street3;
088
089 if (street3 == null) {
090 paramObj4 = new NullWrapper("java.lang.String");
091 }
092
093 Object paramObj5 = city;
094
095 if (city == null) {
096 paramObj5 = new NullWrapper("java.lang.String");
097 }
098
099 Object paramObj6 = zip;
100
101 if (zip == null) {
102 paramObj6 = new NullWrapper("java.lang.String");
103 }
104
105 Object paramObj7 = new LongWrapper(regionId);
106
107 Object paramObj8 = new LongWrapper(countryId);
108
109 Object paramObj9 = new IntegerWrapper(typeId);
110
111 Object paramObj10 = new BooleanWrapper(mailing);
112
113 Object paramObj11 = new BooleanWrapper(primary);
114
115 MethodWrapper methodWrapper = new MethodWrapper(AddressServiceUtil.class.getName(),
116 "addAddress",
117 new Object[] {
118 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
119 paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
120 paramObj10, paramObj11
121 });
122
123 Object returnObj = null;
124
125 try {
126 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
127 }
128 catch (Exception e) {
129 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
130 throw (com.liferay.portal.kernel.exception.PortalException)e;
131 }
132
133 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
134 throw (com.liferay.portal.kernel.exception.SystemException)e;
135 }
136
137 throw new com.liferay.portal.kernel.exception.SystemException(e);
138 }
139
140 return (com.liferay.portal.model.Address)returnObj;
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 void deleteAddress(HttpPrincipal httpPrincipal, long addressId)
150 throws com.liferay.portal.kernel.exception.PortalException,
151 com.liferay.portal.kernel.exception.SystemException {
152 try {
153 Object paramObj0 = new LongWrapper(addressId);
154
155 MethodWrapper methodWrapper = new MethodWrapper(AddressServiceUtil.class.getName(),
156 "deleteAddress", new Object[] { paramObj0 });
157
158 try {
159 TunnelUtil.invoke(httpPrincipal, methodWrapper);
160 }
161 catch (Exception e) {
162 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
163 throw (com.liferay.portal.kernel.exception.PortalException)e;
164 }
165
166 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
167 throw (com.liferay.portal.kernel.exception.SystemException)e;
168 }
169
170 throw new com.liferay.portal.kernel.exception.SystemException(e);
171 }
172 }
173 catch (com.liferay.portal.kernel.exception.SystemException se) {
174 _log.error(se, se);
175
176 throw se;
177 }
178 }
179
180 public static com.liferay.portal.model.Address getAddress(
181 HttpPrincipal httpPrincipal, long addressId)
182 throws com.liferay.portal.kernel.exception.PortalException,
183 com.liferay.portal.kernel.exception.SystemException {
184 try {
185 Object paramObj0 = new LongWrapper(addressId);
186
187 MethodWrapper methodWrapper = new MethodWrapper(AddressServiceUtil.class.getName(),
188 "getAddress", new Object[] { paramObj0 });
189
190 Object returnObj = null;
191
192 try {
193 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
194 }
195 catch (Exception e) {
196 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
197 throw (com.liferay.portal.kernel.exception.PortalException)e;
198 }
199
200 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
201 throw (com.liferay.portal.kernel.exception.SystemException)e;
202 }
203
204 throw new com.liferay.portal.kernel.exception.SystemException(e);
205 }
206
207 return (com.liferay.portal.model.Address)returnObj;
208 }
209 catch (com.liferay.portal.kernel.exception.SystemException se) {
210 _log.error(se, se);
211
212 throw se;
213 }
214 }
215
216 public static java.util.List<com.liferay.portal.model.Address> getAddresses(
217 HttpPrincipal httpPrincipal, java.lang.String className, long classPK)
218 throws com.liferay.portal.kernel.exception.PortalException,
219 com.liferay.portal.kernel.exception.SystemException {
220 try {
221 Object paramObj0 = className;
222
223 if (className == null) {
224 paramObj0 = new NullWrapper("java.lang.String");
225 }
226
227 Object paramObj1 = new LongWrapper(classPK);
228
229 MethodWrapper methodWrapper = new MethodWrapper(AddressServiceUtil.class.getName(),
230 "getAddresses", new Object[] { paramObj0, paramObj1 });
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 (java.util.List<com.liferay.portal.model.Address>)returnObj;
250 }
251 catch (com.liferay.portal.kernel.exception.SystemException se) {
252 _log.error(se, se);
253
254 throw se;
255 }
256 }
257
258 public static com.liferay.portal.model.Address updateAddress(
259 HttpPrincipal httpPrincipal, long addressId, java.lang.String street1,
260 java.lang.String street2, java.lang.String street3,
261 java.lang.String city, java.lang.String zip, long regionId,
262 long countryId, int typeId, boolean mailing, boolean primary)
263 throws com.liferay.portal.kernel.exception.PortalException,
264 com.liferay.portal.kernel.exception.SystemException {
265 try {
266 Object paramObj0 = new LongWrapper(addressId);
267
268 Object paramObj1 = street1;
269
270 if (street1 == null) {
271 paramObj1 = new NullWrapper("java.lang.String");
272 }
273
274 Object paramObj2 = street2;
275
276 if (street2 == null) {
277 paramObj2 = new NullWrapper("java.lang.String");
278 }
279
280 Object paramObj3 = street3;
281
282 if (street3 == null) {
283 paramObj3 = new NullWrapper("java.lang.String");
284 }
285
286 Object paramObj4 = city;
287
288 if (city == null) {
289 paramObj4 = new NullWrapper("java.lang.String");
290 }
291
292 Object paramObj5 = zip;
293
294 if (zip == null) {
295 paramObj5 = new NullWrapper("java.lang.String");
296 }
297
298 Object paramObj6 = new LongWrapper(regionId);
299
300 Object paramObj7 = new LongWrapper(countryId);
301
302 Object paramObj8 = new IntegerWrapper(typeId);
303
304 Object paramObj9 = new BooleanWrapper(mailing);
305
306 Object paramObj10 = new BooleanWrapper(primary);
307
308 MethodWrapper methodWrapper = new MethodWrapper(AddressServiceUtil.class.getName(),
309 "updateAddress",
310 new Object[] {
311 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
312 paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
313 paramObj10
314 });
315
316 Object returnObj = null;
317
318 try {
319 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
320 }
321 catch (Exception e) {
322 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
323 throw (com.liferay.portal.kernel.exception.PortalException)e;
324 }
325
326 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
327 throw (com.liferay.portal.kernel.exception.SystemException)e;
328 }
329
330 throw new com.liferay.portal.kernel.exception.SystemException(e);
331 }
332
333 return (com.liferay.portal.model.Address)returnObj;
334 }
335 catch (com.liferay.portal.kernel.exception.SystemException se) {
336 _log.error(se, se);
337
338 throw se;
339 }
340 }
341
342 private static Log _log = LogFactoryUtil.getLog(AddressServiceHttp.class);
343 }