001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
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 found
340            * @throws SystemException if a system exception occurred
341            */
342            public static void addUserPermissions(long userId,
343                    java.lang.String[] actionIds, long resourceId)
344                    throws com.liferay.portal.kernel.exception.PortalException,
345                            com.liferay.portal.kernel.exception.SystemException {
346                    getService().addUserPermissions(userId, actionIds, resourceId);
347            }
348    
349            /**
350            * Checks to see if the actions are permitted on the named resource.
351            *
352            * @param name the resource name
353            * @param actionIds the primary keys of the actions
354            * @throws PortalException if the resource company or name could not be
355            found or were invalid
356            * @throws SystemException if a system exception occurred
357            */
358            public static void checkPermissions(java.lang.String name,
359                    java.util.List<java.lang.String> actionIds)
360                    throws com.liferay.portal.kernel.exception.PortalException,
361                            com.liferay.portal.kernel.exception.SystemException {
362                    getService().checkPermissions(name, actionIds);
363            }
364    
365            /**
366            * Returns the IDs of all the actions belonging to the permissions.
367            *
368            * @param permissions the permissions
369            * @return the IDs of all the actions belonging to the permissions
370            */
371            public static java.util.List<java.lang.String> getActions(
372                    java.util.List<com.liferay.portal.model.Permission> permissions) {
373                    return getService().getActions(permissions);
374            }
375    
376            /**
377            * Returns all the group's permissions on the resource.
378            *
379            * @param groupId the primary key of the group
380            * @param resourceId the primary key of the resource
381            * @return the group's permissions on the resource
382            * @throws SystemException if a system exception occurred
383            */
384            public static java.util.List<com.liferay.portal.model.Permission> getGroupPermissions(
385                    long groupId, long resourceId)
386                    throws com.liferay.portal.kernel.exception.SystemException {
387                    return getService().getGroupPermissions(groupId, resourceId);
388            }
389    
390            /**
391            * Returns all the group's permissions on the named resource with the scope
392            * and primKey.
393            *
394            * @param groupId the primary key of the group
395            * @param companyId the primary key of the company
396            * @param name the resource name
397            * @param scope the resource scope
398            * @param primKey the resource primKey
399            * @return the group's permissions on the named resource with the scope and
400            primKey
401            * @throws SystemException if a system exception occurred
402            */
403            public static java.util.List<com.liferay.portal.model.Permission> getGroupPermissions(
404                    long groupId, long companyId, java.lang.String name, int scope,
405                    java.lang.String primKey)
406                    throws com.liferay.portal.kernel.exception.SystemException {
407                    return getService()
408                                       .getGroupPermissions(groupId, companyId, name, scope, primKey);
409            }
410    
411            /**
412            * Returns the primary key of the latest permission created.
413            *
414            * @return the primary key of the latest permission created
415            * @throws SystemException if a system exception occurred
416            */
417            public static long getLatestPermissionId()
418                    throws com.liferay.portal.kernel.exception.SystemException {
419                    return getService().getLatestPermissionId();
420            }
421    
422            /**
423            * Returns all the permissions of the organization's group with respect to
424            * the resource.
425            *
426            * @param organizationId the primary key of the organization
427            * @param groupId the primary key of the group
428            * @param resourceId the primary key of the resource
429            * @return the permissions of the organization's group with respect to the
430            resource
431            * @throws SystemException if a system exception occurred
432            */
433            public static java.util.List<com.liferay.portal.model.Permission> getOrgGroupPermissions(
434                    long organizationId, long groupId, long resourceId)
435                    throws com.liferay.portal.kernel.exception.SystemException {
436                    return getService()
437                                       .getOrgGroupPermissions(organizationId, groupId, resourceId);
438            }
439    
440            /**
441            * Returns all the permissions to perform the actions on the resource,
442            * creating new permissions for any permissions not found.
443            *
444            * @param companyId the primary key of the company
445            * @param actionIds the primary keys of the actions
446            * @param resourceId the primary key of the resource
447            * @return the permissions to perform the actions on the resource
448            * @throws SystemException if a system exception occurred
449            * @see #addPermission(long, String, long)
450            */
451            public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
452                    long companyId, java.lang.String[] actionIds, long resourceId)
453                    throws com.liferay.portal.kernel.exception.SystemException {
454                    return getService().getPermissions(companyId, actionIds, resourceId);
455            }
456    
457            /**
458            * Returns all the role's permissions.
459            *
460            * @param roleId the primary key of the role
461            * @return the role's permissions
462            * @throws SystemException if a system exception occurred
463            */
464            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
465                    long roleId) throws com.liferay.portal.kernel.exception.SystemException {
466                    return getService().getRolePermissions(roleId);
467            }
468    
469            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
470                    long roleId, int[] scopes)
471                    throws com.liferay.portal.kernel.exception.SystemException {
472                    return getService().getRolePermissions(roleId, scopes);
473            }
474    
475            /**
476            * Returns all the role's permissions on the resource.
477            *
478            * @param roleId the primary key of the role
479            * @param resourceId the primary key of the resource
480            * @return the role's permissions on the resource
481            * @throws SystemException if a system exception occurred
482            */
483            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
484                    long roleId, long resourceId)
485                    throws com.liferay.portal.kernel.exception.SystemException {
486                    return getService().getRolePermissions(roleId, resourceId);
487            }
488    
489            /**
490            * Returns all the user's permissions.
491            *
492            * @param userId the primary key of the user
493            * @return the user's permissions
494            * @throws SystemException if a system exception occurred
495            */
496            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
497                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
498                    return getService().getUserPermissions(userId);
499            }
500    
501            /**
502            * Returns all the user's permissions on the resource.
503            *
504            * @param userId the primary key of the user
505            * @param resourceId the primary key of the resource
506            * @return the user's permissions on the resource
507            * @throws SystemException if a system exception occurred
508            */
509            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
510                    long userId, long resourceId)
511                    throws com.liferay.portal.kernel.exception.SystemException {
512                    return getService().getUserPermissions(userId, resourceId);
513            }
514    
515            /**
516            * Returns all the user's permissions on the named resource with the scope
517            * and primKey.
518            *
519            * @param userId the primary key of the user
520            * @param companyId the primary key of the company
521            * @param name the resource name
522            * @param scope the resource scope
523            * @param primKey the resource primKey
524            * @return the user permissions of the resource name, scope, and primKey
525            * @throws SystemException if a system exception occurred
526            */
527            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
528                    long userId, long companyId, java.lang.String name, int scope,
529                    java.lang.String primKey)
530                    throws com.liferay.portal.kernel.exception.SystemException {
531                    return getService()
532                                       .getUserPermissions(userId, companyId, name, scope, primKey);
533            }
534    
535            /**
536            * Returns <code>true</code> if the group has permission to perform the
537            * action on the resource.
538            *
539            * @param groupId the primary key of the group
540            * @param actionId the action's ID
541            * @param resourceId the primary key of the resource
542            * @return <code>true</code> if the group has permission to perform the
543            action on the resource; <code>false</code> otherwise
544            * @throws SystemException if a system exception occurred
545            */
546            public static boolean hasGroupPermission(long groupId,
547                    java.lang.String actionId, long resourceId)
548                    throws com.liferay.portal.kernel.exception.SystemException {
549                    return getService().hasGroupPermission(groupId, actionId, resourceId);
550            }
551    
552            /**
553            * Returns <code>true</code> if the role has permission to perform the
554            * action on the named resource with the scope.
555            *
556            * @param roleId the primary key of the role
557            * @param companyId the primary key of the company
558            * @param name the resource name
559            * @param scope the resource scope
560            * @param actionId the action's ID
561            * @return <code>true</code> if the role has permission to perform the
562            action on the named resource with the scope; <code>false</code>
563            otherwise
564            * @throws SystemException if a system exception occurred
565            */
566            public static boolean hasRolePermission(long roleId, long companyId,
567                    java.lang.String name, int scope, java.lang.String actionId)
568                    throws com.liferay.portal.kernel.exception.SystemException {
569                    return getService()
570                                       .hasRolePermission(roleId, companyId, name, scope, actionId);
571            }
572    
573            /**
574            * Returns <code>true</code> if the role has permission to perform the
575            * action on the named resource with the scope and primKey.
576            *
577            * @param roleId the primary key of the role
578            * @param companyId the primary key of the company
579            * @param name the resource name
580            * @param scope the resource scope
581            * @param primKey the resource primKey
582            * @param actionId the action's ID
583            * @return <code>true</code> if the role has permission to perform the
584            action on the named resource with the scope and primKey;
585            <code>false</code> otherwise
586            * @throws SystemException if a system exception occurred
587            */
588            public static boolean hasRolePermission(long roleId, long companyId,
589                    java.lang.String name, int scope, java.lang.String primKey,
590                    java.lang.String actionId)
591                    throws com.liferay.portal.kernel.exception.SystemException {
592                    return getService()
593                                       .hasRolePermission(roleId, companyId, name, scope, primKey,
594                            actionId);
595            }
596    
597            /**
598            * Returns <code>true</code> if the user has permission to perform the
599            * action on the resource.
600            *
601            * @param userId the primary key of the user
602            * @param actionId the action's ID
603            * @param resourceId the primary key of the resource
604            * @return <code>true</code> if the user has permission to perform the
605            action on the resource; <code>false</code> otherwise
606            * @throws SystemException if a system exception occurred
607            */
608            public static boolean hasUserPermission(long userId,
609                    java.lang.String actionId, long resourceId)
610                    throws com.liferay.portal.kernel.exception.SystemException {
611                    return getService().hasUserPermission(userId, actionId, resourceId);
612            }
613    
614            /**
615            * Returns <code>true</code> if the user has permission to perform the
616            * action on the resources.
617            *
618            * <p>
619            * This method does not support resources managed by the resource block
620            * system.
621            * </p>
622            *
623            * @param userId the primary key of the user
624            * @param groupId the primary key of the group containing the resource
625            * @param resources representations of the resource at each scope level
626            returned by {@link
627            com.liferay.portal.security.permission.AdvancedPermissionChecker#getResources(
628            long, long, String, String, String)}
629            * @param actionId the action's ID
630            * @param permissionCheckerBag the permission checker bag
631            * @return <code>true</code> if the user has permission to perform the
632            action on the resources; <code>false</code> otherwise
633            * @throws PortalException if a resource action based on any one of the
634            resources and the action ID could not be found
635            * @throws SystemException if a system exception occurred
636            */
637            public static boolean hasUserPermissions(long userId, long groupId,
638                    java.util.List<com.liferay.portal.model.Resource> resources,
639                    java.lang.String actionId,
640                    com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
641                    throws com.liferay.portal.kernel.exception.PortalException,
642                            com.liferay.portal.kernel.exception.SystemException {
643                    return getService()
644                                       .hasUserPermissions(userId, groupId, resources, actionId,
645                            permissionCheckerBag);
646            }
647    
648            /**
649            * Sets the container wide permissions of either the role or the default
650            * user of each company to perform the actions on the named resource.
651            *
652            * @param name the resource name
653            * @param roleName the role name. Supported role names include {@link
654            com.liferay.portal.model.RoleConstants#ORGANIZATION_USER}, {@link
655            com.liferay.portal.model.RoleConstants#OWNER}, and {@link
656            com.liferay.portal.model.RoleConstants#SITE_MEMBER}.
657            * @param actionId the action's ID
658            * @throws PortalException if a matching role could not be found or if a
659            default user for the company could not be found
660            * @throws SystemException if a system exception occurred
661            */
662            public static void setContainerResourcePermissions(java.lang.String name,
663                    java.lang.String roleName, java.lang.String actionId)
664                    throws com.liferay.portal.kernel.exception.PortalException,
665                            com.liferay.portal.kernel.exception.SystemException {
666                    getService().setContainerResourcePermissions(name, roleName, actionId);
667            }
668    
669            /**
670            * Sets the group's permissions to perform the actions on the resource,
671            * replacing the group's existing permissions on the resource.
672            *
673            * @param groupId the primary key of the group
674            * @param actionIds the primary keys of the actions
675            * @param resourceId the primary key of the resource
676            * @throws PortalException if a group with the primary key could not be
677            found
678            * @throws SystemException if a system exception occurred
679            */
680            public static void setGroupPermissions(long groupId,
681                    java.lang.String[] actionIds, long resourceId)
682                    throws com.liferay.portal.kernel.exception.PortalException,
683                            com.liferay.portal.kernel.exception.SystemException {
684                    getService().setGroupPermissions(groupId, actionIds, resourceId);
685            }
686    
687            /**
688            * Sets the entity's group permissions to perform the actions on the
689            * resource, replacing the entity's existing group permissions on the
690            * resource. Only {@link com.liferay.portal.model.Organization} and {@link
691            * com.liferay.portal.model.UserGroup} class entities are supported.
692            *
693            * @param className the class name of an organization or user group
694            * @param classPK the primary key of the class
695            * @param groupId the primary key of the group
696            * @param actionIds the primary keys of the actions
697            * @param resourceId the primary key of the resource
698            * @throws PortalException if an entity with the class name and primary key
699            could not be found or if the entity's associated group could not
700            be found
701            * @throws SystemException if a system exception occurred
702            */
703            public static void setGroupPermissions(java.lang.String className,
704                    java.lang.String classPK, long groupId, java.lang.String[] actionIds,
705                    long resourceId)
706                    throws com.liferay.portal.kernel.exception.PortalException,
707                            com.liferay.portal.kernel.exception.SystemException {
708                    getService()
709                            .setGroupPermissions(className, classPK, groupId, actionIds,
710                            resourceId);
711            }
712    
713            /**
714            * Sets the organization's group permissions to perform the actions on the
715            * resource, replacing the organization's existing group permissions on the
716            * resource.
717            *
718            * @param organizationId the primary key of the organization
719            * @param groupId the primary key of the group in which to scope the
720            permissions
721            * @param actionIds the primary keys of the actions
722            * @param resourceId the primary key of the resource
723            * @throws PortalException if an organization with the primary key could not
724            be found
725            * @throws SystemException if a system exception occurred
726            */
727            public static void setOrgGroupPermissions(long organizationId,
728                    long groupId, java.lang.String[] actionIds, long resourceId)
729                    throws com.liferay.portal.kernel.exception.PortalException,
730                            com.liferay.portal.kernel.exception.SystemException {
731                    getService()
732                            .setOrgGroupPermissions(organizationId, groupId, actionIds,
733                            resourceId);
734            }
735    
736            /**
737            * Sets the role's permissions to perform the action on the named resource,
738            * replacing the role's existing permissions on the resource.
739            *
740            * @param roleId the primary key of the role
741            * @param companyId the primary key of the company
742            * @param name the resource name
743            * @param scope the resource scope
744            * @param primKey the resource primKey
745            * @param actionId the action's ID
746            * @throws PortalException if the scope was {@link
747            com.liferay.portal.model.ResourceConstants#SCOPE_INDIVIDUAL}
748            * @throws SystemException if a system exception occurred
749            */
750            public static void setRolePermission(long roleId, long companyId,
751                    java.lang.String name, int scope, java.lang.String primKey,
752                    java.lang.String actionId)
753                    throws com.liferay.portal.kernel.exception.PortalException,
754                            com.liferay.portal.kernel.exception.SystemException {
755                    getService()
756                            .setRolePermission(roleId, companyId, name, scope, primKey, actionId);
757            }
758    
759            /**
760            * Sets the role's permissions to perform the actions on the named resource,
761            * replacing the role's existing permission for each of these actions on the
762            * resource.
763            *
764            * @param roleId the primary key of the role
765            * @param companyId the primary key of the company
766            * @param name the resource name
767            * @param scope the resource scope
768            * @param primKey the resource primKey
769            * @param actionIds the primary keys of the actions
770            * @throws PortalException if the scope was {@link
771            com.liferay.portal.model.ResourceConstants#SCOPE_INDIVIDUAL}
772            * @throws SystemException if a system exception occurred
773            */
774            public static void setRolePermissions(long roleId, long companyId,
775                    java.lang.String name, int scope, java.lang.String primKey,
776                    java.lang.String[] actionIds)
777                    throws com.liferay.portal.kernel.exception.PortalException,
778                            com.liferay.portal.kernel.exception.SystemException {
779                    getService()
780                            .setRolePermissions(roleId, companyId, name, scope, primKey,
781                            actionIds);
782            }
783    
784            /**
785            * Sets the role's permissions to perform the actions on the resource,
786            * replacing the role's existing permissions on the resource.
787            *
788            * @param roleId the primary key of the role
789            * @param actionIds the primary keys of the actions
790            * @param resourceId the primary key of the resource
791            * @throws PortalException if a role with the primary key could not be found
792            * @throws SystemException if a system exception occurred
793            */
794            public static void setRolePermissions(long roleId,
795                    java.lang.String[] actionIds, long resourceId)
796                    throws com.liferay.portal.kernel.exception.PortalException,
797                            com.liferay.portal.kernel.exception.SystemException {
798                    getService().setRolePermissions(roleId, actionIds, resourceId);
799            }
800    
801            /**
802            * Sets the permissions of each role to perform respective actions on the
803            * resource, replacing the existing permissions of each role on the
804            * resource.
805            *
806            * @param companyId the primary key of the company
807            * @param roleIdsToActionIds the map of roles to their new actions on the
808            resource
809            * @param resourceId the primary key of the resource
810            * @throws SystemException if a system exception occurred
811            */
812            public static void setRolesPermissions(long companyId,
813                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds,
814                    long resourceId)
815                    throws com.liferay.portal.kernel.exception.SystemException {
816                    getService()
817                            .setRolesPermissions(companyId, roleIdsToActionIds, resourceId);
818            }
819    
820            /**
821            * Sets the permissions of each role to perform respective actions on the
822            * named resource, replacing the existing permissions of each role on the
823            * resource.
824            *
825            * @param companyId the primary key of the company
826            * @param roleIdsToActionIds the map of roles to their new actions on the
827            resource
828            * @param name the resource name
829            * @param scope the resource scope
830            * @param primKey the resource primKey
831            * @throws SystemException if a system exception occurred
832            */
833            public static void setRolesPermissions(long companyId,
834                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds,
835                    java.lang.String name, int scope, java.lang.String primKey)
836                    throws com.liferay.portal.kernel.exception.SystemException {
837                    getService()
838                            .setRolesPermissions(companyId, roleIdsToActionIds, name, scope,
839                            primKey);
840            }
841    
842            /**
843            * Sets the user's permissions to perform the actions on the resource,
844            * replacing the user's existing permissions on the resource.
845            *
846            * @param userId the primary key of the user
847            * @param actionIds the primary keys of the actions
848            * @param resourceId the primary key of the resource
849            * @throws PortalException if a user with the primary key could not be found
850            * @throws SystemException if a system exception occurred
851            */
852            public static void setUserPermissions(long userId,
853                    java.lang.String[] actionIds, long resourceId)
854                    throws com.liferay.portal.kernel.exception.PortalException,
855                            com.liferay.portal.kernel.exception.SystemException {
856                    getService().setUserPermissions(userId, actionIds, resourceId);
857            }
858    
859            /**
860            * Removes the permission from the role.
861            *
862            * @param roleId the primary key of the role
863            * @param permissionId the primary key of the permission
864            * @throws SystemException if a system exception occurred
865            */
866            public static void unsetRolePermission(long roleId, long permissionId)
867                    throws com.liferay.portal.kernel.exception.SystemException {
868                    getService().unsetRolePermission(roleId, permissionId);
869            }
870    
871            /**
872            * Removes the role's permissions to perform the action on the named
873            * resource with the scope and primKey.
874            *
875            * @param roleId the primary key of the role
876            * @param companyId the primary key of the company
877            * @param name the resource name
878            * @param scope the resource scope
879            * @param primKey the resource primKey
880            * @param actionId the action's ID
881            * @throws SystemException if a system exception occurred
882            */
883            public static void unsetRolePermission(long roleId, long companyId,
884                    java.lang.String name, int scope, java.lang.String primKey,
885                    java.lang.String actionId)
886                    throws com.liferay.portal.kernel.exception.SystemException {
887                    getService()
888                            .unsetRolePermission(roleId, companyId, name, scope, primKey,
889                            actionId);
890            }
891    
892            /**
893            * Removes the role's permissions to perform the action on the named
894            * resource.
895            *
896            * @param roleId the primary key of the role
897            * @param companyId the primary key of the company
898            * @param name the resource name
899            * @param scope the resource scope
900            * @param actionId the action's ID
901            * @throws SystemException if a system exception occurred
902            */
903            public static void unsetRolePermissions(long roleId, long companyId,
904                    java.lang.String name, int scope, java.lang.String actionId)
905                    throws com.liferay.portal.kernel.exception.SystemException {
906                    getService()
907                            .unsetRolePermissions(roleId, companyId, name, scope, actionId);
908            }
909    
910            /**
911            * Removes the user's permissions to perform the actions on the resource.
912            *
913            * @param userId the primary key of the user
914            * @param actionIds the primary keys of the actions
915            * @param resourceId the primary key of the resource
916            * @throws SystemException if a system exception occurred
917            */
918            public static void unsetUserPermissions(long userId,
919                    java.lang.String[] actionIds, long resourceId)
920                    throws com.liferay.portal.kernel.exception.SystemException {
921                    getService().unsetUserPermissions(userId, actionIds, resourceId);
922            }
923    
924            public static PermissionLocalService getService() {
925                    if (_service == null) {
926                            _service = (PermissionLocalService)PortalBeanLocatorUtil.locate(PermissionLocalService.class.getName());
927    
928                            ReferenceRegistry.registerReference(PermissionLocalServiceUtil.class,
929                                    "_service");
930                            MethodCache.remove(PermissionLocalService.class);
931                    }
932    
933                    return _service;
934            }
935    
936            public void setService(PermissionLocalService service) {
937                    MethodCache.remove(PermissionLocalService.class);
938    
939                    _service = service;
940    
941                    ReferenceRegistry.registerReference(PermissionLocalServiceUtil.class,
942                            "_service");
943                    MethodCache.remove(PermissionLocalService.class);
944            }
945    
946            private static PermissionLocalService _service;
947    }