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.journal.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.journal.service.JournalTemplateServiceUtil;
033:
034: /**
035: * <a href="JournalTemplateServiceHttp.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.journal.service.JournalTemplateServiceUtil</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.journal.service.JournalTemplateServiceUtil
070: * @see com.liferay.portlet.journal.service.http.JournalTemplateServiceSoap
071: *
072: */
073: public class JournalTemplateServiceHttp {
074: public static com.liferay.portlet.journal.model.JournalTemplate addTemplate(
075: HttpPrincipal httpPrincipal, java.lang.String templateId,
076: boolean autoTemplateId, long plid,
077: java.lang.String structureId, java.lang.String name,
078: java.lang.String description, java.lang.String xsl,
079: boolean formatXsl, java.lang.String langType,
080: boolean cacheable, boolean smallImage,
081: java.lang.String smallImageURL, java.io.File smallFile,
082: boolean addCommunityPermissions, boolean addGuestPermissions)
083: throws com.liferay.portal.SystemException,
084: com.liferay.portal.PortalException {
085: try {
086: Object paramObj0 = templateId;
087:
088: if (templateId == null) {
089: paramObj0 = new NullWrapper("java.lang.String");
090: }
091:
092: Object paramObj1 = new BooleanWrapper(autoTemplateId);
093:
094: Object paramObj2 = new LongWrapper(plid);
095:
096: Object paramObj3 = structureId;
097:
098: if (structureId == null) {
099: paramObj3 = new NullWrapper("java.lang.String");
100: }
101:
102: Object paramObj4 = name;
103:
104: if (name == null) {
105: paramObj4 = new NullWrapper("java.lang.String");
106: }
107:
108: Object paramObj5 = description;
109:
110: if (description == null) {
111: paramObj5 = new NullWrapper("java.lang.String");
112: }
113:
114: Object paramObj6 = xsl;
115:
116: if (xsl == null) {
117: paramObj6 = new NullWrapper("java.lang.String");
118: }
119:
120: Object paramObj7 = new BooleanWrapper(formatXsl);
121:
122: Object paramObj8 = langType;
123:
124: if (langType == null) {
125: paramObj8 = new NullWrapper("java.lang.String");
126: }
127:
128: Object paramObj9 = new BooleanWrapper(cacheable);
129:
130: Object paramObj10 = new BooleanWrapper(smallImage);
131:
132: Object paramObj11 = smallImageURL;
133:
134: if (smallImageURL == null) {
135: paramObj11 = new NullWrapper("java.lang.String");
136: }
137:
138: Object paramObj12 = smallFile;
139:
140: if (smallFile == null) {
141: paramObj12 = new NullWrapper("java.io.File");
142: }
143:
144: Object paramObj13 = new BooleanWrapper(
145: addCommunityPermissions);
146:
147: Object paramObj14 = new BooleanWrapper(addGuestPermissions);
148:
149: MethodWrapper methodWrapper = new MethodWrapper(
150: JournalTemplateServiceUtil.class.getName(),
151: "addTemplate", new Object[] { paramObj0, paramObj1,
152: paramObj2, paramObj3, paramObj4, paramObj5,
153: paramObj6, paramObj7, paramObj8, paramObj9,
154: paramObj10, paramObj11, paramObj12,
155: paramObj13, paramObj14 });
156:
157: Object returnObj = null;
158:
159: try {
160: returnObj = TunnelUtil.invoke(httpPrincipal,
161: methodWrapper);
162: } catch (Exception e) {
163: if (e instanceof com.liferay.portal.SystemException) {
164: throw (com.liferay.portal.SystemException) e;
165: }
166:
167: if (e instanceof com.liferay.portal.PortalException) {
168: throw (com.liferay.portal.PortalException) e;
169: }
170:
171: throw new com.liferay.portal.SystemException(e);
172: }
173:
174: return (com.liferay.portlet.journal.model.JournalTemplate) returnObj;
175: } catch (com.liferay.portal.SystemException se) {
176: _log.error(se, se);
177:
178: throw se;
179: }
180: }
181:
182: public static com.liferay.portlet.journal.model.JournalTemplate addTemplate(
183: HttpPrincipal httpPrincipal, java.lang.String templateId,
184: boolean autoTemplateId, long plid,
185: java.lang.String structureId, java.lang.String name,
186: java.lang.String description, java.lang.String xsl,
187: boolean formatXsl, java.lang.String langType,
188: boolean cacheable, boolean smallImage,
189: java.lang.String smallImageURL, java.io.File smallFile,
190: java.lang.String[] communityPermissions,
191: java.lang.String[] guestPermissions)
192: throws com.liferay.portal.SystemException,
193: com.liferay.portal.PortalException {
194: try {
195: Object paramObj0 = templateId;
196:
197: if (templateId == null) {
198: paramObj0 = new NullWrapper("java.lang.String");
199: }
200:
201: Object paramObj1 = new BooleanWrapper(autoTemplateId);
202:
203: Object paramObj2 = new LongWrapper(plid);
204:
205: Object paramObj3 = structureId;
206:
207: if (structureId == null) {
208: paramObj3 = new NullWrapper("java.lang.String");
209: }
210:
211: Object paramObj4 = name;
212:
213: if (name == null) {
214: paramObj4 = new NullWrapper("java.lang.String");
215: }
216:
217: Object paramObj5 = description;
218:
219: if (description == null) {
220: paramObj5 = new NullWrapper("java.lang.String");
221: }
222:
223: Object paramObj6 = xsl;
224:
225: if (xsl == null) {
226: paramObj6 = new NullWrapper("java.lang.String");
227: }
228:
229: Object paramObj7 = new BooleanWrapper(formatXsl);
230:
231: Object paramObj8 = langType;
232:
233: if (langType == null) {
234: paramObj8 = new NullWrapper("java.lang.String");
235: }
236:
237: Object paramObj9 = new BooleanWrapper(cacheable);
238:
239: Object paramObj10 = new BooleanWrapper(smallImage);
240:
241: Object paramObj11 = smallImageURL;
242:
243: if (smallImageURL == null) {
244: paramObj11 = new NullWrapper("java.lang.String");
245: }
246:
247: Object paramObj12 = smallFile;
248:
249: if (smallFile == null) {
250: paramObj12 = new NullWrapper("java.io.File");
251: }
252:
253: Object paramObj13 = communityPermissions;
254:
255: if (communityPermissions == null) {
256: paramObj13 = new NullWrapper("[Ljava.lang.String;");
257: }
258:
259: Object paramObj14 = guestPermissions;
260:
261: if (guestPermissions == null) {
262: paramObj14 = new NullWrapper("[Ljava.lang.String;");
263: }
264:
265: MethodWrapper methodWrapper = new MethodWrapper(
266: JournalTemplateServiceUtil.class.getName(),
267: "addTemplate", new Object[] { paramObj0, paramObj1,
268: paramObj2, paramObj3, paramObj4, paramObj5,
269: paramObj6, paramObj7, paramObj8, paramObj9,
270: paramObj10, paramObj11, paramObj12,
271: paramObj13, paramObj14 });
272:
273: Object returnObj = null;
274:
275: try {
276: returnObj = TunnelUtil.invoke(httpPrincipal,
277: methodWrapper);
278: } catch (Exception e) {
279: if (e instanceof com.liferay.portal.SystemException) {
280: throw (com.liferay.portal.SystemException) e;
281: }
282:
283: if (e instanceof com.liferay.portal.PortalException) {
284: throw (com.liferay.portal.PortalException) e;
285: }
286:
287: throw new com.liferay.portal.SystemException(e);
288: }
289:
290: return (com.liferay.portlet.journal.model.JournalTemplate) returnObj;
291: } catch (com.liferay.portal.SystemException se) {
292: _log.error(se, se);
293:
294: throw se;
295: }
296: }
297:
298: public static void deleteTemplate(HttpPrincipal httpPrincipal,
299: long groupId, java.lang.String templateId)
300: throws com.liferay.portal.SystemException,
301: com.liferay.portal.PortalException {
302: try {
303: Object paramObj0 = new LongWrapper(groupId);
304:
305: Object paramObj1 = templateId;
306:
307: if (templateId == null) {
308: paramObj1 = new NullWrapper("java.lang.String");
309: }
310:
311: MethodWrapper methodWrapper = new MethodWrapper(
312: JournalTemplateServiceUtil.class.getName(),
313: "deleteTemplate", new Object[] { paramObj0,
314: paramObj1 });
315:
316: try {
317: TunnelUtil.invoke(httpPrincipal, methodWrapper);
318: } catch (Exception e) {
319: if (e instanceof com.liferay.portal.SystemException) {
320: throw (com.liferay.portal.SystemException) e;
321: }
322:
323: if (e instanceof com.liferay.portal.PortalException) {
324: throw (com.liferay.portal.PortalException) e;
325: }
326:
327: throw new com.liferay.portal.SystemException(e);
328: }
329: } catch (com.liferay.portal.SystemException se) {
330: _log.error(se, se);
331:
332: throw se;
333: }
334: }
335:
336: public static com.liferay.portlet.journal.model.JournalTemplate getTemplate(
337: HttpPrincipal httpPrincipal, long groupId,
338: java.lang.String templateId)
339: throws com.liferay.portal.SystemException,
340: com.liferay.portal.PortalException {
341: try {
342: Object paramObj0 = new LongWrapper(groupId);
343:
344: Object paramObj1 = templateId;
345:
346: if (templateId == null) {
347: paramObj1 = new NullWrapper("java.lang.String");
348: }
349:
350: MethodWrapper methodWrapper = new MethodWrapper(
351: JournalTemplateServiceUtil.class.getName(),
352: "getTemplate",
353: new Object[] { paramObj0, paramObj1 });
354:
355: Object returnObj = null;
356:
357: try {
358: returnObj = TunnelUtil.invoke(httpPrincipal,
359: methodWrapper);
360: } catch (Exception e) {
361: if (e instanceof com.liferay.portal.SystemException) {
362: throw (com.liferay.portal.SystemException) e;
363: }
364:
365: if (e instanceof com.liferay.portal.PortalException) {
366: throw (com.liferay.portal.PortalException) e;
367: }
368:
369: throw new com.liferay.portal.SystemException(e);
370: }
371:
372: return (com.liferay.portlet.journal.model.JournalTemplate) returnObj;
373: } catch (com.liferay.portal.SystemException se) {
374: _log.error(se, se);
375:
376: throw se;
377: }
378: }
379:
380: public static com.liferay.portlet.journal.model.JournalTemplate updateTemplate(
381: HttpPrincipal httpPrincipal, long groupId,
382: java.lang.String templateId, java.lang.String structureId,
383: java.lang.String name, java.lang.String description,
384: java.lang.String xsl, boolean formatXsl,
385: java.lang.String langType, boolean cacheable,
386: boolean smallImage, java.lang.String smallImageURL,
387: java.io.File smallFile)
388: throws com.liferay.portal.SystemException,
389: com.liferay.portal.PortalException {
390: try {
391: Object paramObj0 = new LongWrapper(groupId);
392:
393: Object paramObj1 = templateId;
394:
395: if (templateId == null) {
396: paramObj1 = new NullWrapper("java.lang.String");
397: }
398:
399: Object paramObj2 = structureId;
400:
401: if (structureId == null) {
402: paramObj2 = new NullWrapper("java.lang.String");
403: }
404:
405: Object paramObj3 = name;
406:
407: if (name == null) {
408: paramObj3 = new NullWrapper("java.lang.String");
409: }
410:
411: Object paramObj4 = description;
412:
413: if (description == null) {
414: paramObj4 = new NullWrapper("java.lang.String");
415: }
416:
417: Object paramObj5 = xsl;
418:
419: if (xsl == null) {
420: paramObj5 = new NullWrapper("java.lang.String");
421: }
422:
423: Object paramObj6 = new BooleanWrapper(formatXsl);
424:
425: Object paramObj7 = langType;
426:
427: if (langType == null) {
428: paramObj7 = new NullWrapper("java.lang.String");
429: }
430:
431: Object paramObj8 = new BooleanWrapper(cacheable);
432:
433: Object paramObj9 = new BooleanWrapper(smallImage);
434:
435: Object paramObj10 = smallImageURL;
436:
437: if (smallImageURL == null) {
438: paramObj10 = new NullWrapper("java.lang.String");
439: }
440:
441: Object paramObj11 = smallFile;
442:
443: if (smallFile == null) {
444: paramObj11 = new NullWrapper("java.io.File");
445: }
446:
447: MethodWrapper methodWrapper = new MethodWrapper(
448: JournalTemplateServiceUtil.class.getName(),
449: "updateTemplate", new Object[] { paramObj0,
450: paramObj1, paramObj2, paramObj3, paramObj4,
451: paramObj5, paramObj6, paramObj7, paramObj8,
452: paramObj9, paramObj10, paramObj11 });
453:
454: Object returnObj = null;
455:
456: try {
457: returnObj = TunnelUtil.invoke(httpPrincipal,
458: methodWrapper);
459: } catch (Exception e) {
460: if (e instanceof com.liferay.portal.SystemException) {
461: throw (com.liferay.portal.SystemException) e;
462: }
463:
464: if (e instanceof com.liferay.portal.PortalException) {
465: throw (com.liferay.portal.PortalException) e;
466: }
467:
468: throw new com.liferay.portal.SystemException(e);
469: }
470:
471: return (com.liferay.portlet.journal.model.JournalTemplate) returnObj;
472: } catch (com.liferay.portal.SystemException se) {
473: _log.error(se, se);
474:
475: throw se;
476: }
477: }
478:
479: private static Log _log = LogFactoryUtil
480: .getLog(JournalTemplateServiceHttp.class);
481: }
|