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.portlet.imagegallery.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.LongWrapper;
027: import com.liferay.portal.kernel.util.MethodWrapper;
028: import com.liferay.portal.kernel.util.NullWrapper;
029: import com.liferay.portal.security.auth.HttpPrincipal;
030: import com.liferay.portal.service.http.TunnelUtil;
031:
032: import com.liferay.portlet.imagegallery.service.IGFolderServiceUtil;
033:
034: /**
035: * <a href="IGFolderServiceHttp.java.html"><b><i>View Source</i></b></a>
036: *
037: * <p>
038: * ServiceBuilder generated this class. Modifications in this class will be
039: * overwritten the next time is generated.
040: * </p>
041: *
042: * <p>
043: * This class provides a HTTP utility for the
044: * <code>com.liferay.portlet.imagegallery.service.IGFolderServiceUtil</code> service
045: * utility. The static methods of this class calls the same methods of the
046: * service utility. However, the signatures are different because it requires an
047: * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code>
048: * parameter.
049: * </p>
050: *
051: * <p>
052: * The benefits of using the HTTP utility is that it is fast and allows for
053: * tunneling without the cost of serializing to text. The drawback is that it
054: * only works with Java.
055: * </p>
056: *
057: * <p>
058: * Set the property <code>tunnel.servlet.hosts.allowed</code> in
059: * portal.properties to configure security.
060: * </p>
061: *
062: * <p>
063: * The HTTP utility is only generated for remote services.
064: * </p>
065: *
066: * @author Brian Wing Shun Chan
067: *
068: * @see com.liferay.portal.security.auth.HttpPrincipal
069: * @see com.liferay.portlet.imagegallery.service.IGFolderServiceUtil
070: * @see com.liferay.portlet.imagegallery.service.http.IGFolderServiceSoap
071: *
072: */
073: public class IGFolderServiceHttp {
074: public static com.liferay.portlet.imagegallery.model.IGFolder addFolder(
075: HttpPrincipal httpPrincipal, long plid,
076: long parentFolderId, java.lang.String name,
077: java.lang.String description,
078: boolean addCommunityPermissions, boolean addGuestPermissions)
079: throws com.liferay.portal.SystemException,
080: com.liferay.portal.PortalException {
081: try {
082: Object paramObj0 = new LongWrapper(plid);
083:
084: Object paramObj1 = new LongWrapper(parentFolderId);
085:
086: Object paramObj2 = name;
087:
088: if (name == null) {
089: paramObj2 = new NullWrapper("java.lang.String");
090: }
091:
092: Object paramObj3 = description;
093:
094: if (description == null) {
095: paramObj3 = new NullWrapper("java.lang.String");
096: }
097:
098: Object paramObj4 = new BooleanWrapper(
099: addCommunityPermissions);
100:
101: Object paramObj5 = new BooleanWrapper(addGuestPermissions);
102:
103: MethodWrapper methodWrapper = new MethodWrapper(
104: IGFolderServiceUtil.class.getName(), "addFolder",
105: new Object[] { paramObj0, paramObj1, paramObj2,
106: paramObj3, paramObj4, paramObj5 });
107:
108: Object returnObj = null;
109:
110: try {
111: returnObj = TunnelUtil.invoke(httpPrincipal,
112: methodWrapper);
113: } catch (Exception e) {
114: if (e instanceof com.liferay.portal.SystemException) {
115: throw (com.liferay.portal.SystemException) e;
116: }
117:
118: if (e instanceof com.liferay.portal.PortalException) {
119: throw (com.liferay.portal.PortalException) e;
120: }
121:
122: throw new com.liferay.portal.SystemException(e);
123: }
124:
125: return (com.liferay.portlet.imagegallery.model.IGFolder) returnObj;
126: } catch (com.liferay.portal.SystemException se) {
127: _log.error(se, se);
128:
129: throw se;
130: }
131: }
132:
133: public static com.liferay.portlet.imagegallery.model.IGFolder addFolder(
134: HttpPrincipal httpPrincipal, long plid,
135: long parentFolderId, java.lang.String name,
136: java.lang.String description,
137: java.lang.String[] communityPermissions,
138: java.lang.String[] guestPermissions)
139: throws com.liferay.portal.SystemException,
140: com.liferay.portal.PortalException {
141: try {
142: Object paramObj0 = new LongWrapper(plid);
143:
144: Object paramObj1 = new LongWrapper(parentFolderId);
145:
146: Object paramObj2 = name;
147:
148: if (name == null) {
149: paramObj2 = new NullWrapper("java.lang.String");
150: }
151:
152: Object paramObj3 = description;
153:
154: if (description == null) {
155: paramObj3 = new NullWrapper("java.lang.String");
156: }
157:
158: Object paramObj4 = communityPermissions;
159:
160: if (communityPermissions == null) {
161: paramObj4 = new NullWrapper("[Ljava.lang.String;");
162: }
163:
164: Object paramObj5 = guestPermissions;
165:
166: if (guestPermissions == null) {
167: paramObj5 = new NullWrapper("[Ljava.lang.String;");
168: }
169:
170: MethodWrapper methodWrapper = new MethodWrapper(
171: IGFolderServiceUtil.class.getName(), "addFolder",
172: new Object[] { paramObj0, paramObj1, paramObj2,
173: paramObj3, paramObj4, paramObj5 });
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.portlet.imagegallery.model.IGFolder) returnObj;
193: } catch (com.liferay.portal.SystemException se) {
194: _log.error(se, se);
195:
196: throw se;
197: }
198: }
199:
200: public static void deleteFolder(HttpPrincipal httpPrincipal,
201: long folderId) throws com.liferay.portal.SystemException,
202: com.liferay.portal.PortalException {
203: try {
204: Object paramObj0 = new LongWrapper(folderId);
205:
206: MethodWrapper methodWrapper = new MethodWrapper(
207: IGFolderServiceUtil.class.getName(),
208: "deleteFolder", new Object[] { paramObj0 });
209:
210: try {
211: TunnelUtil.invoke(httpPrincipal, methodWrapper);
212: } catch (Exception e) {
213: if (e instanceof com.liferay.portal.SystemException) {
214: throw (com.liferay.portal.SystemException) e;
215: }
216:
217: if (e instanceof com.liferay.portal.PortalException) {
218: throw (com.liferay.portal.PortalException) e;
219: }
220:
221: throw new com.liferay.portal.SystemException(e);
222: }
223: } catch (com.liferay.portal.SystemException se) {
224: _log.error(se, se);
225:
226: throw se;
227: }
228: }
229:
230: public static com.liferay.portlet.imagegallery.model.IGFolder getFolder(
231: HttpPrincipal httpPrincipal, long folderId)
232: throws com.liferay.portal.SystemException,
233: com.liferay.portal.PortalException {
234: try {
235: Object paramObj0 = new LongWrapper(folderId);
236:
237: MethodWrapper methodWrapper = new MethodWrapper(
238: IGFolderServiceUtil.class.getName(), "getFolder",
239: new Object[] { paramObj0 });
240:
241: Object returnObj = null;
242:
243: try {
244: returnObj = TunnelUtil.invoke(httpPrincipal,
245: methodWrapper);
246: } catch (Exception e) {
247: if (e instanceof com.liferay.portal.SystemException) {
248: throw (com.liferay.portal.SystemException) e;
249: }
250:
251: if (e instanceof com.liferay.portal.PortalException) {
252: throw (com.liferay.portal.PortalException) e;
253: }
254:
255: throw new com.liferay.portal.SystemException(e);
256: }
257:
258: return (com.liferay.portlet.imagegallery.model.IGFolder) returnObj;
259: } catch (com.liferay.portal.SystemException se) {
260: _log.error(se, se);
261:
262: throw se;
263: }
264: }
265:
266: public static com.liferay.portlet.imagegallery.model.IGFolder updateFolder(
267: HttpPrincipal httpPrincipal, long folderId,
268: long parentFolderId, java.lang.String name,
269: java.lang.String description, boolean mergeWithParentFolder)
270: throws com.liferay.portal.SystemException,
271: com.liferay.portal.PortalException {
272: try {
273: Object paramObj0 = new LongWrapper(folderId);
274:
275: Object paramObj1 = new LongWrapper(parentFolderId);
276:
277: Object paramObj2 = name;
278:
279: if (name == null) {
280: paramObj2 = new NullWrapper("java.lang.String");
281: }
282:
283: Object paramObj3 = description;
284:
285: if (description == null) {
286: paramObj3 = new NullWrapper("java.lang.String");
287: }
288:
289: Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
290:
291: MethodWrapper methodWrapper = new MethodWrapper(
292: IGFolderServiceUtil.class.getName(),
293: "updateFolder",
294: new Object[] { paramObj0, paramObj1, paramObj2,
295: paramObj3, paramObj4 });
296:
297: Object returnObj = null;
298:
299: try {
300: returnObj = TunnelUtil.invoke(httpPrincipal,
301: methodWrapper);
302: } catch (Exception e) {
303: if (e instanceof com.liferay.portal.SystemException) {
304: throw (com.liferay.portal.SystemException) e;
305: }
306:
307: if (e instanceof com.liferay.portal.PortalException) {
308: throw (com.liferay.portal.PortalException) e;
309: }
310:
311: throw new com.liferay.portal.SystemException(e);
312: }
313:
314: return (com.liferay.portlet.imagegallery.model.IGFolder) returnObj;
315: } catch (com.liferay.portal.SystemException se) {
316: _log.error(se, se);
317:
318: throw se;
319: }
320: }
321:
322: private static Log _log = LogFactoryUtil
323: .getLog(IGFolderServiceHttp.class);
324: }
|