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.IntegerWrapper;
28 import com.liferay.portal.kernel.util.LongWrapper;
29 import com.liferay.portal.kernel.util.MethodWrapper;
30 import com.liferay.portal.kernel.util.NullWrapper;
31 import com.liferay.portal.security.auth.HttpPrincipal;
32 import com.liferay.portal.service.ResourcePermissionServiceUtil;
33
34
73 public class ResourcePermissionServiceHttp {
74 public static void addResourcePermission(HttpPrincipal httpPrincipal,
75 long groupId, long companyId, java.lang.String name, int scope,
76 java.lang.String primKey, long roleId, java.lang.String actionId)
77 throws com.liferay.portal.PortalException,
78 com.liferay.portal.SystemException {
79 try {
80 Object paramObj0 = new LongWrapper(groupId);
81
82 Object paramObj1 = new LongWrapper(companyId);
83
84 Object paramObj2 = name;
85
86 if (name == null) {
87 paramObj2 = new NullWrapper("java.lang.String");
88 }
89
90 Object paramObj3 = new IntegerWrapper(scope);
91
92 Object paramObj4 = primKey;
93
94 if (primKey == null) {
95 paramObj4 = new NullWrapper("java.lang.String");
96 }
97
98 Object paramObj5 = new LongWrapper(roleId);
99
100 Object paramObj6 = actionId;
101
102 if (actionId == null) {
103 paramObj6 = new NullWrapper("java.lang.String");
104 }
105
106 MethodWrapper methodWrapper = new MethodWrapper(ResourcePermissionServiceUtil.class.getName(),
107 "addResourcePermission",
108 new Object[] {
109 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
110 paramObj5, paramObj6
111 });
112
113 try {
114 TunnelUtil.invoke(httpPrincipal, methodWrapper);
115 }
116 catch (Exception e) {
117 if (e instanceof com.liferay.portal.PortalException) {
118 throw (com.liferay.portal.PortalException)e;
119 }
120
121 if (e instanceof com.liferay.portal.SystemException) {
122 throw (com.liferay.portal.SystemException)e;
123 }
124
125 throw new com.liferay.portal.SystemException(e);
126 }
127 }
128 catch (com.liferay.portal.SystemException se) {
129 _log.error(se, se);
130
131 throw se;
132 }
133 }
134
135 public static void setIndividualResourcePermissions(
136 HttpPrincipal httpPrincipal, long groupId, long companyId,
137 java.lang.String name, java.lang.String primKey, long roleId,
138 java.lang.String[] actionIds)
139 throws com.liferay.portal.PortalException,
140 com.liferay.portal.SystemException {
141 try {
142 Object paramObj0 = new LongWrapper(groupId);
143
144 Object paramObj1 = new LongWrapper(companyId);
145
146 Object paramObj2 = name;
147
148 if (name == null) {
149 paramObj2 = new NullWrapper("java.lang.String");
150 }
151
152 Object paramObj3 = primKey;
153
154 if (primKey == null) {
155 paramObj3 = new NullWrapper("java.lang.String");
156 }
157
158 Object paramObj4 = new LongWrapper(roleId);
159
160 Object paramObj5 = actionIds;
161
162 if (actionIds == null) {
163 paramObj5 = new NullWrapper("[Ljava.lang.String;");
164 }
165
166 MethodWrapper methodWrapper = new MethodWrapper(ResourcePermissionServiceUtil.class.getName(),
167 "setIndividualResourcePermissions",
168 new Object[] {
169 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
170 paramObj5
171 });
172
173 try {
174 TunnelUtil.invoke(httpPrincipal, methodWrapper);
175 }
176 catch (Exception e) {
177 if (e instanceof com.liferay.portal.PortalException) {
178 throw (com.liferay.portal.PortalException)e;
179 }
180
181 if (e instanceof com.liferay.portal.SystemException) {
182 throw (com.liferay.portal.SystemException)e;
183 }
184
185 throw new com.liferay.portal.SystemException(e);
186 }
187 }
188 catch (com.liferay.portal.SystemException se) {
189 _log.error(se, se);
190
191 throw se;
192 }
193 }
194
195 public static void removeResourcePermission(HttpPrincipal httpPrincipal,
196 long groupId, long companyId, java.lang.String name, int scope,
197 java.lang.String primKey, long roleId, java.lang.String actionId)
198 throws com.liferay.portal.PortalException,
199 com.liferay.portal.SystemException {
200 try {
201 Object paramObj0 = new LongWrapper(groupId);
202
203 Object paramObj1 = new LongWrapper(companyId);
204
205 Object paramObj2 = name;
206
207 if (name == null) {
208 paramObj2 = new NullWrapper("java.lang.String");
209 }
210
211 Object paramObj3 = new IntegerWrapper(scope);
212
213 Object paramObj4 = primKey;
214
215 if (primKey == null) {
216 paramObj4 = new NullWrapper("java.lang.String");
217 }
218
219 Object paramObj5 = new LongWrapper(roleId);
220
221 Object paramObj6 = actionId;
222
223 if (actionId == null) {
224 paramObj6 = new NullWrapper("java.lang.String");
225 }
226
227 MethodWrapper methodWrapper = new MethodWrapper(ResourcePermissionServiceUtil.class.getName(),
228 "removeResourcePermission",
229 new Object[] {
230 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
231 paramObj5, paramObj6
232 });
233
234 try {
235 TunnelUtil.invoke(httpPrincipal, methodWrapper);
236 }
237 catch (Exception e) {
238 if (e instanceof com.liferay.portal.PortalException) {
239 throw (com.liferay.portal.PortalException)e;
240 }
241
242 if (e instanceof com.liferay.portal.SystemException) {
243 throw (com.liferay.portal.SystemException)e;
244 }
245
246 throw new com.liferay.portal.SystemException(e);
247 }
248 }
249 catch (com.liferay.portal.SystemException se) {
250 _log.error(se, se);
251
252 throw se;
253 }
254 }
255
256 public static void removeResourcePermissions(HttpPrincipal httpPrincipal,
257 long groupId, long companyId, java.lang.String name, int scope,
258 long roleId, java.lang.String actionId)
259 throws com.liferay.portal.PortalException,
260 com.liferay.portal.SystemException {
261 try {
262 Object paramObj0 = new LongWrapper(groupId);
263
264 Object paramObj1 = new LongWrapper(companyId);
265
266 Object paramObj2 = name;
267
268 if (name == null) {
269 paramObj2 = new NullWrapper("java.lang.String");
270 }
271
272 Object paramObj3 = new IntegerWrapper(scope);
273
274 Object paramObj4 = new LongWrapper(roleId);
275
276 Object paramObj5 = actionId;
277
278 if (actionId == null) {
279 paramObj5 = new NullWrapper("java.lang.String");
280 }
281
282 MethodWrapper methodWrapper = new MethodWrapper(ResourcePermissionServiceUtil.class.getName(),
283 "removeResourcePermissions",
284 new Object[] {
285 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
286 paramObj5
287 });
288
289 try {
290 TunnelUtil.invoke(httpPrincipal, methodWrapper);
291 }
292 catch (Exception e) {
293 if (e instanceof com.liferay.portal.PortalException) {
294 throw (com.liferay.portal.PortalException)e;
295 }
296
297 if (e instanceof com.liferay.portal.SystemException) {
298 throw (com.liferay.portal.SystemException)e;
299 }
300
301 throw new com.liferay.portal.SystemException(e);
302 }
303 }
304 catch (com.liferay.portal.SystemException se) {
305 _log.error(se, se);
306
307 throw se;
308 }
309 }
310
311 private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceHttp.class);
312 }