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