1
22
23 package com.liferay.portal.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.LongWrapper;
28 import com.liferay.portal.kernel.util.MethodWrapper;
29 import com.liferay.portal.kernel.util.NullWrapper;
30 import com.liferay.portal.security.auth.HttpPrincipal;
31 import com.liferay.portal.service.UserGroupRoleServiceUtil;
32
33
72 public class UserGroupRoleServiceHttp {
73 public static void addUserGroupRoles(HttpPrincipal httpPrincipal,
74 long userId, long groupId, long[] roleIds)
75 throws com.liferay.portal.PortalException,
76 com.liferay.portal.SystemException {
77 try {
78 Object paramObj0 = new LongWrapper(userId);
79
80 Object paramObj1 = new LongWrapper(groupId);
81
82 Object paramObj2 = roleIds;
83
84 if (roleIds == null) {
85 paramObj2 = new NullWrapper("[J");
86 }
87
88 MethodWrapper methodWrapper = new MethodWrapper(UserGroupRoleServiceUtil.class.getName(),
89 "addUserGroupRoles",
90 new Object[] { paramObj0, paramObj1, paramObj2 });
91
92 try {
93 TunnelUtil.invoke(httpPrincipal, methodWrapper);
94 }
95 catch (Exception e) {
96 if (e instanceof com.liferay.portal.PortalException) {
97 throw (com.liferay.portal.PortalException)e;
98 }
99
100 if (e instanceof com.liferay.portal.SystemException) {
101 throw (com.liferay.portal.SystemException)e;
102 }
103
104 throw new com.liferay.portal.SystemException(e);
105 }
106 }
107 catch (com.liferay.portal.SystemException se) {
108 _log.error(se, se);
109
110 throw se;
111 }
112 }
113
114 public static void addUserGroupRoles(HttpPrincipal httpPrincipal,
115 long[] userIds, long groupId, long roleId)
116 throws com.liferay.portal.PortalException,
117 com.liferay.portal.SystemException {
118 try {
119 Object paramObj0 = userIds;
120
121 if (userIds == null) {
122 paramObj0 = new NullWrapper("[J");
123 }
124
125 Object paramObj1 = new LongWrapper(groupId);
126
127 Object paramObj2 = new LongWrapper(roleId);
128
129 MethodWrapper methodWrapper = new MethodWrapper(UserGroupRoleServiceUtil.class.getName(),
130 "addUserGroupRoles",
131 new Object[] { paramObj0, paramObj1, paramObj2 });
132
133 try {
134 TunnelUtil.invoke(httpPrincipal, methodWrapper);
135 }
136 catch (Exception e) {
137 if (e instanceof com.liferay.portal.PortalException) {
138 throw (com.liferay.portal.PortalException)e;
139 }
140
141 if (e instanceof com.liferay.portal.SystemException) {
142 throw (com.liferay.portal.SystemException)e;
143 }
144
145 throw new com.liferay.portal.SystemException(e);
146 }
147 }
148 catch (com.liferay.portal.SystemException se) {
149 _log.error(se, se);
150
151 throw se;
152 }
153 }
154
155 public static void deleteUserGroupRoles(HttpPrincipal httpPrincipal,
156 long userId, long groupId, long[] roleIds)
157 throws com.liferay.portal.PortalException,
158 com.liferay.portal.SystemException {
159 try {
160 Object paramObj0 = new LongWrapper(userId);
161
162 Object paramObj1 = new LongWrapper(groupId);
163
164 Object paramObj2 = roleIds;
165
166 if (roleIds == null) {
167 paramObj2 = new NullWrapper("[J");
168 }
169
170 MethodWrapper methodWrapper = new MethodWrapper(UserGroupRoleServiceUtil.class.getName(),
171 "deleteUserGroupRoles",
172 new Object[] { paramObj0, paramObj1, paramObj2 });
173
174 try {
175 TunnelUtil.invoke(httpPrincipal, methodWrapper);
176 }
177 catch (Exception e) {
178 if (e instanceof com.liferay.portal.PortalException) {
179 throw (com.liferay.portal.PortalException)e;
180 }
181
182 if (e instanceof com.liferay.portal.SystemException) {
183 throw (com.liferay.portal.SystemException)e;
184 }
185
186 throw new com.liferay.portal.SystemException(e);
187 }
188 }
189 catch (com.liferay.portal.SystemException se) {
190 _log.error(se, se);
191
192 throw se;
193 }
194 }
195
196 public static void deleteUserGroupRoles(HttpPrincipal httpPrincipal,
197 long[] userIds, long groupId, long roleId)
198 throws com.liferay.portal.PortalException,
199 com.liferay.portal.SystemException {
200 try {
201 Object paramObj0 = userIds;
202
203 if (userIds == null) {
204 paramObj0 = new NullWrapper("[J");
205 }
206
207 Object paramObj1 = new LongWrapper(groupId);
208
209 Object paramObj2 = new LongWrapper(roleId);
210
211 MethodWrapper methodWrapper = new MethodWrapper(UserGroupRoleServiceUtil.class.getName(),
212 "deleteUserGroupRoles",
213 new Object[] { paramObj0, paramObj1, paramObj2 });
214
215 try {
216 TunnelUtil.invoke(httpPrincipal, methodWrapper);
217 }
218 catch (Exception e) {
219 if (e instanceof com.liferay.portal.PortalException) {
220 throw (com.liferay.portal.PortalException)e;
221 }
222
223 if (e instanceof com.liferay.portal.SystemException) {
224 throw (com.liferay.portal.SystemException)e;
225 }
226
227 throw new com.liferay.portal.SystemException(e);
228 }
229 }
230 catch (com.liferay.portal.SystemException se) {
231 _log.error(se, se);
232
233 throw se;
234 }
235 }
236
237 private static Log _log = LogFactoryUtil.getLog(UserGroupRoleServiceHttp.class);
238 }