001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the permission local service. This utility wraps {@link com.liferay.portal.service.impl.PermissionLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server.
023     *
024     * <p>
025     * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see PermissionLocalService
030     * @see com.liferay.portal.service.base.PermissionLocalServiceBaseImpl
031     * @see com.liferay.portal.service.impl.PermissionLocalServiceImpl
032     * @generated
033     */
034    public class PermissionLocalServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.PermissionLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040    
041            /**
042            * Adds the permission to the database. Also notifies the appropriate model listeners.
043            *
044            * @param permission the permission
045            * @return the permission that was added
046            * @throws SystemException if a system exception occurred
047            */
048            public static com.liferay.portal.model.Permission addPermission(
049                    com.liferay.portal.model.Permission permission)
050                    throws com.liferay.portal.kernel.exception.SystemException {
051                    return getService().addPermission(permission);
052            }
053    
054            /**
055            * Creates a new permission with the primary key. Does not add the permission to the database.
056            *
057            * @param permissionId the primary key for the new permission
058            * @return the new permission
059            */
060            public static com.liferay.portal.model.Permission createPermission(
061                    long permissionId) {
062                    return getService().createPermission(permissionId);
063            }
064    
065            /**
066            * Deletes the permission with the primary key from the database. Also notifies the appropriate model listeners.
067            *
068            * @param permissionId the primary key of the permission
069            * @throws PortalException if a permission with the primary key could not be found
070            * @throws SystemException if a system exception occurred
071            */
072            public static void deletePermission(long permissionId)
073                    throws com.liferay.portal.kernel.exception.PortalException,
074                            com.liferay.portal.kernel.exception.SystemException {
075                    getService().deletePermission(permissionId);
076            }
077    
078            /**
079            * Deletes the permission from the database. Also notifies the appropriate model listeners.
080            *
081            * @param permission the permission
082            * @throws SystemException if a system exception occurred
083            */
084            public static void deletePermission(
085                    com.liferay.portal.model.Permission permission)
086                    throws com.liferay.portal.kernel.exception.SystemException {
087                    getService().deletePermission(permission);
088            }
089    
090            /**
091            * Performs a dynamic query on the database and returns the matching rows.
092            *
093            * @param dynamicQuery the dynamic query
094            * @return the matching rows
095            * @throws SystemException if a system exception occurred
096            */
097            @SuppressWarnings("rawtypes")
098            public static java.util.List dynamicQuery(
099                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
100                    throws com.liferay.portal.kernel.exception.SystemException {
101                    return getService().dynamicQuery(dynamicQuery);
102            }
103    
104            /**
105            * Performs a dynamic query on the database and returns a range of the matching rows.
106            *
107            * <p>
108            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
109            * </p>
110            *
111            * @param dynamicQuery the dynamic query
112            * @param start the lower bound of the range of model instances
113            * @param end the upper bound of the range of model instances (not inclusive)
114            * @return the range of matching rows
115            * @throws SystemException if a system exception occurred
116            */
117            @SuppressWarnings("rawtypes")
118            public static java.util.List dynamicQuery(
119                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
120                    int end) throws com.liferay.portal.kernel.exception.SystemException {
121                    return getService().dynamicQuery(dynamicQuery, start, end);
122            }
123    
124            /**
125            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
126            *
127            * <p>
128            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
129            * </p>
130            *
131            * @param dynamicQuery the dynamic query
132            * @param start the lower bound of the range of model instances
133            * @param end the upper bound of the range of model instances (not inclusive)
134            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
135            * @return the ordered range of matching rows
136            * @throws SystemException if a system exception occurred
137            */
138            @SuppressWarnings("rawtypes")
139            public static java.util.List dynamicQuery(
140                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
141                    int end,
142                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
143                    throws com.liferay.portal.kernel.exception.SystemException {
144                    return getService()
145                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
146            }
147    
148            /**
149            * Returns the number of rows that match the dynamic query.
150            *
151            * @param dynamicQuery the dynamic query
152            * @return the number of rows that match the dynamic query
153            * @throws SystemException if a system exception occurred
154            */
155            public static long dynamicQueryCount(
156                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    return getService().dynamicQueryCount(dynamicQuery);
159            }
160    
161            public static com.liferay.portal.model.Permission fetchPermission(
162                    long permissionId)
163                    throws com.liferay.portal.kernel.exception.SystemException {
164                    return getService().fetchPermission(permissionId);
165            }
166    
167            /**
168            * Returns the permission with the primary key.
169            *
170            * @param permissionId the primary key of the permission
171            * @return the permission
172            * @throws PortalException if a permission with the primary key could not be found
173            * @throws SystemException if a system exception occurred
174            */
175            public static com.liferay.portal.model.Permission getPermission(
176                    long permissionId)
177                    throws com.liferay.portal.kernel.exception.PortalException,
178                            com.liferay.portal.kernel.exception.SystemException {
179                    return getService().getPermission(permissionId);
180            }
181    
182            public static com.liferay.portal.model.PersistedModel getPersistedModel(
183                    java.io.Serializable primaryKeyObj)
184                    throws com.liferay.portal.kernel.exception.PortalException,
185                            com.liferay.portal.kernel.exception.SystemException {
186                    return getService().getPersistedModel(primaryKeyObj);
187            }
188    
189            /**
190            * Returns a range of all the permissions.
191            *
192            * <p>
193            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
194            * </p>
195            *
196            * @param start the lower bound of the range of permissions
197            * @param end the upper bound of the range of permissions (not inclusive)
198            * @return the range of permissions
199            * @throws SystemException if a system exception occurred
200            */
201            public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
202                    int start, int end)
203                    throws com.liferay.portal.kernel.exception.SystemException {
204                    return getService().getPermissions(start, end);
205            }
206    
207            /**
208            * Returns the number of permissions.
209            *
210            * @return the number of permissions
211            * @throws SystemException if a system exception occurred
212            */
213            public static int getPermissionsCount()
214                    throws com.liferay.portal.kernel.exception.SystemException {
215                    return getService().getPermissionsCount();
216            }
217    
218            /**
219            * Updates the permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
220            *
221            * @param permission the permission
222            * @return the permission that was updated
223            * @throws SystemException if a system exception occurred
224            */
225            public static com.liferay.portal.model.Permission updatePermission(
226                    com.liferay.portal.model.Permission permission)
227                    throws com.liferay.portal.kernel.exception.SystemException {
228                    return getService().updatePermission(permission);
229            }
230    
231            /**
232            * Updates the permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
233            *
234            * @param permission the permission
235            * @param merge whether to merge the permission with the current session. See {@link com.liferay.portal.service.persistence.BatchSession#update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean)} for an explanation.
236            * @return the permission that was updated
237            * @throws SystemException if a system exception occurred
238            */
239            public static com.liferay.portal.model.Permission updatePermission(
240                    com.liferay.portal.model.Permission permission, boolean merge)
241                    throws com.liferay.portal.kernel.exception.SystemException {
242                    return getService().updatePermission(permission, merge);
243            }
244    
245            /**
246            * Returns the Spring bean ID for this bean.
247            *
248            * @return the Spring bean ID for this bean
249            */
250            public static java.lang.String getBeanIdentifier() {
251                    return getService().getBeanIdentifier();
252            }
253    
254            /**
255            * Sets the Spring bean ID for this bean.
256            *
257            * @param beanIdentifier the Spring bean ID for this bean
258            */
259            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
260                    getService().setBeanIdentifier(beanIdentifier);
261            }
262    
263            /**
264            * Adds a permission to perform the action on the resource.
265            *
266            * <p>
267            * This method will retrieve the permission of the company, action, and
268            * resource with the primary keys. The method creates the permission if it
269            * fails to retrieve it.
270            * </p>
271            *
272            * @param companyId the primary key of the company
273            * @param actionId the action's ID
274            * @param resourceId the primary key of the resource
275            * @return the permission of the company, action, and resource with the
276            primary keys
277            * @throws SystemException if a system exception occurred
278            */
279            public static com.liferay.portal.model.Permission addPermission(
280                    long companyId, java.lang.String actionId, long resourceId)
281                    throws com.liferay.portal.kernel.exception.SystemException {
282                    return getService().addPermission(companyId, actionId, resourceId);
283            }
284    
285            /**
286            * Adds permissions to perform the actions on the resource.
287            *
288            * <p>
289            * This method will retrieve the permissions of the company, actions, and
290            * resource with the primary keys. The method creates any permissions it
291            * fails to retrieve.
292            * </p>
293            *
294            * @param companyId the primary key of the company
295            * @param actionIds the primary keys of the actions
296            * @param resourceId the primary key of the resource
297            * @return the permissions to perform the actions on the resource
298            * @throws SystemException if a system exception occurred
299            */
300            public static java.util.List<com.liferay.portal.model.Permission> addPermissions(
301                    long companyId, java.util.List<java.lang.String> actionIds,
302                    long resourceId)
303                    throws com.liferay.portal.kernel.exception.SystemException {
304                    return getService().addPermissions(companyId, actionIds, resourceId);
305            }
306    
307            /**
308            * Adds permissions to perform either the portlet resource actions or model
309            * resource actions on the resource.
310            *
311            * <p>
312            * This method will retrieve the permissions of the company, actions, and
313            * resource with the primary keys. The method creates any permissions it
314            * fails to retrieve.
315            * </p>
316            *
317            * @param companyId the primary key of the company
318            * @param name the resource name
319            * @param resourceId the primary key of the resource
320            * @param portletActions whether to retrieve the action primary keys from
321            the portlet or the model resource
322            * @return the permissions to perform the actions on the resource
323            * @throws SystemException if a system exception occurred
324            */
325            public static java.util.List<com.liferay.portal.model.Permission> addPermissions(
326                    long companyId, java.lang.String name, long resourceId,
327                    boolean portletActions)
328                    throws com.liferay.portal.kernel.exception.SystemException {
329                    return getService()
330                                       .addPermissions(companyId, name, resourceId, portletActions);
331            }
332    
333            /**
334            * Adds user permissions to perform the actions on the resource.
335            *
336            * @param userId the primary key of the user
337            * @param actionIds the primary keys of the actions
338            * @param resourceId the primary key of the resource
339            * @throws PortalException if a user with the primary key could not be
340            found
341            * @throws SystemException if a system exception occurred
342            */
343            public static void addUserPermissions(long userId,
344                    java.lang.String[] actionIds, long resourceId)
345                    throws com.liferay.portal.kernel.exception.PortalException,
346                            com.liferay.portal.kernel.exception.SystemException {
347                    getService().addUserPermissions(userId, actionIds, resourceId);
348            }
349    
350            /**
351            * Checks to see if the actions are permitted on the named resource.
352            *
353            * @param name the resource name
354            * @param actionIds the primary keys of the actions
355            * @throws PortalException if the resource company or name could not be
356            found or were invalid
357            * @throws SystemException if a system exception occurred
358            */
359            public static void checkPermissions(java.lang.String name,
360                    java.util.List<java.lang.String> actionIds)
361                    throws com.liferay.portal.kernel.exception.PortalException,
362                            com.liferay.portal.kernel.exception.SystemException {
363                    getService().checkPermissions(name, actionIds);
364            }
365    
366            /**
367            * Returns the IDs of all the actions belonging to the permissions.
368            *
369            * @param permissions the permissions
370            * @return the IDs of all the actions belonging to the permissions
371            */
372            public static java.util.List<java.lang.String> getActions(
373                    java.util.List<com.liferay.portal.model.Permission> permissions) {
374                    return getService().getActions(permissions);
375            }
376    
377            /**
378            * Returns all the group's permissions on the resource.
379            *
380            * @param groupId the primary key of the group
381            * @param resourceId the primary key of the resource
382            * @return the group's permissions on the resource
383            * @throws SystemException if a system exception occurred
384            */
385            public static java.util.List<com.liferay.portal.model.Permission> getGroupPermissions(
386                    long groupId, long resourceId)
387                    throws com.liferay.portal.kernel.exception.SystemException {
388                    return getService().getGroupPermissions(groupId, resourceId);
389            }
390    
391            /**
392            * Returns all the group's permissions on the named resource with the scope
393            * and primKey.
394            *
395            * @param groupId the primary key of the group
396            * @param companyId the primary key of the company
397            * @param name the resource name
398            * @param scope the resource scope
399            * @param primKey the resource primKey
400            * @return the group's permissions on the named resource with the scope and
401            primKey
402            * @throws SystemException if a system exception occurred
403            */
404            public static java.util.List<com.liferay.portal.model.Permission> getGroupPermissions(
405                    long groupId, long companyId, java.lang.String name, int scope,
406                    java.lang.String primKey)
407                    throws com.liferay.portal.kernel.exception.SystemException {
408                    return getService()
409                                       .getGroupPermissions(groupId, companyId, name, scope, primKey);
410            }
411    
412            /**
413            * Returns the primary key of the latest permission created.
414            *
415            * @return the primary key of the latest permission created
416            * @throws SystemException if a system exception occurred
417            */
418            public static long getLatestPermissionId()
419                    throws com.liferay.portal.kernel.exception.SystemException {
420                    return getService().getLatestPermissionId();
421            }
422    
423            /**
424            * Returns all the permissions of the organization's group with respect to
425            * the resource.
426            *
427            * @param organizationId the primary key of the organization
428            * @param groupId the primary key of the group
429            * @param resourceId the primary key of the resource
430            * @return the permissions of the organization's group with respect to the
431            resource
432            * @throws SystemException if a system exception occurred
433            */
434            public static java.util.List<com.liferay.portal.model.Permission> getOrgGroupPermissions(
435                    long organizationId, long groupId, long resourceId)
436                    throws com.liferay.portal.kernel.exception.SystemException {
437                    return getService()
438                                       .getOrgGroupPermissions(organizationId, groupId, resourceId);
439            }
440    
441            /**
442            * Returns all the permissions to perform the actions on the resource,
443            * creating new permissions for any permissions not found.
444            *
445            * @param companyId the primary key of the company
446            * @param actionIds the primary keys of the actions
447            * @param resourceId the primary key of the resource
448            * @return the permissions to perform the actions on the resource
449            * @throws SystemException if a system exception occurred
450            * @see #addPermission(long, String, long)
451            */
452            public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
453                    long companyId, java.lang.String[] actionIds, long resourceId)
454                    throws com.liferay.portal.kernel.exception.SystemException {
455                    return getService().getPermissions(companyId, actionIds, resourceId);
456            }
457    
458            /**
459            * Returns all the role's permissions.
460            *
461            * @param roleId the primary key of the role
462            * @return the role's permissions
463            * @throws SystemException if a system exception occurred
464            */
465            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
466                    long roleId) throws com.liferay.portal.kernel.exception.SystemException {
467                    return getService().getRolePermissions(roleId);
468            }
469    
470            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
471                    long roleId, int[] scopes)
472                    throws com.liferay.portal.kernel.exception.SystemException {
473                    return getService().getRolePermissions(roleId, scopes);
474            }
475    
476            /**
477            * Returns all the role's permissions on the resource.
478            *
479            * @param roleId the primary key of the role
480            * @param resourceId the primary key of the resource
481            * @return the role's permissions on the resource
482            * @throws SystemException if a system exception occurred
483            */
484            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
485                    long roleId, long resourceId)
486                    throws com.liferay.portal.kernel.exception.SystemException {
487                    return getService().getRolePermissions(roleId, resourceId);
488            }
489    
490            /**
491            * Returns all the user's permissions.
492            *
493            * @param userId the primary key of the user
494            * @return the user's permissions
495            * @throws SystemException if a system exception occurred
496            */
497            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
498                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
499                    return getService().getUserPermissions(userId);
500            }
501    
502            /**
503            * Returns all the user's permissions on the resource.
504            *
505            * @param userId the primary key of the user
506            * @param resourceId the primary key of the resource
507            * @return the user's permissions on the resource
508            * @throws SystemException if a system exception occurred
509            */
510            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
511                    long userId, long resourceId)
512                    throws com.liferay.portal.kernel.exception.SystemException {
513                    return getService().getUserPermissions(userId, resourceId);
514            }
515    
516            /**
517            * Returns all the user's permissions on the named resource with the scope
518            * and primKey.
519            *
520            * @param userId the primary key of the user
521            * @param companyId the primary key of the company
522            * @param name the resource name
523            * @param scope the resource scope
524            * @param primKey the resource primKey
525            * @return the user permissions of the resource name, scope, and primKey
526            * @throws SystemException if a system exception occurred
527            */
528            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
529                    long userId, long companyId, java.lang.String name, int scope,
530                    java.lang.String primKey)
531                    throws com.liferay.portal.kernel.exception.SystemException {
532                    return getService()
533                                       .getUserPermissions(userId, companyId, name, scope, primKey);
534            }
535    
536            /**
537            * Returns <code>true</code> if the group has permission to perform the
538            * action on the resource.
539            *
540            * @param groupId the primary key of the group
541            * @param actionId the action's ID
542            * @param resourceId the primary key of the resource
543            * @return <code>true</code> if the group has permission to perform the
544            action on the resource; <code>false</code> otherwise
545            * @throws SystemException if a system exception occurred
546            */
547            public static boolean hasGroupPermission(long groupId,
548                    java.lang.String actionId, long resourceId)
549                    throws com.liferay.portal.kernel.exception.SystemException {
550                    return getService().hasGroupPermission(groupId, actionId, resourceId);
551            }
552    
553            /**
554            * Returns <code>true</code> if the role has permission to perform the
555            * action on the named resource with the scope.
556            *
557            * @param roleId the primary key of the role
558            * @param companyId the primary key of the company
559            * @param name the resource name
560            * @param scope the resource scope
561            * @param actionId the action's ID
562            * @return <code>true</code> if the role has permission to perform the
563            action on the named resource with the scope; <code>false</code>
564            otherwise
565            * @throws SystemException if a system exception occurred
566            */
567            public static boolean hasRolePermission(long roleId, long companyId,
568                    java.lang.String name, int scope, java.lang.String actionId)
569                    throws com.liferay.portal.kernel.exception.SystemException {
570                    return getService()
571                                       .hasRolePermission(roleId, companyId, name, scope, actionId);
572            }
573    
574            /**
575            * Returns <code>true</code> if the role has permission to perform the
576            * action on the named resource with the scope and primKey.
577            *
578            * @param roleId the primary key of the role
579            * @param companyId the primary key of the company
580            * @param name the resource name
581            * @param scope the resource scope
582            * @param primKey the resource primKey
583            * @param actionId the action's ID
584            * @return <code>true</code> if the role has permission to perform the
585            action on the named resource with the scope and primKey;
586            <code>false</code> otherwise
587            * @throws SystemException if a system exception occurred
588            */
589            public static boolean hasRolePermission(long roleId, long companyId,
590                    java.lang.String name, int scope, java.lang.String primKey,
591                    java.lang.String actionId)
592                    throws com.liferay.portal.kernel.exception.SystemException {
593                    return getService()
594                                       .hasRolePermission(roleId, companyId, name, scope, primKey,
595                            actionId);
596            }
597    
598            /**
599            * Returns <code>true</code> if the user has permission to perform the
600            * action on the resource.
601            *
602            * @param userId the primary key of the user
603            * @param actionId the action's ID
604            * @param resourceId the primary key of the resource
605            * @return <code>true</code> if the user has permission to perform the
606            action on the resource; <code>false</code> otherwise
607            * @throws SystemException if a system exception occurred
608            */
609            public static boolean hasUserPermission(long userId,
610                    java.lang.String actionId, long resourceId)
611                    throws com.liferay.portal.kernel.exception.SystemException {
612                    return getService().hasUserPermission(userId, actionId, resourceId);
613            }
614    
615            /**
616            * Returns <code>true</code> if the user has permission to perform the
617            * action on the resources.
618            *
619            * <p>
620            * This method does not support resources managed by the resource block
621            * system.
622            * </p>
623            *
624            * @param userId the primary key of the user
625            * @param groupId the primary key of the group containing the resource
626            * @param resources representations of the resource at each scope level
627            returned by {@link
628            com.liferay.portal.security.permission.AdvancedPermissionChecker#getResources(
629            long, long, String, String, String)}
630            * @param actionId the action's ID
631            * @param permissionCheckerBag the permission checker bag
632            * @return <code>true</code> if the user has permission to perform the
633            action on the resources; <code>false</code> otherwise
634            * @throws PortalException if a resource action based on any one of the
635            resources and the action ID could not be found
636            * @throws SystemException if a system exception occurred
637            */
638            public static boolean hasUserPermissions(long userId, long groupId,
639                    java.util.List<com.liferay.portal.model.Resource> resources,
640                    java.lang.String actionId,
641                    com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
642                    throws com.liferay.portal.kernel.exception.PortalException,
643                            com.liferay.portal.kernel.exception.SystemException {
644                    return getService()
645                                       .hasUserPermissions(userId, groupId, resources, actionId,
646                            permissionCheckerBag);
647            }
648    
649            /**
650            * Sets the container wide permissions of either the role or the default
651            * user of each company to perform the actions on the named resource.
652            *
653            * @param name the resource name
654            * @param roleName the role name. Supported role names include {@link
655            com.liferay.portal.model.RoleConstants#ORGANIZATION_USER},
656            {@link com.liferay.portal.model.RoleConstants#OWNER}, and {@link
657            com.liferay.portal.model.RoleConstants#SITE_MEMBER}.
658            * @param actionId the action's ID
659            * @throws PortalException if a matching role could not be found or if a
660            default user for the company could not be found
661            * @throws SystemException if a system exception occurred
662            */
663            public static void setContainerResourcePermissions(java.lang.String name,
664                    java.lang.String roleName, java.lang.String actionId)
665                    throws com.liferay.portal.kernel.exception.PortalException,
666                            com.liferay.portal.kernel.exception.SystemException {
667                    getService().setContainerResourcePermissions(name, roleName, actionId);
668            }
669    
670            /**
671            * Sets the group's permissions to perform the actions on the resource,
672            * replacing the group's existing permissions on the resource.
673            *
674            * @param groupId the primary key of the group
675            * @param actionIds the primary keys of the actions
676            * @param resourceId the primary key of the resource
677            * @throws PortalException if a group with the primary key could not be
678            found
679            * @throws SystemException if a system exception occurred
680            */
681            public static void setGroupPermissions(long groupId,
682                    java.lang.String[] actionIds, long resourceId)
683                    throws com.liferay.portal.kernel.exception.PortalException,
684                            com.liferay.portal.kernel.exception.SystemException {
685                    getService().setGroupPermissions(groupId, actionIds, resourceId);
686            }
687    
688            /**
689            * Sets the entity's group permissions to perform the actions on the
690            * resource, replacing the entity's existing group permissions on the
691            * resource. Only {@link com.liferay.portal.model.Organization} and {@link
692            * com.liferay.portal.model.UserGroup} class entities are supported.
693            *
694            * @param className the class name of an organization or user group
695            * @param classPK the primary key of the class
696            * @param groupId the primary key of the group
697            * @param actionIds the primary keys of the actions
698            * @param resourceId the primary key of the resource
699            * @throws PortalException if an entity with the class name and primary key
700            could not be found or if the entity's associated group could not
701            be found
702            * @throws SystemException if a system exception occurred
703            */
704            public static void setGroupPermissions(java.lang.String className,
705                    java.lang.String classPK, long groupId, java.lang.String[] actionIds,
706                    long resourceId)
707                    throws com.liferay.portal.kernel.exception.PortalException,
708                            com.liferay.portal.kernel.exception.SystemException {
709                    getService()
710                            .setGroupPermissions(className, classPK, groupId, actionIds,
711                            resourceId);
712            }
713    
714            /**
715            * Sets the organization's group permissions to perform the actions on the
716            * resource, replacing the organization's existing group permissions on the
717            * resource.
718            *
719            * @param organizationId the primary key of the organization
720            * @param groupId the primary key of the group in which to scope the
721            permissions
722            * @param actionIds the primary keys of the actions
723            * @param resourceId the primary key of the resource
724            * @throws PortalException if an organization with the primary key could
725            not be found
726            * @throws SystemException if a system exception occurred
727            */
728            public static void setOrgGroupPermissions(long organizationId,
729                    long groupId, java.lang.String[] actionIds, long resourceId)
730                    throws com.liferay.portal.kernel.exception.PortalException,
731                            com.liferay.portal.kernel.exception.SystemException {
732                    getService()
733                            .setOrgGroupPermissions(organizationId, groupId, actionIds,
734                            resourceId);
735            }
736    
737            /**
738            * Sets the role's permissions to perform the action on the named resource,
739            * replacing the role's existing permissions on the resource.
740            *
741            * @param roleId the primary key of the role
742            * @param companyId the primary key of the company
743            * @param name the resource name
744            * @param scope the resource scope
745            * @param primKey the resource primKey
746            * @param actionId the action's ID
747            * @throws PortalException if the scope was {@link
748            com.liferay.portal.model.ResourceConstants#SCOPE_INDIVIDUAL}
749            * @throws SystemException if a system exception occurred
750            */
751            public static void setRolePermission(long roleId, long companyId,
752                    java.lang.String name, int scope, java.lang.String primKey,
753                    java.lang.String actionId)
754                    throws com.liferay.portal.kernel.exception.PortalException,
755                            com.liferay.portal.kernel.exception.SystemException {
756                    getService()
757                            .setRolePermission(roleId, companyId, name, scope, primKey, actionId);
758            }
759    
760            /**
761            * Sets the role's permissions to perform the actions on the named
762            * resource, replacing the role's existing permission for each of these
763            * actions on the resource.
764            *
765            * @param roleId the primary key of the role
766            * @param companyId the primary key of the company
767            * @param name the resource name
768            * @param scope the resource scope
769            * @param primKey the resource primKey
770            * @param actionIds the primary keys of the actions
771            * @throws PortalException if the scope was {@link
772            com.liferay.portal.model.ResourceConstants#SCOPE_INDIVIDUAL}
773            * @throws SystemException if a system exception occurred
774            */
775            public static void setRolePermissions(long roleId, long companyId,
776                    java.lang.String name, int scope, java.lang.String primKey,
777                    java.lang.String[] actionIds)
778                    throws com.liferay.portal.kernel.exception.PortalException,
779                            com.liferay.portal.kernel.exception.SystemException {
780                    getService()
781                            .setRolePermissions(roleId, companyId, name, scope, primKey,
782                            actionIds);
783            }
784    
785            /**
786            * Sets the role's permissions to perform the actions on the resource,
787            * replacing the role's existing permissions on the resource.
788            *
789            * @param roleId the primary key of the role
790            * @param actionIds the primary keys of the actions
791            * @param resourceId the primary key of the resource
792            * @throws PortalException if a role with the primary key could not be
793            found
794            * @throws SystemException if a system exception occurred
795            */
796            public static void setRolePermissions(long roleId,
797                    java.lang.String[] actionIds, long resourceId)
798                    throws com.liferay.portal.kernel.exception.PortalException,
799                            com.liferay.portal.kernel.exception.SystemException {
800                    getService().setRolePermissions(roleId, actionIds, resourceId);
801            }
802    
803            /**
804            * Sets the permissions of each role to perform respective actions on the
805            * resource, replacing the existing permissions of each role on the
806            * resource.
807            *
808            * @param companyId the primary key of the company
809            * @param roleIdsToActionIds the map of roles to their new actions on the
810            resource
811            * @param resourceId the primary key of the resource
812            * @throws SystemException if a system exception occurred
813            */
814            public static void setRolesPermissions(long companyId,
815                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds,
816                    long resourceId)
817                    throws com.liferay.portal.kernel.exception.SystemException {
818                    getService()
819                            .setRolesPermissions(companyId, roleIdsToActionIds, resourceId);
820            }
821    
822            /**
823            * Sets the permissions of each role to perform respective actions on the
824            * named resource, replacing the existing permissions of each role on the
825            * resource.
826            *
827            * @param companyId the primary key of the company
828            * @param roleIdsToActionIds the map of roles to their new actions on the
829            resource
830            * @param name the resource name
831            * @param scope the resource scope
832            * @param primKey the resource primKey
833            * @throws SystemException if a system exception occurred
834            */
835            public static void setRolesPermissions(long companyId,
836                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds,
837                    java.lang.String name, int scope, java.lang.String primKey)
838                    throws com.liferay.portal.kernel.exception.SystemException {
839                    getService()
840                            .setRolesPermissions(companyId, roleIdsToActionIds, name, scope,
841                            primKey);
842            }
843    
844            /**
845            * Sets the user's permissions to perform the actions on the resource,
846            * replacing the user's existing permissions on the resource.
847            *
848            * @param userId the primary key of the user
849            * @param actionIds the primary keys of the actions
850            * @param resourceId the primary key of the resource
851            * @throws PortalException if a user with the primary key could not be
852            found
853            * @throws SystemException if a system exception occurred
854            */
855            public static void setUserPermissions(long userId,
856                    java.lang.String[] actionIds, long resourceId)
857                    throws com.liferay.portal.kernel.exception.PortalException,
858                            com.liferay.portal.kernel.exception.SystemException {
859                    getService().setUserPermissions(userId, actionIds, resourceId);
860            }
861    
862            /**
863            * Removes the permission from the role.
864            *
865            * @param roleId the primary key of the role
866            * @param permissionId the primary key of the permission
867            * @throws SystemException if a system exception occurred
868            */
869            public static void unsetRolePermission(long roleId, long permissionId)
870                    throws com.liferay.portal.kernel.exception.SystemException {
871                    getService().unsetRolePermission(roleId, permissionId);
872            }
873    
874            /**
875            * Removes the role's permissions to perform the action on the named
876            * resource with the scope and primKey.
877            *
878            * @param roleId the primary key of the role
879            * @param companyId the primary key of the company
880            * @param name the resource name
881            * @param scope the resource scope
882            * @param primKey the resource primKey
883            * @param actionId the action's ID
884            * @throws SystemException if a system exception occurred
885            */
886            public static void unsetRolePermission(long roleId, long companyId,
887                    java.lang.String name, int scope, java.lang.String primKey,
888                    java.lang.String actionId)
889                    throws com.liferay.portal.kernel.exception.SystemException {
890                    getService()
891                            .unsetRolePermission(roleId, companyId, name, scope, primKey,
892                            actionId);
893            }
894    
895            /**
896            * Removes the role's permissions to perform the action on the named
897            * resource.
898            *
899            * @param roleId the primary key of the role
900            * @param companyId the primary key of the company
901            * @param name the resource name
902            * @param scope the resource scope
903            * @param actionId the action's ID
904            * @throws SystemException if a system exception occurred
905            */
906            public static void unsetRolePermissions(long roleId, long companyId,
907                    java.lang.String name, int scope, java.lang.String actionId)
908                    throws com.liferay.portal.kernel.exception.SystemException {
909                    getService()
910                            .unsetRolePermissions(roleId, companyId, name, scope, actionId);
911            }
912    
913            /**
914            * Removes the user's permissions to perform the actions on the resource.
915            *
916            * @param userId the primary key of the user
917            * @param actionIds the primary keys of the actions
918            * @param resourceId the primary key of the resource
919            * @throws SystemException if a system exception occurred
920            */
921            public static void unsetUserPermissions(long userId,
922                    java.lang.String[] actionIds, long resourceId)
923                    throws com.liferay.portal.kernel.exception.SystemException {
924                    getService().unsetUserPermissions(userId, actionIds, resourceId);
925            }
926    
927            public static PermissionLocalService getService() {
928                    if (_service == null) {
929                            _service = (PermissionLocalService)PortalBeanLocatorUtil.locate(PermissionLocalService.class.getName());
930    
931                            ReferenceRegistry.registerReference(PermissionLocalServiceUtil.class,
932                                    "_service");
933                            MethodCache.remove(PermissionLocalService.class);
934                    }
935    
936                    return _service;
937            }
938    
939            public void setService(PermissionLocalService service) {
940                    MethodCache.remove(PermissionLocalService.class);
941    
942                    _service = service;
943    
944                    ReferenceRegistry.registerReference(PermissionLocalServiceUtil.class,
945                            "_service");
946                    MethodCache.remove(PermissionLocalService.class);
947            }
948    
949            private static PermissionLocalService _service;
950    }