001
014
015 package com.liferay.portal.service.http;
016
017 import com.liferay.portal.kernel.log.Log;
018 import com.liferay.portal.kernel.log.LogFactoryUtil;
019 import com.liferay.portal.kernel.util.IntegerWrapper;
020 import com.liferay.portal.kernel.util.LongWrapper;
021 import com.liferay.portal.kernel.util.MethodWrapper;
022 import com.liferay.portal.kernel.util.NullWrapper;
023 import com.liferay.portal.security.auth.HttpPrincipal;
024 import com.liferay.portal.service.ResourcePermissionServiceUtil;
025
026
056 public class ResourcePermissionServiceHttp {
057 public static void addResourcePermission(HttpPrincipal httpPrincipal,
058 long groupId, long companyId, java.lang.String name, int scope,
059 java.lang.String primKey, long roleId, java.lang.String actionId)
060 throws com.liferay.portal.kernel.exception.PortalException,
061 com.liferay.portal.kernel.exception.SystemException {
062 try {
063 Object paramObj0 = new LongWrapper(groupId);
064
065 Object paramObj1 = new LongWrapper(companyId);
066
067 Object paramObj2 = name;
068
069 if (name == null) {
070 paramObj2 = new NullWrapper("java.lang.String");
071 }
072
073 Object paramObj3 = new IntegerWrapper(scope);
074
075 Object paramObj4 = primKey;
076
077 if (primKey == null) {
078 paramObj4 = new NullWrapper("java.lang.String");
079 }
080
081 Object paramObj5 = new LongWrapper(roleId);
082
083 Object paramObj6 = actionId;
084
085 if (actionId == null) {
086 paramObj6 = new NullWrapper("java.lang.String");
087 }
088
089 MethodWrapper methodWrapper = new MethodWrapper(ResourcePermissionServiceUtil.class.getName(),
090 "addResourcePermission",
091 new Object[] {
092 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
093 paramObj5, paramObj6
094 });
095
096 try {
097 TunnelUtil.invoke(httpPrincipal, methodWrapper);
098 }
099 catch (Exception e) {
100 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
101 throw (com.liferay.portal.kernel.exception.PortalException)e;
102 }
103
104 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
105 throw (com.liferay.portal.kernel.exception.SystemException)e;
106 }
107
108 throw new com.liferay.portal.kernel.exception.SystemException(e);
109 }
110 }
111 catch (com.liferay.portal.kernel.exception.SystemException se) {
112 _log.error(se, se);
113
114 throw se;
115 }
116 }
117
118 public static void setIndividualResourcePermissions(
119 HttpPrincipal httpPrincipal, long groupId, long companyId,
120 java.lang.String name, java.lang.String primKey, long roleId,
121 java.lang.String[] actionIds)
122 throws com.liferay.portal.kernel.exception.PortalException,
123 com.liferay.portal.kernel.exception.SystemException {
124 try {
125 Object paramObj0 = new LongWrapper(groupId);
126
127 Object paramObj1 = new LongWrapper(companyId);
128
129 Object paramObj2 = name;
130
131 if (name == null) {
132 paramObj2 = new NullWrapper("java.lang.String");
133 }
134
135 Object paramObj3 = primKey;
136
137 if (primKey == null) {
138 paramObj3 = new NullWrapper("java.lang.String");
139 }
140
141 Object paramObj4 = new LongWrapper(roleId);
142
143 Object paramObj5 = actionIds;
144
145 if (actionIds == null) {
146 paramObj5 = new NullWrapper("[Ljava.lang.String;");
147 }
148
149 MethodWrapper methodWrapper = new MethodWrapper(ResourcePermissionServiceUtil.class.getName(),
150 "setIndividualResourcePermissions",
151 new Object[] {
152 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
153 paramObj5
154 });
155
156 try {
157 TunnelUtil.invoke(httpPrincipal, methodWrapper);
158 }
159 catch (Exception e) {
160 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
161 throw (com.liferay.portal.kernel.exception.PortalException)e;
162 }
163
164 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
165 throw (com.liferay.portal.kernel.exception.SystemException)e;
166 }
167
168 throw new com.liferay.portal.kernel.exception.SystemException(e);
169 }
170 }
171 catch (com.liferay.portal.kernel.exception.SystemException se) {
172 _log.error(se, se);
173
174 throw se;
175 }
176 }
177
178 public static void removeResourcePermission(HttpPrincipal httpPrincipal,
179 long groupId, long companyId, java.lang.String name, int scope,
180 java.lang.String primKey, long roleId, java.lang.String actionId)
181 throws com.liferay.portal.kernel.exception.PortalException,
182 com.liferay.portal.kernel.exception.SystemException {
183 try {
184 Object paramObj0 = new LongWrapper(groupId);
185
186 Object paramObj1 = new LongWrapper(companyId);
187
188 Object paramObj2 = name;
189
190 if (name == null) {
191 paramObj2 = new NullWrapper("java.lang.String");
192 }
193
194 Object paramObj3 = new IntegerWrapper(scope);
195
196 Object paramObj4 = primKey;
197
198 if (primKey == null) {
199 paramObj4 = new NullWrapper("java.lang.String");
200 }
201
202 Object paramObj5 = new LongWrapper(roleId);
203
204 Object paramObj6 = actionId;
205
206 if (actionId == null) {
207 paramObj6 = new NullWrapper("java.lang.String");
208 }
209
210 MethodWrapper methodWrapper = new MethodWrapper(ResourcePermissionServiceUtil.class.getName(),
211 "removeResourcePermission",
212 new Object[] {
213 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
214 paramObj5, paramObj6
215 });
216
217 try {
218 TunnelUtil.invoke(httpPrincipal, methodWrapper);
219 }
220 catch (Exception e) {
221 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
222 throw (com.liferay.portal.kernel.exception.PortalException)e;
223 }
224
225 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
226 throw (com.liferay.portal.kernel.exception.SystemException)e;
227 }
228
229 throw new com.liferay.portal.kernel.exception.SystemException(e);
230 }
231 }
232 catch (com.liferay.portal.kernel.exception.SystemException se) {
233 _log.error(se, se);
234
235 throw se;
236 }
237 }
238
239 public static void removeResourcePermissions(HttpPrincipal httpPrincipal,
240 long groupId, long companyId, java.lang.String name, int scope,
241 long roleId, java.lang.String actionId)
242 throws com.liferay.portal.kernel.exception.PortalException,
243 com.liferay.portal.kernel.exception.SystemException {
244 try {
245 Object paramObj0 = new LongWrapper(groupId);
246
247 Object paramObj1 = new LongWrapper(companyId);
248
249 Object paramObj2 = name;
250
251 if (name == null) {
252 paramObj2 = new NullWrapper("java.lang.String");
253 }
254
255 Object paramObj3 = new IntegerWrapper(scope);
256
257 Object paramObj4 = new LongWrapper(roleId);
258
259 Object paramObj5 = actionId;
260
261 if (actionId == null) {
262 paramObj5 = new NullWrapper("java.lang.String");
263 }
264
265 MethodWrapper methodWrapper = new MethodWrapper(ResourcePermissionServiceUtil.class.getName(),
266 "removeResourcePermissions",
267 new Object[] {
268 paramObj0, paramObj1, paramObj2, paramObj3, paramObj4,
269 paramObj5
270 });
271
272 try {
273 TunnelUtil.invoke(httpPrincipal, methodWrapper);
274 }
275 catch (Exception e) {
276 if (e instanceof com.liferay.portal.kernel.exception.PortalException) {
277 throw (com.liferay.portal.kernel.exception.PortalException)e;
278 }
279
280 if (e instanceof com.liferay.portal.kernel.exception.SystemException) {
281 throw (com.liferay.portal.kernel.exception.SystemException)e;
282 }
283
284 throw new com.liferay.portal.kernel.exception.SystemException(e);
285 }
286 }
287 catch (com.liferay.portal.kernel.exception.SystemException se) {
288 _log.error(se, se);
289
290 throw se;
291 }
292 }
293
294 private static Log _log = LogFactoryUtil.getLog(ResourcePermissionServiceHttp.class);
295 }