1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.service.http;
16  
17  import com.liferay.portal.kernel.log.Log;
18  import com.liferay.portal.kernel.log.LogFactoryUtil;
19  import com.liferay.portal.kernel.util.LongWrapper;
20  import com.liferay.portal.kernel.util.MethodWrapper;
21  import com.liferay.portal.kernel.util.NullWrapper;
22  import com.liferay.portal.security.auth.HttpPrincipal;
23  import com.liferay.portal.service.UserGroupGroupRoleServiceUtil;
24  
25  /**
26   * <a href="UserGroupGroupRoleServiceHttp.java.html"><b><i>View Source</i></b></a>
27   *
28   * <p>
29   * ServiceBuilder generated this class. Modifications in this class will be
30   * overwritten the next time is generated.
31   * </p>
32   *
33   * <p>
34   * This class provides a HTTP utility for the
35   * {@link com.liferay.portal.service.UserGroupGroupRoleServiceUtil} service utility. The
36   * static methods of this class calls the same methods of the service utility.
37   * However, the signatures are different because it requires an additional
38   * {@link com.liferay.portal.security.auth.HttpPrincipal} parameter.
39   * </p>
40   *
41   * <p>
42   * The benefits of using the HTTP utility is that it is fast and allows for
43   * tunneling without the cost of serializing to text. The drawback is that it
44   * only works with Java.
45   * </p>
46   *
47   * <p>
48   * Set the property <b>tunnel.servlet.hosts.allowed</b> in portal.properties to
49   * configure security.
50   * </p>
51   *
52   * <p>
53   * The HTTP utility is only generated for remote services.
54   * </p>
55   *
56   * @author    Brian Wing Shun Chan
57   * @see       UserGroupGroupRoleServiceSoap
58   * @see       com.liferay.portal.security.auth.HttpPrincipal
59   * @see       com.liferay.portal.service.UserGroupGroupRoleServiceUtil
60   * @generated
61   */
62  public class UserGroupGroupRoleServiceHttp {
63      public static void addUserGroupGroupRoles(HttpPrincipal httpPrincipal,
64          long userGroupId, long groupId, long[] roleIds)
65          throws com.liferay.portal.kernel.exception.PortalException,
66              com.liferay.portal.kernel.exception.SystemException {
67          try {
68              Object paramObj0 = new LongWrapper(userGroupId);
69  
70              Object paramObj1 = new LongWrapper(groupId);
71  
72              Object paramObj2 = roleIds;
73  
74              if (roleIds == null) {
75                  paramObj2 = new NullWrapper("[J");
76              }
77  
78              MethodWrapper methodWrapper = new MethodWrapper(UserGroupGroupRoleServiceUtil.class.getName(),
79                      "addUserGroupGroupRoles",
80                      new Object[] { paramObj0, paramObj1, paramObj2 });
81  
82              try {
83                  TunnelUtil.invoke(httpPrincipal, methodWrapper);
84              }
85              catch (Exception e) {
86                  if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
87                      throw (com.liferay.portal.kernel.exception.PortalException)e;
88                  }
89  
90                  if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
91                      throw (com.liferay.portal.kernel.exception.SystemException)e;
92                  }
93  
94                  throw new com.liferay.portal.kernel.exception.SystemException(e);
95              }
96          }
97          catch (com.liferay.portal.kernel.exception.SystemException se) {
98              _log.error(se, se);
99  
100             throw se;
101         }
102     }
103 
104     public static void addUserGroupGroupRoles(HttpPrincipal httpPrincipal,
105         long[] userGroupIds, long groupId, long roleId)
106         throws com.liferay.portal.kernel.exception.PortalException,
107             com.liferay.portal.kernel.exception.SystemException {
108         try {
109             Object paramObj0 = userGroupIds;
110 
111             if (userGroupIds == null) {
112                 paramObj0 = new NullWrapper("[J");
113             }
114 
115             Object paramObj1 = new LongWrapper(groupId);
116 
117             Object paramObj2 = new LongWrapper(roleId);
118 
119             MethodWrapper methodWrapper = new MethodWrapper(UserGroupGroupRoleServiceUtil.class.getName(),
120                     "addUserGroupGroupRoles",
121                     new Object[] { paramObj0, paramObj1, paramObj2 });
122 
123             try {
124                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
125             }
126             catch (Exception e) {
127                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
128                     throw (com.liferay.portal.kernel.exception.PortalException)e;
129                 }
130 
131                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
132                     throw (com.liferay.portal.kernel.exception.SystemException)e;
133                 }
134 
135                 throw new com.liferay.portal.kernel.exception.SystemException(e);
136             }
137         }
138         catch (com.liferay.portal.kernel.exception.SystemException se) {
139             _log.error(se, se);
140 
141             throw se;
142         }
143     }
144 
145     public static void deleteUserGroupGroupRoles(HttpPrincipal httpPrincipal,
146         long userGroupId, long groupId, long[] roleIds)
147         throws com.liferay.portal.kernel.exception.PortalException,
148             com.liferay.portal.kernel.exception.SystemException {
149         try {
150             Object paramObj0 = new LongWrapper(userGroupId);
151 
152             Object paramObj1 = new LongWrapper(groupId);
153 
154             Object paramObj2 = roleIds;
155 
156             if (roleIds == null) {
157                 paramObj2 = new NullWrapper("[J");
158             }
159 
160             MethodWrapper methodWrapper = new MethodWrapper(UserGroupGroupRoleServiceUtil.class.getName(),
161                     "deleteUserGroupGroupRoles",
162                     new Object[] { paramObj0, paramObj1, paramObj2 });
163 
164             try {
165                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
166             }
167             catch (Exception e) {
168                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
169                     throw (com.liferay.portal.kernel.exception.PortalException)e;
170                 }
171 
172                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
173                     throw (com.liferay.portal.kernel.exception.SystemException)e;
174                 }
175 
176                 throw new com.liferay.portal.kernel.exception.SystemException(e);
177             }
178         }
179         catch (com.liferay.portal.kernel.exception.SystemException se) {
180             _log.error(se, se);
181 
182             throw se;
183         }
184     }
185 
186     public static void deleteUserGroupGroupRoles(HttpPrincipal httpPrincipal,
187         long[] userGroupIds, long groupId, long roleId)
188         throws com.liferay.portal.kernel.exception.PortalException,
189             com.liferay.portal.kernel.exception.SystemException {
190         try {
191             Object paramObj0 = userGroupIds;
192 
193             if (userGroupIds == null) {
194                 paramObj0 = new NullWrapper("[J");
195             }
196 
197             Object paramObj1 = new LongWrapper(groupId);
198 
199             Object paramObj2 = new LongWrapper(roleId);
200 
201             MethodWrapper methodWrapper = new MethodWrapper(UserGroupGroupRoleServiceUtil.class.getName(),
202                     "deleteUserGroupGroupRoles",
203                     new Object[] { paramObj0, paramObj1, paramObj2 });
204 
205             try {
206                 TunnelUtil.invoke(httpPrincipal, methodWrapper);
207             }
208             catch (Exception e) {
209                 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
210                     throw (com.liferay.portal.kernel.exception.PortalException)e;
211                 }
212 
213                 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
214                     throw (com.liferay.portal.kernel.exception.SystemException)e;
215                 }
216 
217                 throw new com.liferay.portal.kernel.exception.SystemException(e);
218             }
219         }
220         catch (com.liferay.portal.kernel.exception.SystemException se) {
221             _log.error(se, se);
222 
223             throw se;
224         }
225     }
226 
227     private static Log _log = LogFactoryUtil.getLog(UserGroupGroupRoleServiceHttp.class);
228 }