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