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.PhoneServiceUtil;
032:
033: /**
034: * <a href="PhoneServiceHttp.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.PhoneServiceUtil</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.PhoneServiceUtil
069: * @see com.liferay.portal.service.http.PhoneServiceSoap
070: *
071: */
072: public class PhoneServiceHttp {
073: public static com.liferay.portal.model.Phone addPhone(
074: HttpPrincipal httpPrincipal, java.lang.String className,
075: long classPK, java.lang.String number,
076: java.lang.String extension, int typeId, boolean primary)
077: throws com.liferay.portal.SystemException,
078: com.liferay.portal.PortalException {
079: try {
080: Object paramObj0 = className;
081:
082: if (className == null) {
083: paramObj0 = new NullWrapper("java.lang.String");
084: }
085:
086: Object paramObj1 = new LongWrapper(classPK);
087:
088: Object paramObj2 = number;
089:
090: if (number == null) {
091: paramObj2 = new NullWrapper("java.lang.String");
092: }
093:
094: Object paramObj3 = extension;
095:
096: if (extension == null) {
097: paramObj3 = new NullWrapper("java.lang.String");
098: }
099:
100: Object paramObj4 = new IntegerWrapper(typeId);
101:
102: Object paramObj5 = new BooleanWrapper(primary);
103:
104: MethodWrapper methodWrapper = new MethodWrapper(
105: PhoneServiceUtil.class.getName(), "addPhone",
106: new Object[] { paramObj0, paramObj1, paramObj2,
107: paramObj3, paramObj4, paramObj5 });
108:
109: Object returnObj = null;
110:
111: try {
112: returnObj = TunnelUtil.invoke(httpPrincipal,
113: methodWrapper);
114: } catch (Exception e) {
115: if (e instanceof com.liferay.portal.SystemException) {
116: throw (com.liferay.portal.SystemException) e;
117: }
118:
119: if (e instanceof com.liferay.portal.PortalException) {
120: throw (com.liferay.portal.PortalException) e;
121: }
122:
123: throw new com.liferay.portal.SystemException(e);
124: }
125:
126: return (com.liferay.portal.model.Phone) returnObj;
127: } catch (com.liferay.portal.SystemException se) {
128: _log.error(se, se);
129:
130: throw se;
131: }
132: }
133:
134: public static void deletePhone(HttpPrincipal httpPrincipal,
135: long phoneId) throws com.liferay.portal.SystemException,
136: com.liferay.portal.PortalException {
137: try {
138: Object paramObj0 = new LongWrapper(phoneId);
139:
140: MethodWrapper methodWrapper = new MethodWrapper(
141: PhoneServiceUtil.class.getName(), "deletePhone",
142: new Object[] { paramObj0 });
143:
144: try {
145: TunnelUtil.invoke(httpPrincipal, methodWrapper);
146: } catch (Exception e) {
147: if (e instanceof com.liferay.portal.SystemException) {
148: throw (com.liferay.portal.SystemException) e;
149: }
150:
151: if (e instanceof com.liferay.portal.PortalException) {
152: throw (com.liferay.portal.PortalException) e;
153: }
154:
155: throw new com.liferay.portal.SystemException(e);
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.portal.model.Phone getPhone(
165: HttpPrincipal httpPrincipal, long phoneId)
166: throws com.liferay.portal.SystemException,
167: com.liferay.portal.PortalException {
168: try {
169: Object paramObj0 = new LongWrapper(phoneId);
170:
171: MethodWrapper methodWrapper = new MethodWrapper(
172: PhoneServiceUtil.class.getName(), "getPhone",
173: new Object[] { paramObj0 });
174:
175: Object returnObj = null;
176:
177: try {
178: returnObj = TunnelUtil.invoke(httpPrincipal,
179: methodWrapper);
180: } catch (Exception e) {
181: if (e instanceof com.liferay.portal.SystemException) {
182: throw (com.liferay.portal.SystemException) e;
183: }
184:
185: if (e instanceof com.liferay.portal.PortalException) {
186: throw (com.liferay.portal.PortalException) e;
187: }
188:
189: throw new com.liferay.portal.SystemException(e);
190: }
191:
192: return (com.liferay.portal.model.Phone) returnObj;
193: } catch (com.liferay.portal.SystemException se) {
194: _log.error(se, se);
195:
196: throw se;
197: }
198: }
199:
200: public static java.util.List getPhones(HttpPrincipal httpPrincipal,
201: java.lang.String className, long classPK)
202: throws com.liferay.portal.SystemException,
203: com.liferay.portal.PortalException {
204: try {
205: Object paramObj0 = className;
206:
207: if (className == null) {
208: paramObj0 = new NullWrapper("java.lang.String");
209: }
210:
211: Object paramObj1 = new LongWrapper(classPK);
212:
213: MethodWrapper methodWrapper = new MethodWrapper(
214: PhoneServiceUtil.class.getName(), "getPhones",
215: new Object[] { paramObj0, paramObj1 });
216:
217: Object returnObj = null;
218:
219: try {
220: returnObj = TunnelUtil.invoke(httpPrincipal,
221: methodWrapper);
222: } catch (Exception e) {
223: if (e instanceof com.liferay.portal.SystemException) {
224: throw (com.liferay.portal.SystemException) e;
225: }
226:
227: if (e instanceof com.liferay.portal.PortalException) {
228: throw (com.liferay.portal.PortalException) e;
229: }
230:
231: throw new com.liferay.portal.SystemException(e);
232: }
233:
234: return (java.util.List) returnObj;
235: } catch (com.liferay.portal.SystemException se) {
236: _log.error(se, se);
237:
238: throw se;
239: }
240: }
241:
242: public static com.liferay.portal.model.Phone updatePhone(
243: HttpPrincipal httpPrincipal, long phoneId,
244: java.lang.String number, java.lang.String extension,
245: int typeId, boolean primary)
246: throws com.liferay.portal.SystemException,
247: com.liferay.portal.PortalException {
248: try {
249: Object paramObj0 = new LongWrapper(phoneId);
250:
251: Object paramObj1 = number;
252:
253: if (number == null) {
254: paramObj1 = new NullWrapper("java.lang.String");
255: }
256:
257: Object paramObj2 = extension;
258:
259: if (extension == null) {
260: paramObj2 = new NullWrapper("java.lang.String");
261: }
262:
263: Object paramObj3 = new IntegerWrapper(typeId);
264:
265: Object paramObj4 = new BooleanWrapper(primary);
266:
267: MethodWrapper methodWrapper = new MethodWrapper(
268: PhoneServiceUtil.class.getName(), "updatePhone",
269: new Object[] { paramObj0, paramObj1, paramObj2,
270: paramObj3, paramObj4 });
271:
272: Object returnObj = null;
273:
274: try {
275: returnObj = TunnelUtil.invoke(httpPrincipal,
276: methodWrapper);
277: } catch (Exception e) {
278: if (e instanceof com.liferay.portal.SystemException) {
279: throw (com.liferay.portal.SystemException) e;
280: }
281:
282: if (e instanceof com.liferay.portal.PortalException) {
283: throw (com.liferay.portal.PortalException) e;
284: }
285:
286: throw new com.liferay.portal.SystemException(e);
287: }
288:
289: return (com.liferay.portal.model.Phone) returnObj;
290: } catch (com.liferay.portal.SystemException se) {
291: _log.error(se, se);
292:
293: throw se;
294: }
295: }
296:
297: private static Log _log = LogFactoryUtil
298: .getLog(PhoneServiceHttp.class);
299: }
|