001    /**
002     * Copyright (c) 2000-2011 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            /**
162            * Returns the permission with the primary key.
163            *
164            * @param permissionId the primary key of the permission
165            * @return the permission
166            * @throws PortalException if a permission with the primary key could not be found
167            * @throws SystemException if a system exception occurred
168            */
169            public static com.liferay.portal.model.Permission getPermission(
170                    long permissionId)
171                    throws com.liferay.portal.kernel.exception.PortalException,
172                            com.liferay.portal.kernel.exception.SystemException {
173                    return getService().getPermission(permissionId);
174            }
175    
176            public static com.liferay.portal.model.PersistedModel getPersistedModel(
177                    java.io.Serializable primaryKeyObj)
178                    throws com.liferay.portal.kernel.exception.PortalException,
179                            com.liferay.portal.kernel.exception.SystemException {
180                    return getService().getPersistedModel(primaryKeyObj);
181            }
182    
183            /**
184            * Returns a range of all the permissions.
185            *
186            * <p>
187            * 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.
188            * </p>
189            *
190            * @param start the lower bound of the range of permissions
191            * @param end the upper bound of the range of permissions (not inclusive)
192            * @return the range of permissions
193            * @throws SystemException if a system exception occurred
194            */
195            public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
196                    int start, int end)
197                    throws com.liferay.portal.kernel.exception.SystemException {
198                    return getService().getPermissions(start, end);
199            }
200    
201            /**
202            * Returns the number of permissions.
203            *
204            * @return the number of permissions
205            * @throws SystemException if a system exception occurred
206            */
207            public static int getPermissionsCount()
208                    throws com.liferay.portal.kernel.exception.SystemException {
209                    return getService().getPermissionsCount();
210            }
211    
212            /**
213            * Updates the permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
214            *
215            * @param permission the permission
216            * @return the permission that was updated
217            * @throws SystemException if a system exception occurred
218            */
219            public static com.liferay.portal.model.Permission updatePermission(
220                    com.liferay.portal.model.Permission permission)
221                    throws com.liferay.portal.kernel.exception.SystemException {
222                    return getService().updatePermission(permission);
223            }
224    
225            /**
226            * Updates the permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
227            *
228            * @param permission the permission
229            * @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.
230            * @return the permission that was updated
231            * @throws SystemException if a system exception occurred
232            */
233            public static com.liferay.portal.model.Permission updatePermission(
234                    com.liferay.portal.model.Permission permission, boolean merge)
235                    throws com.liferay.portal.kernel.exception.SystemException {
236                    return getService().updatePermission(permission, merge);
237            }
238    
239            /**
240            * Returns the Spring bean ID for this bean.
241            *
242            * @return the Spring bean ID for this bean
243            */
244            public static java.lang.String getBeanIdentifier() {
245                    return getService().getBeanIdentifier();
246            }
247    
248            /**
249            * Sets the Spring bean ID for this bean.
250            *
251            * @param beanIdentifier the Spring bean ID for this bean
252            */
253            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
254                    getService().setBeanIdentifier(beanIdentifier);
255            }
256    
257            /**
258            * Adds a permission to perform the action on the resource.
259            *
260            * <p>
261            * This method will retrieve the permission of the company, action, and
262            * resource with the primary keys. The method creates the permission if it
263            * fails to retrieve it.
264            * </p>
265            *
266            * @param companyId the primary key of the company
267            * @param actionId the action's ID
268            * @param resourceId the primary key of the resource
269            * @return the permission of the company, action, and resource with the
270            primary keys
271            * @throws SystemException if a system exception occurred
272            */
273            public static com.liferay.portal.model.Permission addPermission(
274                    long companyId, java.lang.String actionId, long resourceId)
275                    throws com.liferay.portal.kernel.exception.SystemException {
276                    return getService().addPermission(companyId, actionId, resourceId);
277            }
278    
279            /**
280            * Adds permissions to perform the actions on the resource.
281            *
282            * <p>
283            * This method will retrieve the permissions of the company, actions, and
284            * resource with the primary keys. The method creates any permissions it
285            * fails to retrieve.
286            * </p>
287            *
288            * @param companyId the primary key of the company
289            * @param actionIds the primary keys of the actions
290            * @param resourceId the primary key of the resource
291            * @return the permissions to perform the actions on the resource
292            * @throws SystemException if a system exception occurred
293            */
294            public static java.util.List<com.liferay.portal.model.Permission> addPermissions(
295                    long companyId, java.util.List<java.lang.String> actionIds,
296                    long resourceId)
297                    throws com.liferay.portal.kernel.exception.SystemException {
298                    return getService().addPermissions(companyId, actionIds, resourceId);
299            }
300    
301            /**
302            * Adds permissions to perform either the portlet resource actions or model
303            * resource actions on the resource.
304            *
305            * <p>
306            * This method will retrieve the permissions of the company, actions, and
307            * resource with the primary keys. The method creates any permissions it
308            * fails to retrieve.
309            * </p>
310            *
311            * @param companyId the primary key of the company
312            * @param name the resource name
313            * @param resourceId the primary key of the resource
314            * @param portletActions whether to retrieve the action primary keys from
315            the portlet or the model resource
316            * @return the permissions to perform the actions on the resource
317            * @throws SystemException if a system exception occurred
318            */
319            public static java.util.List<com.liferay.portal.model.Permission> addPermissions(
320                    long companyId, java.lang.String name, long resourceId,
321                    boolean portletActions)
322                    throws com.liferay.portal.kernel.exception.SystemException {
323                    return getService()
324                                       .addPermissions(companyId, name, resourceId, portletActions);
325            }
326    
327            /**
328            * Adds user permissions to perform the actions on the resource.
329            *
330            * @param userId the primary key of the user
331            * @param actionIds the primary keys of the actions
332            * @param resourceId the primary key of the resource
333            * @throws PortalException if a user with the primary key could not be
334            found
335            * @throws SystemException if a system exception occurred
336            */
337            public static void addUserPermissions(long userId,
338                    java.lang.String[] actionIds, long resourceId)
339                    throws com.liferay.portal.kernel.exception.PortalException,
340                            com.liferay.portal.kernel.exception.SystemException {
341                    getService().addUserPermissions(userId, actionIds, resourceId);
342            }
343    
344            /**
345            * Checks to see if the actions are permitted on the named resource.
346            *
347            * @param name the resource name
348            * @param actionIds the primary keys of the actions
349            * @throws PortalException if the resource company or name could not be
350            found or were invalid
351            * @throws SystemException if a system exception occurred
352            */
353            public static void checkPermissions(java.lang.String name,
354                    java.util.List<java.lang.String> actionIds)
355                    throws com.liferay.portal.kernel.exception.PortalException,
356                            com.liferay.portal.kernel.exception.SystemException {
357                    getService().checkPermissions(name, actionIds);
358            }
359    
360            /**
361            * Returns the IDs of all the actions belonging to the permissions.
362            *
363            * @param permissions the permissions
364            * @return the IDs of all the actions belonging to the permissions
365            */
366            public static java.util.List<java.lang.String> getActions(
367                    java.util.List<com.liferay.portal.model.Permission> permissions) {
368                    return getService().getActions(permissions);
369            }
370    
371            /**
372            * Returns all the group's permissions on the resource.
373            *
374            * @param groupId the primary key of the group
375            * @param resourceId the primary key of the resource
376            * @return the group's permissions on the resource
377            * @throws SystemException if a system exception occurred
378            */
379            public static java.util.List<com.liferay.portal.model.Permission> getGroupPermissions(
380                    long groupId, long resourceId)
381                    throws com.liferay.portal.kernel.exception.SystemException {
382                    return getService().getGroupPermissions(groupId, resourceId);
383            }
384    
385            /**
386            * Returns all the group's permissions on the named resource with the scope
387            * and primKey.
388            *
389            * @param groupId the primary key of the group
390            * @param companyId the primary key of the company
391            * @param name the resource name
392            * @param scope the resource scope
393            * @param primKey the resource primKey
394            * @return the group's permissions on the named resource with the scope and
395            primKey
396            * @throws SystemException if a system exception occurred
397            */
398            public static java.util.List<com.liferay.portal.model.Permission> getGroupPermissions(
399                    long groupId, long companyId, java.lang.String name, int scope,
400                    java.lang.String primKey)
401                    throws com.liferay.portal.kernel.exception.SystemException {
402                    return getService()
403                                       .getGroupPermissions(groupId, companyId, name, scope, primKey);
404            }
405    
406            /**
407            * Returns the primary key of the latest permission created.
408            *
409            * @return the primary key of the latest permission created
410            * @throws SystemException if a system exception occurred
411            */
412            public static long getLatestPermissionId()
413                    throws com.liferay.portal.kernel.exception.SystemException {
414                    return getService().getLatestPermissionId();
415            }
416    
417            /**
418            * Returns all the permissions of the organization's group with respect to
419            * the resource.
420            *
421            * @param organizationId the primary key of the organization
422            * @param groupId the primary key of the group
423            * @param resourceId the primary key of the resource
424            * @return the permissions of the organization's group with respect to the
425            resource
426            * @throws SystemException if a system exception occurred
427            */
428            public static java.util.List<com.liferay.portal.model.Permission> getOrgGroupPermissions(
429                    long organizationId, long groupId, long resourceId)
430                    throws com.liferay.portal.kernel.exception.SystemException {
431                    return getService()
432                                       .getOrgGroupPermissions(organizationId, groupId, resourceId);
433            }
434    
435            /**
436            * Returns all the permissions to perform the actions on the resource,
437            * creating new permissions for any permissions not found.
438            *
439            * @param companyId the primary key of the company
440            * @param actionIds the primary keys of the actions
441            * @param resourceId the primary key of the resource
442            * @return the permissions to perform the actions on the resource
443            * @throws SystemException if a system exception occurred
444            * @see #addPermission(long, String, long)
445            */
446            public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
447                    long companyId, java.lang.String[] actionIds, long resourceId)
448                    throws com.liferay.portal.kernel.exception.SystemException {
449                    return getService().getPermissions(companyId, actionIds, resourceId);
450            }
451    
452            /**
453            * Returns all the role's permissions.
454            *
455            * @param roleId the primary key of the role
456            * @return the role's permissions
457            * @throws SystemException if a system exception occurred
458            */
459            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
460                    long roleId) throws com.liferay.portal.kernel.exception.SystemException {
461                    return getService().getRolePermissions(roleId);
462            }
463    
464            /**
465            * Returns all the role's permissions on the resource.
466            *
467            * @param roleId the primary key of the role
468            * @param resourceId the primary key of the resource
469            * @return the role's permissions on the resource
470            * @throws SystemException if a system exception occurred
471            */
472            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
473                    long roleId, long resourceId)
474                    throws com.liferay.portal.kernel.exception.SystemException {
475                    return getService().getRolePermissions(roleId, resourceId);
476            }
477    
478            /**
479            * Returns all the user's permissions.
480            *
481            * @param userId the primary key of the user
482            * @return the user's permissions
483            * @throws SystemException if a system exception occurred
484            */
485            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
486                    long userId) throws com.liferay.portal.kernel.exception.SystemException {
487                    return getService().getUserPermissions(userId);
488            }
489    
490            /**
491            * Returns all the user's permissions on the resource.
492            *
493            * @param userId the primary key of the user
494            * @param resourceId the primary key of the resource
495            * @return the user's permissions on the resource
496            * @throws SystemException if a system exception occurred
497            */
498            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
499                    long userId, long resourceId)
500                    throws com.liferay.portal.kernel.exception.SystemException {
501                    return getService().getUserPermissions(userId, resourceId);
502            }
503    
504            /**
505            * Returns all the user's permissions on the named resource with the scope
506            * and primKey.
507            *
508            * @param userId the primary key of the user
509            * @param companyId the primary key of the company
510            * @param name the resource name
511            * @param scope the resource scope
512            * @param primKey the resource primKey
513            * @return the user permissions of the resource name, scope, and primKey
514            * @throws SystemException if a system exception occurred
515            */
516            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
517                    long userId, long companyId, java.lang.String name, int scope,
518                    java.lang.String primKey)
519                    throws com.liferay.portal.kernel.exception.SystemException {
520                    return getService()
521                                       .getUserPermissions(userId, companyId, name, scope, primKey);
522            }
523    
524            /**
525            * Returns <code>true</code> if the group has permission to perform the
526            * action on the resource.
527            *
528            * @param groupId the primary key of the group
529            * @param actionId the action's ID
530            * @param resourceId the primary key of the resource
531            * @return <code>true</code> if the group has permission to perform the
532            action on the resource; <code>false</code> otherwise
533            * @throws SystemException if a system exception occurred
534            */
535            public static boolean hasGroupPermission(long groupId,
536                    java.lang.String actionId, long resourceId)
537                    throws com.liferay.portal.kernel.exception.SystemException {
538                    return getService().hasGroupPermission(groupId, actionId, resourceId);
539            }
540    
541            /**
542            * Returns <code>true</code> if the role has permission to perform the
543            * action on the named resource with the scope.
544            *
545            * @param roleId the primary key of the role
546            * @param companyId the primary key of the company
547            * @param name the resource name
548            * @param scope the resource scope
549            * @param actionId the action's ID
550            * @return <code>true</code> if the role has permission to perform the
551            action on the named resource with the scope; <code>false</code>
552            otherwise
553            * @throws SystemException if a system exception occurred
554            */
555            public static boolean hasRolePermission(long roleId, long companyId,
556                    java.lang.String name, int scope, java.lang.String actionId)
557                    throws com.liferay.portal.kernel.exception.SystemException {
558                    return getService()
559                                       .hasRolePermission(roleId, companyId, name, scope, actionId);
560            }
561    
562            /**
563            * Returns <code>true</code> if the role has permission to perform the
564            * action on the named resource with the scope and primKey.
565            *
566            * @param roleId the primary key of the role
567            * @param companyId the primary key of the company
568            * @param name the resource name
569            * @param scope the resource scope
570            * @param primKey the resource primKey
571            * @param actionId the action's ID
572            * @return <code>true</code> if the role has permission to perform the
573            action on the named resource with the scope and primKey;
574            <code>false</code> otherwise
575            * @throws SystemException if a system exception occurred
576            */
577            public static boolean hasRolePermission(long roleId, long companyId,
578                    java.lang.String name, int scope, java.lang.String primKey,
579                    java.lang.String actionId)
580                    throws com.liferay.portal.kernel.exception.SystemException {
581                    return getService()
582                                       .hasRolePermission(roleId, companyId, name, scope, primKey,
583                            actionId);
584            }
585    
586            /**
587            * Returns <code>true</code> if the user has permission to perform the
588            * action on the resource.
589            *
590            * @param userId the primary key of the user
591            * @param actionId the action's ID
592            * @param resourceId the primary key of the resource
593            * @return <code>true</code> if the user has permission to perform the
594            action on the resource; <code>false</code> otherwise
595            * @throws SystemException if a system exception occurred
596            */
597            public static boolean hasUserPermission(long userId,
598                    java.lang.String actionId, long resourceId)
599                    throws com.liferay.portal.kernel.exception.SystemException {
600                    return getService().hasUserPermission(userId, actionId, resourceId);
601            }
602    
603            /**
604            * Returns <code>true</code> if the user has permission to perform the
605            * action on the resources.
606            *
607            * <p>
608            * This method does not support resources managed by the resource block
609            * system.
610            * </p>
611            *
612            * @param userId the primary key of the user
613            * @param groupId the primary key of the group containing the resource
614            * @param resources representations of the resource at each scope level
615            returned by {@link
616            com.liferay.portal.security.permission.AdvancedPermissionChecker#getResources(
617            long, long, String, String, String)}
618            * @param actionId the action's ID
619            * @param permissionCheckerBag the permission checker bag
620            * @return <code>true</code> if the user has permission to perform the
621            action on the resources; <code>false</code> otherwise
622            * @throws PortalException if a resource action based on any one of the
623            resources and the action ID could not be found
624            * @throws SystemException if a system exception occurred
625            */
626            public static boolean hasUserPermissions(long userId, long groupId,
627                    java.util.List<com.liferay.portal.model.Resource> resources,
628                    java.lang.String actionId,
629                    com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
630                    throws com.liferay.portal.kernel.exception.PortalException,
631                            com.liferay.portal.kernel.exception.SystemException {
632                    return getService()
633                                       .hasUserPermissions(userId, groupId, resources, actionId,
634                            permissionCheckerBag);
635            }
636    
637            /**
638            * Sets the container wide permissions of either the role or the default
639            * user of each company to perform the actions on the named resource.
640            *
641            * @param name the resource name
642            * @param roleName the role name. Supported role names include {@link
643            com.liferay.portal.model.RoleConstants#ORGANIZATION_USER},
644            {@link com.liferay.portal.model.RoleConstants#OWNER}, and {@link
645            com.liferay.portal.model.RoleConstants#SITE_MEMBER}.
646            * @param actionId the action's ID
647            * @throws PortalException if a matching role could not be found or if a
648            default user for the company could not be found
649            * @throws SystemException if a system exception occurred
650            */
651            public static void setContainerResourcePermissions(java.lang.String name,
652                    java.lang.String roleName, java.lang.String actionId)
653                    throws com.liferay.portal.kernel.exception.PortalException,
654                            com.liferay.portal.kernel.exception.SystemException {
655                    getService().setContainerResourcePermissions(name, roleName, actionId);
656            }
657    
658            /**
659            * Sets the group's permissions to perform the actions on the resource,
660            * replacing the group's existing permissions on the resource.
661            *
662            * @param groupId the primary key of the group
663            * @param actionIds the primary keys of the actions
664            * @param resourceId the primary key of the resource
665            * @throws PortalException if a group with the primary key could not be
666            found
667            * @throws SystemException if a system exception occurred
668            */
669            public static void setGroupPermissions(long groupId,
670                    java.lang.String[] actionIds, long resourceId)
671                    throws com.liferay.portal.kernel.exception.PortalException,
672                            com.liferay.portal.kernel.exception.SystemException {
673                    getService().setGroupPermissions(groupId, actionIds, resourceId);
674            }
675    
676            /**
677            * Sets the entity's group permissions to perform the actions on the
678            * resource, replacing the entity's existing group permissions on the
679            * resource. Only {@link com.liferay.portal.model.Organization} and {@link
680            * com.liferay.portal.model.UserGroup} class entities are supported.
681            *
682            * @param className the class name of an organization or user group
683            * @param classPK the primary key of the class
684            * @param groupId the primary key of the group
685            * @param actionIds the primary keys of the actions
686            * @param resourceId the primary key of the resource
687            * @throws PortalException if an entity with the class name and primary key
688            could not be found or if the entity's associated group could not
689            be found
690            * @throws SystemException if a system exception occurred
691            */
692            public static void setGroupPermissions(java.lang.String className,
693                    java.lang.String classPK, long groupId, java.lang.String[] actionIds,
694                    long resourceId)
695                    throws com.liferay.portal.kernel.exception.PortalException,
696                            com.liferay.portal.kernel.exception.SystemException {
697                    getService()
698                            .setGroupPermissions(className, classPK, groupId, actionIds,
699                            resourceId);
700            }
701    
702            /**
703            * Sets the organization's group permissions to perform the actions on the
704            * resource, replacing the organization's existing group permissions on the
705            * resource.
706            *
707            * @param organizationId the primary key of the organization
708            * @param groupId the primary key of the group in which to scope the
709            permissions
710            * @param actionIds the primary keys of the actions
711            * @param resourceId the primary key of the resource
712            * @throws PortalException if an organization with the primary key could
713            not be found
714            * @throws SystemException if a system exception occurred
715            */
716            public static void setOrgGroupPermissions(long organizationId,
717                    long groupId, java.lang.String[] actionIds, long resourceId)
718                    throws com.liferay.portal.kernel.exception.PortalException,
719                            com.liferay.portal.kernel.exception.SystemException {
720                    getService()
721                            .setOrgGroupPermissions(organizationId, groupId, actionIds,
722                            resourceId);
723            }
724    
725            /**
726            * Sets the role's permissions to perform the action on the named resource,
727            * replacing the role's existing permissions on the resource.
728            *
729            * @param roleId the primary key of the role
730            * @param companyId the primary key of the company
731            * @param name the resource name
732            * @param scope the resource scope
733            * @param primKey the resource primKey
734            * @param actionId the action's ID
735            * @throws PortalException if the scope was {@link
736            com.liferay.portal.model.ResourceConstants#SCOPE_INDIVIDUAL}
737            * @throws SystemException if a system exception occurred
738            */
739            public static void setRolePermission(long roleId, long companyId,
740                    java.lang.String name, int scope, java.lang.String primKey,
741                    java.lang.String actionId)
742                    throws com.liferay.portal.kernel.exception.PortalException,
743                            com.liferay.portal.kernel.exception.SystemException {
744                    getService()
745                            .setRolePermission(roleId, companyId, name, scope, primKey, actionId);
746            }
747    
748            /**
749            * Sets the role's permissions to perform the actions on the named
750            * resource, replacing the role's existing permission for each of these
751            * actions on the resource.
752            *
753            * @param roleId the primary key of the role
754            * @param companyId the primary key of the company
755            * @param name the resource name
756            * @param scope the resource scope
757            * @param primKey the resource primKey
758            * @param actionIds the primary keys of the actions
759            * @throws PortalException if the scope was {@link
760            com.liferay.portal.model.ResourceConstants#SCOPE_INDIVIDUAL}
761            * @throws SystemException if a system exception occurred
762            */
763            public static void setRolePermissions(long roleId, long companyId,
764                    java.lang.String name, int scope, java.lang.String primKey,
765                    java.lang.String[] actionIds)
766                    throws com.liferay.portal.kernel.exception.PortalException,
767                            com.liferay.portal.kernel.exception.SystemException {
768                    getService()
769                            .setRolePermissions(roleId, companyId, name, scope, primKey,
770                            actionIds);
771            }
772    
773            /**
774            * Sets the role's permissions to perform the actions on the resource,
775            * replacing the role's existing permissions on the resource.
776            *
777            * @param roleId the primary key of the role
778            * @param actionIds the primary keys of the actions
779            * @param resourceId the primary key of the resource
780            * @throws PortalException if a role with the primary key could not be
781            found
782            * @throws SystemException if a system exception occurred
783            */
784            public static void setRolePermissions(long roleId,
785                    java.lang.String[] actionIds, long resourceId)
786                    throws com.liferay.portal.kernel.exception.PortalException,
787                            com.liferay.portal.kernel.exception.SystemException {
788                    getService().setRolePermissions(roleId, actionIds, resourceId);
789            }
790    
791            /**
792            * Sets the permissions of each role to perform respective actions on the
793            * resource, replacing the existing permissions of each role on the
794            * resource.
795            *
796            * @param companyId the primary key of the company
797            * @param roleIdsToActionIds the map of roles to their new actions on the
798            resource
799            * @param resourceId the primary key of the resource
800            * @throws SystemException if a system exception occurred
801            */
802            public static void setRolesPermissions(long companyId,
803                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds,
804                    long resourceId)
805                    throws com.liferay.portal.kernel.exception.SystemException {
806                    getService()
807                            .setRolesPermissions(companyId, roleIdsToActionIds, resourceId);
808            }
809    
810            /**
811            * Sets the permissions of each role to perform respective actions on the
812            * named resource, replacing the existing permissions of each role on the
813            * resource.
814            *
815            * @param companyId the primary key of the company
816            * @param roleIdsToActionIds the map of roles to their new actions on the
817            resource
818            * @param name the resource name
819            * @param scope the resource scope
820            * @param primKey the resource primKey
821            * @throws SystemException if a system exception occurred
822            */
823            public static void setRolesPermissions(long companyId,
824                    java.util.Map<java.lang.Long, java.lang.String[]> roleIdsToActionIds,
825                    java.lang.String name, int scope, java.lang.String primKey)
826                    throws com.liferay.portal.kernel.exception.SystemException {
827                    getService()
828                            .setRolesPermissions(companyId, roleIdsToActionIds, name, scope,
829                            primKey);
830            }
831    
832            /**
833            * Sets the user's permissions to perform the actions on the resource,
834            * replacing the user's existing permissions on the resource.
835            *
836            * @param userId the primary key of the user
837            * @param actionIds the primary keys of the actions
838            * @param resourceId the primary key of the resource
839            * @throws PortalException if a user with the primary key could not be
840            found
841            * @throws SystemException if a system exception occurred
842            */
843            public static void setUserPermissions(long userId,
844                    java.lang.String[] actionIds, long resourceId)
845                    throws com.liferay.portal.kernel.exception.PortalException,
846                            com.liferay.portal.kernel.exception.SystemException {
847                    getService().setUserPermissions(userId, actionIds, resourceId);
848            }
849    
850            /**
851            * Removes the permission from the role.
852            *
853            * @param roleId the primary key of the role
854            * @param permissionId the primary key of the permission
855            * @throws SystemException if a system exception occurred
856            */
857            public static void unsetRolePermission(long roleId, long permissionId)
858                    throws com.liferay.portal.kernel.exception.SystemException {
859                    getService().unsetRolePermission(roleId, permissionId);
860            }
861    
862            /**
863            * Removes the role's permissions to perform the action on the named
864            * resource with the scope and primKey.
865            *
866            * @param roleId the primary key of the role
867            * @param companyId the primary key of the company
868            * @param name the resource name
869            * @param scope the resource scope
870            * @param primKey the resource primKey
871            * @param actionId the action's ID
872            * @throws SystemException if a system exception occurred
873            */
874            public static void unsetRolePermission(long roleId, long companyId,
875                    java.lang.String name, int scope, java.lang.String primKey,
876                    java.lang.String actionId)
877                    throws com.liferay.portal.kernel.exception.SystemException {
878                    getService()
879                            .unsetRolePermission(roleId, companyId, name, scope, primKey,
880                            actionId);
881            }
882    
883            /**
884            * Removes the role's permissions to perform the action on the named
885            * resource.
886            *
887            * @param roleId the primary key of the role
888            * @param companyId the primary key of the company
889            * @param name the resource name
890            * @param scope the resource scope
891            * @param actionId the action's ID
892            * @throws SystemException if a system exception occurred
893            */
894            public static void unsetRolePermissions(long roleId, long companyId,
895                    java.lang.String name, int scope, java.lang.String actionId)
896                    throws com.liferay.portal.kernel.exception.SystemException {
897                    getService()
898                            .unsetRolePermissions(roleId, companyId, name, scope, actionId);
899            }
900    
901            /**
902            * Removes the user's permissions to perform the actions on the resource.
903            *
904            * @param userId the primary key of the user
905            * @param actionIds the primary keys of the actions
906            * @param resourceId the primary key of the resource
907            * @throws SystemException if a system exception occurred
908            */
909            public static void unsetUserPermissions(long userId,
910                    java.lang.String[] actionIds, long resourceId)
911                    throws com.liferay.portal.kernel.exception.SystemException {
912                    getService().unsetUserPermissions(userId, actionIds, resourceId);
913            }
914    
915            public static PermissionLocalService getService() {
916                    if (_service == null) {
917                            _service = (PermissionLocalService)PortalBeanLocatorUtil.locate(PermissionLocalService.class.getName());
918    
919                            ReferenceRegistry.registerReference(PermissionLocalServiceUtil.class,
920                                    "_service");
921                            MethodCache.remove(PermissionLocalService.class);
922                    }
923    
924                    return _service;
925            }
926    
927            public void setService(PermissionLocalService service) {
928                    MethodCache.remove(PermissionLocalService.class);
929    
930                    _service = service;
931    
932                    ReferenceRegistry.registerReference(PermissionLocalServiceUtil.class,
933                            "_service");
934                    MethodCache.remove(PermissionLocalService.class);
935            }
936    
937            private static PermissionLocalService _service;
938    }