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