1   /**
2    * Copyright (c) 2000-2007 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.tags.service.http;
24  
25  import com.liferay.portal.kernel.log.Log;
26  import com.liferay.portal.kernel.log.LogFactoryUtil;
27  import com.liferay.portal.kernel.util.IntegerWrapper;
28  import com.liferay.portal.kernel.util.LongWrapper;
29  import com.liferay.portal.kernel.util.MethodWrapper;
30  import com.liferay.portal.kernel.util.NullWrapper;
31  import com.liferay.portal.security.auth.HttpPrincipal;
32  import com.liferay.portal.service.http.TunnelUtil;
33  
34  import com.liferay.portlet.tags.service.TagsAssetServiceUtil;
35  
36  /**
37   * <a href="TagsAssetServiceHttp.java.html"><b><i>View Source</i></b></a>
38   *
39   * <p>
40   * ServiceBuilder generated this class. Modifications in this class will be overwritten
41   * the next time is generated.
42   * </p>
43   *
44   * <p>
45   * This class provides a HTTP utility for the <code>com.liferay.portlet.tags.service.TagsAssetServiceUtil</code>
46   * service utility. The static methods of this class calls the same methods of the
47   * service utility. However, the signatures are different because it requires an
48   * additional <code>com.liferay.portal.security.auth.HttpPrincipal</code> parameter.
49   * </p>
50   *
51   * <p>
52   * The benefits of using the HTTP utility is that it is fast and allows for tunneling
53   * without the cost of serializing to text. The drawback is that it only works with
54   * Java.
55   * </p>
56   *
57   * <p>
58   * Set the property <code>tunnel.servlet.hosts.allowed</code> in portal.properties
59   * to configure security.
60   * </p>
61   *
62   * <p>
63   * The HTTP utility is only generated for remote services.
64   * </p>
65   *
66   * @author Brian Wing Shun Chan
67   *
68   * @see com.liferay.portal.security.auth.HttpPrincipal
69   * @see com.liferay.portlet.tags.service.TagsAssetServiceUtil
70   * @see com.liferay.portlet.tags.service.http.TagsAssetServiceSoap
71   *
72   */
73  public class TagsAssetServiceHttp {
74      public static void deleteAsset(HttpPrincipal httpPrincipal, long assetId)
75          throws com.liferay.portal.SystemException, 
76              com.liferay.portal.PortalException {
77          try {
78              Object paramObj0 = new LongWrapper(assetId);
79              MethodWrapper methodWrapper = new MethodWrapper(TagsAssetServiceUtil.class.getName(),
80                      "deleteAsset", new Object[] { paramObj0 });
81  
82              try {
83                  TunnelUtil.invoke(httpPrincipal, methodWrapper);
84              }
85              catch (Exception e) {
86                  if (e instanceof com.liferay.portal.SystemException) {
87                      throw (com.liferay.portal.SystemException)e;
88                  }
89  
90                  if (e instanceof com.liferay.portal.PortalException) {
91                      throw (com.liferay.portal.PortalException)e;
92                  }
93  
94                  throw new com.liferay.portal.SystemException(e);
95              }
96          }
97          catch (com.liferay.portal.SystemException se) {
98              _log.error(se, se);
99              throw se;
100         }
101     }
102 
103     public static com.liferay.portlet.tags.model.TagsAsset getAsset(
104         HttpPrincipal httpPrincipal, long assetId)
105         throws com.liferay.portal.SystemException, 
106             com.liferay.portal.PortalException {
107         try {
108             Object paramObj0 = new LongWrapper(assetId);
109             MethodWrapper methodWrapper = new MethodWrapper(TagsAssetServiceUtil.class.getName(),
110                     "getAsset", new Object[] { paramObj0 });
111             Object returnObj = null;
112 
113             try {
114                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
115             }
116             catch (Exception e) {
117                 if (e instanceof com.liferay.portal.SystemException) {
118                     throw (com.liferay.portal.SystemException)e;
119                 }
120 
121                 if (e instanceof com.liferay.portal.PortalException) {
122                     throw (com.liferay.portal.PortalException)e;
123                 }
124 
125                 throw new com.liferay.portal.SystemException(e);
126             }
127 
128             return (com.liferay.portlet.tags.model.TagsAsset)returnObj;
129         }
130         catch (com.liferay.portal.SystemException se) {
131             _log.error(se, se);
132             throw se;
133         }
134     }
135 
136     public static com.liferay.portlet.tags.model.TagsAssetType[] getAssetTypes(
137         HttpPrincipal httpPrincipal, java.lang.String languageId)
138         throws com.liferay.portal.SystemException {
139         try {
140             Object paramObj0 = languageId;
141 
142             if (languageId == null) {
143                 paramObj0 = new NullWrapper("java.lang.String");
144             }
145 
146             MethodWrapper methodWrapper = new MethodWrapper(TagsAssetServiceUtil.class.getName(),
147                     "getAssetTypes", new Object[] { paramObj0 });
148             Object returnObj = null;
149 
150             try {
151                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
152             }
153             catch (Exception e) {
154                 if (e instanceof com.liferay.portal.SystemException) {
155                     throw (com.liferay.portal.SystemException)e;
156                 }
157 
158                 throw new com.liferay.portal.SystemException(e);
159             }
160 
161             return (com.liferay.portlet.tags.model.TagsAssetType[])returnObj;
162         }
163         catch (com.liferay.portal.SystemException se) {
164             _log.error(se, se);
165             throw se;
166         }
167     }
168 
169     public static com.liferay.portlet.tags.model.TagsAssetDisplay[] getCompanyAssetDisplays(
170         HttpPrincipal httpPrincipal, long companyId, int begin, int end,
171         java.lang.String languageId)
172         throws com.liferay.portal.SystemException, 
173             com.liferay.portal.PortalException {
174         try {
175             Object paramObj0 = new LongWrapper(companyId);
176             Object paramObj1 = new IntegerWrapper(begin);
177             Object paramObj2 = new IntegerWrapper(end);
178             Object paramObj3 = languageId;
179 
180             if (languageId == null) {
181                 paramObj3 = new NullWrapper("java.lang.String");
182             }
183 
184             MethodWrapper methodWrapper = new MethodWrapper(TagsAssetServiceUtil.class.getName(),
185                     "getCompanyAssetDisplays",
186                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
187             Object returnObj = null;
188 
189             try {
190                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
191             }
192             catch (Exception e) {
193                 if (e instanceof com.liferay.portal.SystemException) {
194                     throw (com.liferay.portal.SystemException)e;
195                 }
196 
197                 if (e instanceof com.liferay.portal.PortalException) {
198                     throw (com.liferay.portal.PortalException)e;
199                 }
200 
201                 throw new com.liferay.portal.SystemException(e);
202             }
203 
204             return (com.liferay.portlet.tags.model.TagsAssetDisplay[])returnObj;
205         }
206         catch (com.liferay.portal.SystemException se) {
207             _log.error(se, se);
208             throw se;
209         }
210     }
211 
212     public static java.util.List getCompanyAssets(HttpPrincipal httpPrincipal,
213         long companyId, int begin, int end)
214         throws com.liferay.portal.SystemException {
215         try {
216             Object paramObj0 = new LongWrapper(companyId);
217             Object paramObj1 = new IntegerWrapper(begin);
218             Object paramObj2 = new IntegerWrapper(end);
219             MethodWrapper methodWrapper = new MethodWrapper(TagsAssetServiceUtil.class.getName(),
220                     "getCompanyAssets",
221                     new Object[] { paramObj0, paramObj1, paramObj2 });
222             Object returnObj = null;
223 
224             try {
225                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
226             }
227             catch (Exception e) {
228                 if (e instanceof com.liferay.portal.SystemException) {
229                     throw (com.liferay.portal.SystemException)e;
230                 }
231 
232                 throw new com.liferay.portal.SystemException(e);
233             }
234 
235             return (java.util.List)returnObj;
236         }
237         catch (com.liferay.portal.SystemException se) {
238             _log.error(se, se);
239             throw se;
240         }
241     }
242 
243     public static int getCompanyAssetsCount(HttpPrincipal httpPrincipal,
244         long companyId) throws com.liferay.portal.SystemException {
245         try {
246             Object paramObj0 = new LongWrapper(companyId);
247             MethodWrapper methodWrapper = new MethodWrapper(TagsAssetServiceUtil.class.getName(),
248                     "getCompanyAssetsCount", new Object[] { paramObj0 });
249             Object returnObj = null;
250 
251             try {
252                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
253             }
254             catch (Exception e) {
255                 if (e instanceof com.liferay.portal.SystemException) {
256                     throw (com.liferay.portal.SystemException)e;
257                 }
258 
259                 throw new com.liferay.portal.SystemException(e);
260             }
261 
262             return ((Integer)returnObj).intValue();
263         }
264         catch (com.liferay.portal.SystemException se) {
265             _log.error(se, se);
266             throw se;
267         }
268     }
269 
270     public static com.liferay.portlet.tags.model.TagsAssetDisplay[] searchAssetDisplays(
271         HttpPrincipal httpPrincipal, long companyId,
272         java.lang.String portletId, java.lang.String keywords,
273         java.lang.String languageId, int begin, int end)
274         throws com.liferay.portal.SystemException, 
275             com.liferay.portal.PortalException {
276         try {
277             Object paramObj0 = new LongWrapper(companyId);
278             Object paramObj1 = portletId;
279 
280             if (portletId == null) {
281                 paramObj1 = new NullWrapper("java.lang.String");
282             }
283 
284             Object paramObj2 = keywords;
285 
286             if (keywords == null) {
287                 paramObj2 = new NullWrapper("java.lang.String");
288             }
289 
290             Object paramObj3 = languageId;
291 
292             if (languageId == null) {
293                 paramObj3 = new NullWrapper("java.lang.String");
294             }
295 
296             Object paramObj4 = new IntegerWrapper(begin);
297             Object paramObj5 = new IntegerWrapper(end);
298             MethodWrapper methodWrapper = new MethodWrapper(TagsAssetServiceUtil.class.getName(),
299                     "searchAssetDisplays",
300                     new Object[] {
301                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
302                         paramObj5
303                     });
304             Object returnObj = null;
305 
306             try {
307                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
308             }
309             catch (Exception e) {
310                 if (e instanceof com.liferay.portal.SystemException) {
311                     throw (com.liferay.portal.SystemException)e;
312                 }
313 
314                 if (e instanceof com.liferay.portal.PortalException) {
315                     throw (com.liferay.portal.PortalException)e;
316                 }
317 
318                 throw new com.liferay.portal.SystemException(e);
319             }
320 
321             return (com.liferay.portlet.tags.model.TagsAssetDisplay[])returnObj;
322         }
323         catch (com.liferay.portal.SystemException se) {
324             _log.error(se, se);
325             throw se;
326         }
327     }
328 
329     public static int searchAssetDisplaysCount(HttpPrincipal httpPrincipal,
330         long companyId, java.lang.String portletId, java.lang.String keywords,
331         java.lang.String languageId) throws com.liferay.portal.SystemException {
332         try {
333             Object paramObj0 = new LongWrapper(companyId);
334             Object paramObj1 = portletId;
335 
336             if (portletId == null) {
337                 paramObj1 = new NullWrapper("java.lang.String");
338             }
339 
340             Object paramObj2 = keywords;
341 
342             if (keywords == null) {
343                 paramObj2 = new NullWrapper("java.lang.String");
344             }
345 
346             Object paramObj3 = languageId;
347 
348             if (languageId == null) {
349                 paramObj3 = new NullWrapper("java.lang.String");
350             }
351 
352             MethodWrapper methodWrapper = new MethodWrapper(TagsAssetServiceUtil.class.getName(),
353                     "searchAssetDisplaysCount",
354                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
355             Object returnObj = null;
356 
357             try {
358                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
359             }
360             catch (Exception e) {
361                 if (e instanceof com.liferay.portal.SystemException) {
362                     throw (com.liferay.portal.SystemException)e;
363                 }
364 
365                 throw new com.liferay.portal.SystemException(e);
366             }
367 
368             return ((Integer)returnObj).intValue();
369         }
370         catch (com.liferay.portal.SystemException se) {
371             _log.error(se, se);
372             throw se;
373         }
374     }
375 
376     public static com.liferay.portlet.tags.model.TagsAsset updateAsset(
377         HttpPrincipal httpPrincipal, java.lang.String className, long classPK,
378         java.lang.String[] entryNames, java.util.Date startDate,
379         java.util.Date endDate, java.util.Date publishDate,
380         java.util.Date expirationDate, java.lang.String mimeType,
381         java.lang.String title, java.lang.String description,
382         java.lang.String summary, java.lang.String url, int height, int width)
383         throws com.liferay.portal.SystemException, 
384             com.liferay.portal.PortalException {
385         try {
386             Object paramObj0 = className;
387 
388             if (className == null) {
389                 paramObj0 = new NullWrapper("java.lang.String");
390             }
391 
392             Object paramObj1 = new LongWrapper(classPK);
393             Object paramObj2 = entryNames;
394 
395             if (entryNames == null) {
396                 paramObj2 = new NullWrapper("[Ljava.lang.String;");
397             }
398 
399             Object paramObj3 = startDate;
400 
401             if (startDate == null) {
402                 paramObj3 = new NullWrapper("java.util.Date");
403             }
404 
405             Object paramObj4 = endDate;
406 
407             if (endDate == null) {
408                 paramObj4 = new NullWrapper("java.util.Date");
409             }
410 
411             Object paramObj5 = publishDate;
412 
413             if (publishDate == null) {
414                 paramObj5 = new NullWrapper("java.util.Date");
415             }
416 
417             Object paramObj6 = expirationDate;
418 
419             if (expirationDate == null) {
420                 paramObj6 = new NullWrapper("java.util.Date");
421             }
422 
423             Object paramObj7 = mimeType;
424 
425             if (mimeType == null) {
426                 paramObj7 = new NullWrapper("java.lang.String");
427             }
428 
429             Object paramObj8 = title;
430 
431             if (title == null) {
432                 paramObj8 = new NullWrapper("java.lang.String");
433             }
434 
435             Object paramObj9 = description;
436 
437             if (description == null) {
438                 paramObj9 = new NullWrapper("java.lang.String");
439             }
440 
441             Object paramObj10 = summary;
442 
443             if (summary == null) {
444                 paramObj10 = new NullWrapper("java.lang.String");
445             }
446 
447             Object paramObj11 = url;
448 
449             if (url == null) {
450                 paramObj11 = new NullWrapper("java.lang.String");
451             }
452 
453             Object paramObj12 = new IntegerWrapper(height);
454             Object paramObj13 = new IntegerWrapper(width);
455             MethodWrapper methodWrapper = new MethodWrapper(TagsAssetServiceUtil.class.getName(),
456                     "updateAsset",
457                     new Object[] {
458                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
459                         paramObj5, paramObj6, paramObj7, paramObj8, paramObj9,
460                         paramObj10, paramObj11, paramObj12, paramObj13
461                     });
462             Object returnObj = null;
463 
464             try {
465                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
466             }
467             catch (Exception e) {
468                 if (e instanceof com.liferay.portal.SystemException) {
469                     throw (com.liferay.portal.SystemException)e;
470                 }
471 
472                 if (e instanceof com.liferay.portal.PortalException) {
473                     throw (com.liferay.portal.PortalException)e;
474                 }
475 
476                 throw new com.liferay.portal.SystemException(e);
477             }
478 
479             return (com.liferay.portlet.tags.model.TagsAsset)returnObj;
480         }
481         catch (com.liferay.portal.SystemException se) {
482             _log.error(se, se);
483             throw se;
484         }
485     }
486 
487     private static Log _log = LogFactoryUtil.getLog(TagsAssetServiceHttp.class);
488 }