001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.service.http;
022:
023: import com.liferay.portal.kernel.log.Log;
024: import com.liferay.portal.kernel.log.LogFactoryUtil;
025: import com.liferay.portal.kernel.util.BooleanWrapper;
026: import com.liferay.portal.kernel.util.IntegerWrapper;
027: import com.liferay.portal.kernel.util.LongWrapper;
028: import com.liferay.portal.kernel.util.MethodWrapper;
029: import com.liferay.portal.kernel.util.NullWrapper;
030: import com.liferay.portal.security.auth.HttpPrincipal;
031: import com.liferay.portal.service.AddressServiceUtil;
032:
033: /**
034: * <a href="AddressServiceHttp.java.html"><b><i>View Source</i></b></a>
035: *
036: * <p>
037: * ServiceBuilder generated this class. Modifications in this class will be
038: * overwritten the next time is generated.
039: * </p>
040: *
041: * <p>
042: * This class provides a HTTP utility for the
043: * <code>com.liferay.portal.service.AddressServiceUtil</code> service
044: * utility. The static methods of this class calls the same methods of the
045: * service utility. However, the signatures are different because it requires an
046: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
047: * parameter.
048: * </p>
049: *
050: * <p>
051: * The benefits of using the HTTP utility is that it is fast and allows for
052: * tunneling without the cost of serializing to text. The drawback is that it
053: * only works with Java.
054: * </p>
055: *
056: * <p>
057: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
058: * portal.properties to configure security.
059: * </p>
060: *
061: * <p>
062: * The HTTP utility is only generated for remote services.
063: * </p>
064: *
065: * @author Brian Wing Shun Chan
066: *
067: * @see com.liferay.portal.security.auth.HttpPrincipal
068: * @see com.liferay.portal.service.AddressServiceUtil
069: * @see com.liferay.portal.service.http.AddressServiceSoap
070: *
071: */
072: public class AddressServiceHttp {
073: public static com.liferay.portal.model.Address addAddress(
074: HttpPrincipal httpPrincipal, java.lang.String className,
075: long classPK, java.lang.String street1,
076: java.lang.String street2, java.lang.String street3,
077: java.lang.String city, java.lang.String zip, long regionId,
078: long countryId, int typeId, boolean mailing, boolean primary)
079: throws com.liferay.portal.SystemException,
080: com.liferay.portal.PortalException {
081: try {
082: Object paramObj0 = className;
083:
084: if (className == null) {
085: paramObj0 = new NullWrapper("java.lang.String");
086: }
087:
088: Object paramObj1 = new LongWrapper(classPK);
089:
090: Object paramObj2 = street1;
091:
092: if (street1 == null) {
093: paramObj2 = new NullWrapper("java.lang.String");
094: }
095:
096: Object paramObj3 = street2;
097:
098: if (street2 == null) {
099: paramObj3 = new NullWrapper("java.lang.String");
100: }
101:
102: Object paramObj4 = street3;
103:
104: if (street3 == null) {
105: paramObj4 = new NullWrapper("java.lang.String");
106: }
107:
108: Object paramObj5 = city;
109:
110: if (city == null) {
111: paramObj5 = new NullWrapper("java.lang.String");
112: }
113:
114: Object paramObj6 = zip;
115:
116: if (zip == null) {
117: paramObj6 = new NullWrapper("java.lang.String");
118: }
119:
120: Object paramObj7 = new LongWrapper(regionId);
121:
122: Object paramObj8 = new LongWrapper(countryId);
123:
124: Object paramObj9 = new IntegerWrapper(typeId);
125:
126: Object paramObj10 = new BooleanWrapper(mailing);
127:
128: Object paramObj11 = new BooleanWrapper(primary);
129:
130: MethodWrapper methodWrapper = new MethodWrapper(
131: AddressServiceUtil.class.getName(), "addAddress",
132: new Object[] { paramObj0, paramObj1, paramObj2,
133: paramObj3, paramObj4, paramObj5, paramObj6,
134: paramObj7, paramObj8, paramObj9,
135: paramObj10, paramObj11 });
136:
137: Object returnObj = null;
138:
139: try {
140: returnObj = TunnelUtil.invoke(httpPrincipal,
141: methodWrapper);
142: } catch (Exception e) {
143: if (e instanceof com.liferay.portal.SystemException) {
144: throw (com.liferay.portal.SystemException) e;
145: }
146:
147: if (e instanceof com.liferay.portal.PortalException) {
148: throw (com.liferay.portal.PortalException) e;
149: }
150:
151: throw new com.liferay.portal.SystemException(e);
152: }
153:
154: return (com.liferay.portal.model.Address) returnObj;
155: } catch (com.liferay.portal.SystemException se) {
156: _log.error(se, se);
157:
158: throw se;
159: }
160: }
161:
162: public static void deleteAddress(HttpPrincipal httpPrincipal,
163: long addressId) throws com.liferay.portal.SystemException,
164: com.liferay.portal.PortalException {
165: try {
166: Object paramObj0 = new LongWrapper(addressId);
167:
168: MethodWrapper methodWrapper = new MethodWrapper(
169: AddressServiceUtil.class.getName(),
170: "deleteAddress", new Object[] { paramObj0 });
171:
172: try {
173: TunnelUtil.invoke(httpPrincipal, methodWrapper);
174: } catch (Exception e) {
175: if (e instanceof com.liferay.portal.SystemException) {
176: throw (com.liferay.portal.SystemException) e;
177: }
178:
179: if (e instanceof com.liferay.portal.PortalException) {
180: throw (com.liferay.portal.PortalException) e;
181: }
182:
183: throw new com.liferay.portal.SystemException(e);
184: }
185: } catch (com.liferay.portal.SystemException se) {
186: _log.error(se, se);
187:
188: throw se;
189: }
190: }
191:
192: public static com.liferay.portal.model.Address getAddress(
193: HttpPrincipal httpPrincipal, long addressId)
194: throws com.liferay.portal.SystemException,
195: com.liferay.portal.PortalException {
196: try {
197: Object paramObj0 = new LongWrapper(addressId);
198:
199: MethodWrapper methodWrapper = new MethodWrapper(
200: AddressServiceUtil.class.getName(), "getAddress",
201: new Object[] { paramObj0 });
202:
203: Object returnObj = null;
204:
205: try {
206: returnObj = TunnelUtil.invoke(httpPrincipal,
207: methodWrapper);
208: } catch (Exception e) {
209: if (e instanceof com.liferay.portal.SystemException) {
210: throw (com.liferay.portal.SystemException) e;
211: }
212:
213: if (e instanceof com.liferay.portal.PortalException) {
214: throw (com.liferay.portal.PortalException) e;
215: }
216:
217: throw new com.liferay.portal.SystemException(e);
218: }
219:
220: return (com.liferay.portal.model.Address) returnObj;
221: } catch (com.liferay.portal.SystemException se) {
222: _log.error(se, se);
223:
224: throw se;
225: }
226: }
227:
228: public static java.util.List getAddresses(
229: HttpPrincipal httpPrincipal, java.lang.String className,
230: long classPK) throws com.liferay.portal.SystemException,
231: com.liferay.portal.PortalException {
232: try {
233: Object paramObj0 = className;
234:
235: if (className == null) {
236: paramObj0 = new NullWrapper("java.lang.String");
237: }
238:
239: Object paramObj1 = new LongWrapper(classPK);
240:
241: MethodWrapper methodWrapper = new MethodWrapper(
242: AddressServiceUtil.class.getName(), "getAddresses",
243: new Object[] { paramObj0, paramObj1 });
244:
245: Object returnObj = null;
246:
247: try {
248: returnObj = TunnelUtil.invoke(httpPrincipal,
249: methodWrapper);
250: } catch (Exception e) {
251: if (e instanceof com.liferay.portal.SystemException) {
252: throw (com.liferay.portal.SystemException) e;
253: }
254:
255: if (e instanceof com.liferay.portal.PortalException) {
256: throw (com.liferay.portal.PortalException) e;
257: }
258:
259: throw new com.liferay.portal.SystemException(e);
260: }
261:
262: return (java.util.List) returnObj;
263: } catch (com.liferay.portal.SystemException se) {
264: _log.error(se, se);
265:
266: throw se;
267: }
268: }
269:
270: public static com.liferay.portal.model.Address updateAddress(
271: HttpPrincipal httpPrincipal, long addressId,
272: java.lang.String street1, java.lang.String street2,
273: java.lang.String street3, java.lang.String city,
274: java.lang.String zip, long regionId, long countryId,
275: int typeId, boolean mailing, boolean primary)
276: throws com.liferay.portal.SystemException,
277: com.liferay.portal.PortalException {
278: try {
279: Object paramObj0 = new LongWrapper(addressId);
280:
281: Object paramObj1 = street1;
282:
283: if (street1 == null) {
284: paramObj1 = new NullWrapper("java.lang.String");
285: }
286:
287: Object paramObj2 = street2;
288:
289: if (street2 == null) {
290: paramObj2 = new NullWrapper("java.lang.String");
291: }
292:
293: Object paramObj3 = street3;
294:
295: if (street3 == null) {
296: paramObj3 = new NullWrapper("java.lang.String");
297: }
298:
299: Object paramObj4 = city;
300:
301: if (city == null) {
302: paramObj4 = new NullWrapper("java.lang.String");
303: }
304:
305: Object paramObj5 = zip;
306:
307: if (zip == null) {
308: paramObj5 = new NullWrapper("java.lang.String");
309: }
310:
311: Object paramObj6 = new LongWrapper(regionId);
312:
313: Object paramObj7 = new LongWrapper(countryId);
314:
315: Object paramObj8 = new IntegerWrapper(typeId);
316:
317: Object paramObj9 = new BooleanWrapper(mailing);
318:
319: Object paramObj10 = new BooleanWrapper(primary);
320:
321: MethodWrapper methodWrapper = new MethodWrapper(
322: AddressServiceUtil.class.getName(),
323: "updateAddress", new Object[] { paramObj0,
324: paramObj1, paramObj2, paramObj3, paramObj4,
325: paramObj5, paramObj6, paramObj7, paramObj8,
326: paramObj9, paramObj10 });
327:
328: Object returnObj = null;
329:
330: try {
331: returnObj = TunnelUtil.invoke(httpPrincipal,
332: methodWrapper);
333: } catch (Exception e) {
334: if (e instanceof com.liferay.portal.SystemException) {
335: throw (com.liferay.portal.SystemException) e;
336: }
337:
338: if (e instanceof com.liferay.portal.PortalException) {
339: throw (com.liferay.portal.PortalException) e;
340: }
341:
342: throw new com.liferay.portal.SystemException(e);
343: }
344:
345: return (com.liferay.portal.model.Address) returnObj;
346: } catch (com.liferay.portal.SystemException se) {
347: _log.error(se, se);
348:
349: throw se;
350: }
351: }
352:
353: private static Log _log = LogFactoryUtil
354: .getLog(AddressServiceHttp.class);
355: }
|