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