1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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.bookmarks.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.BooleanWrapper;
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.bookmarks.service.BookmarksFolderServiceUtil;
35  
36  /**
37   * <a href="BookmarksFolderServiceHttp.java.html"><b><i>View Source</i></b></a>
38   *
39   * <p>
40   * ServiceBuilder generated this class. Modifications in this class will be
41   * overwritten the next time is generated.
42   * </p>
43   *
44   * <p>
45   * This class provides a HTTP utility for the
46   * {@link com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil} service utility. The
47   * static methods of this class calls the same methods of the service utility.
48   * However, the signatures are different because it requires an additional
49   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
50   * </p>
51   *
52   * <p>
53   * The benefits of using the HTTP utility is that it is fast and allows for
54   * tunneling without the cost of serializing to text. The drawback is that it
55   * only works with Java.
56   * </p>
57   *
58   * <p>
59   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
60   * configure security.
61   * </p>
62   *
63   * <p>
64   * The HTTP utility is only generated for remote services.
65   * </p>
66   *
67   * @author    Brian Wing Shun Chan
68   * @see       BookmarksFolderServiceSoap
69   * @see       com.liferay.portal.security.auth.HttpPrincipal
70   * @see       com.liferay.portlet.bookmarks.service.BookmarksFolderServiceUtil
71   * @generated
72   */
73  public class BookmarksFolderServiceHttp {
74      public static com.liferay.portlet.bookmarks.model.BookmarksFolder addFolder(
75          HttpPrincipal httpPrincipal, long parentFolderId,
76          java.lang.String name, java.lang.String description,
77          com.liferay.portal.service.ServiceContext serviceContext)
78          throws com.liferay.portal.PortalException,
79              com.liferay.portal.SystemException {
80          try {
81              Object paramObj0 = new LongWrapper(parentFolderId);
82  
83              Object paramObj1 = name;
84  
85              if (name == null) {
86                  paramObj1 = new NullWrapper("java.lang.String");
87              }
88  
89              Object paramObj2 = description;
90  
91              if (description == null) {
92                  paramObj2 = new NullWrapper("java.lang.String");
93              }
94  
95              Object paramObj3 = serviceContext;
96  
97              if (serviceContext == null) {
98                  paramObj3 = new NullWrapper(
99                          "com.liferay.portal.service.ServiceContext");
100             }
101 
102             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
103                     "addFolder",
104                     new Object[] { paramObj0, paramObj1, paramObj2, paramObj3 });
105 
106             Object returnObj = null;
107 
108             try {
109                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
110             }
111             catch (Exception e) {
112                 if (e instanceof com.liferay.portal.PortalException) {
113                     throw (com.liferay.portal.PortalException)e;
114                 }
115 
116                 if (e instanceof com.liferay.portal.SystemException) {
117                     throw (com.liferay.portal.SystemException)e;
118                 }
119 
120                 throw new com.liferay.portal.SystemException(e);
121             }
122 
123             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
124         }
125         catch (com.liferay.portal.SystemException se) {
126             _log.error(se, se);
127 
128             throw se;
129         }
130     }
131 
132     public static void deleteFolder(HttpPrincipal httpPrincipal, long folderId)
133         throws com.liferay.portal.PortalException,
134             com.liferay.portal.SystemException {
135         try {
136             Object paramObj0 = new LongWrapper(folderId);
137 
138             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
139                     "deleteFolder", new Object[] { paramObj0 });
140 
141             try {
142                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
143             }
144             catch (Exception e) {
145                 if (e instanceof com.liferay.portal.PortalException) {
146                     throw (com.liferay.portal.PortalException)e;
147                 }
148 
149                 if (e instanceof com.liferay.portal.SystemException) {
150                     throw (com.liferay.portal.SystemException)e;
151                 }
152 
153                 throw new com.liferay.portal.SystemException(e);
154             }
155         }
156         catch (com.liferay.portal.SystemException se) {
157             _log.error(se, se);
158 
159             throw se;
160         }
161     }
162 
163     public static com.liferay.portlet.bookmarks.model.BookmarksFolder getFolder(
164         HttpPrincipal httpPrincipal, long folderId)
165         throws com.liferay.portal.PortalException,
166             com.liferay.portal.SystemException {
167         try {
168             Object paramObj0 = new LongWrapper(folderId);
169 
170             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
171                     "getFolder", new Object[] { paramObj0 });
172 
173             Object returnObj = null;
174 
175             try {
176                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
177             }
178             catch (Exception e) {
179                 if (e instanceof com.liferay.portal.PortalException) {
180                     throw (com.liferay.portal.PortalException)e;
181                 }
182 
183                 if (e instanceof com.liferay.portal.SystemException) {
184                     throw (com.liferay.portal.SystemException)e;
185                 }
186 
187                 throw new com.liferay.portal.SystemException(e);
188             }
189 
190             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
191         }
192         catch (com.liferay.portal.SystemException se) {
193             _log.error(se, se);
194 
195             throw se;
196         }
197     }
198 
199     public static com.liferay.portlet.bookmarks.model.BookmarksFolder updateFolder(
200         HttpPrincipal httpPrincipal, long folderId, long parentFolderId,
201         java.lang.String name, java.lang.String description,
202         boolean mergeWithParentFolder,
203         com.liferay.portal.service.ServiceContext serviceContext)
204         throws com.liferay.portal.PortalException,
205             com.liferay.portal.SystemException {
206         try {
207             Object paramObj0 = new LongWrapper(folderId);
208 
209             Object paramObj1 = new LongWrapper(parentFolderId);
210 
211             Object paramObj2 = name;
212 
213             if (name == null) {
214                 paramObj2 = new NullWrapper("java.lang.String");
215             }
216 
217             Object paramObj3 = description;
218 
219             if (description == null) {
220                 paramObj3 = new NullWrapper("java.lang.String");
221             }
222 
223             Object paramObj4 = new BooleanWrapper(mergeWithParentFolder);
224 
225             Object paramObj5 = serviceContext;
226 
227             if (serviceContext == null) {
228                 paramObj5 = new NullWrapper(
229                         "com.liferay.portal.service.ServiceContext");
230             }
231 
232             MethodWrapper methodWrapper = new MethodWrapper(BookmarksFolderServiceUtil.class.getName(),
233                     "updateFolder",
234                     new Object[] {
235                         paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
236                         paramObj5
237                     });
238 
239             Object returnObj = null;
240 
241             try {
242                 returnObj = TunnelUtil.invoke(httpPrincipal, methodWrapper);
243             }
244             catch (Exception e) {
245                 if (e instanceof com.liferay.portal.PortalException) {
246                     throw (com.liferay.portal.PortalException)e;
247                 }
248 
249                 if (e instanceof com.liferay.portal.SystemException) {
250                     throw (com.liferay.portal.SystemException)e;
251                 }
252 
253                 throw new com.liferay.portal.SystemException(e);
254             }
255 
256             return (com.liferay.portlet.bookmarks.model.BookmarksFolder)returnObj;
257         }
258         catch (com.liferay.portal.SystemException se) {
259             _log.error(se, se);
260 
261             throw se;
262         }
263     }
264 
265     private static Log _log = LogFactoryUtil.getLog(BookmarksFolderServiceHttp.class);
266 }