001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the resource permission local service. This utility wraps {@link com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl} 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 ResourcePermissionLocalService
030     * @see com.liferay.portal.service.base.ResourcePermissionLocalServiceBaseImpl
031     * @see com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl
032     * @generated
033     */
034    public class ResourcePermissionLocalServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.ResourcePermissionLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040    
041            /**
042            * Adds the resource permission to the database. Also notifies the appropriate model listeners.
043            *
044            * @param resourcePermission the resource permission
045            * @return the resource permission that was added
046            * @throws SystemException if a system exception occurred
047            */
048            public static com.liferay.portal.model.ResourcePermission addResourcePermission(
049                    com.liferay.portal.model.ResourcePermission resourcePermission)
050                    throws com.liferay.portal.kernel.exception.SystemException {
051                    return getService().addResourcePermission(resourcePermission);
052            }
053    
054            /**
055            * Creates a new resource permission with the primary key. Does not add the resource permission to the database.
056            *
057            * @param resourcePermissionId the primary key for the new resource permission
058            * @return the new resource permission
059            */
060            public static com.liferay.portal.model.ResourcePermission createResourcePermission(
061                    long resourcePermissionId) {
062                    return getService().createResourcePermission(resourcePermissionId);
063            }
064    
065            /**
066            * Deletes the resource permission with the primary key from the database. Also notifies the appropriate model listeners.
067            *
068            * @param resourcePermissionId the primary key of the resource permission
069            * @throws PortalException if a resource permission with the primary key could not be found
070            * @throws SystemException if a system exception occurred
071            */
072            public static void deleteResourcePermission(long resourcePermissionId)
073                    throws com.liferay.portal.kernel.exception.PortalException,
074                            com.liferay.portal.kernel.exception.SystemException {
075                    getService().deleteResourcePermission(resourcePermissionId);
076            }
077    
078            /**
079            * Deletes the resource permission from the database. Also notifies the appropriate model listeners.
080            *
081            * @param resourcePermission the resource permission
082            * @throws SystemException if a system exception occurred
083            */
084            public static void deleteResourcePermission(
085                    com.liferay.portal.model.ResourcePermission resourcePermission)
086                    throws com.liferay.portal.kernel.exception.SystemException {
087                    getService().deleteResourcePermission(resourcePermission);
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 resource permission with the primary key.
163            *
164            * @param resourcePermissionId the primary key of the resource permission
165            * @return the resource permission
166            * @throws PortalException if a resource 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.ResourcePermission getResourcePermission(
170                    long resourcePermissionId)
171                    throws com.liferay.portal.kernel.exception.PortalException,
172                            com.liferay.portal.kernel.exception.SystemException {
173                    return getService().getResourcePermission(resourcePermissionId);
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 resource 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 resource permissions
191            * @param end the upper bound of the range of resource permissions (not inclusive)
192            * @return the range of resource permissions
193            * @throws SystemException if a system exception occurred
194            */
195            public static java.util.List<com.liferay.portal.model.ResourcePermission> getResourcePermissions(
196                    int start, int end)
197                    throws com.liferay.portal.kernel.exception.SystemException {
198                    return getService().getResourcePermissions(start, end);
199            }
200    
201            /**
202            * Returns the number of resource permissions.
203            *
204            * @return the number of resource permissions
205            * @throws SystemException if a system exception occurred
206            */
207            public static int getResourcePermissionsCount()
208                    throws com.liferay.portal.kernel.exception.SystemException {
209                    return getService().getResourcePermissionsCount();
210            }
211    
212            /**
213            * Updates the resource permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
214            *
215            * @param resourcePermission the resource permission
216            * @return the resource permission that was updated
217            * @throws SystemException if a system exception occurred
218            */
219            public static com.liferay.portal.model.ResourcePermission updateResourcePermission(
220                    com.liferay.portal.model.ResourcePermission resourcePermission)
221                    throws com.liferay.portal.kernel.exception.SystemException {
222                    return getService().updateResourcePermission(resourcePermission);
223            }
224    
225            /**
226            * Updates the resource permission in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.
227            *
228            * @param resourcePermission the resource permission
229            * @param merge whether to merge the resource 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 resource permission that was updated
231            * @throws SystemException if a system exception occurred
232            */
233            public static com.liferay.portal.model.ResourcePermission updateResourcePermission(
234                    com.liferay.portal.model.ResourcePermission resourcePermission,
235                    boolean merge)
236                    throws com.liferay.portal.kernel.exception.SystemException {
237                    return getService().updateResourcePermission(resourcePermission, merge);
238            }
239    
240            /**
241            * Returns the Spring bean ID for this bean.
242            *
243            * @return the Spring bean ID for this bean
244            */
245            public static java.lang.String getBeanIdentifier() {
246                    return getService().getBeanIdentifier();
247            }
248    
249            /**
250            * Sets the Spring bean ID for this bean.
251            *
252            * @param beanIdentifier the Spring bean ID for this bean
253            */
254            public static void setBeanIdentifier(java.lang.String beanIdentifier) {
255                    getService().setBeanIdentifier(beanIdentifier);
256            }
257    
258            /**
259            * Grants the role permission at the scope to perform the action on
260            * resources of the type. Existing actions are retained.
261            *
262            * <p>
263            * This method cannot be used to grant individual scope permissions, but is
264            * only intended for adding permissions at the company, group, and
265            * group-template scopes. For example, this method could be used to grant a
266            * company scope permission to edit message board posts.
267            * </p>
268            *
269            * <p>
270            * If a company scope permission is granted to resources that the role
271            * already had group scope permissions to, the group scope permissions are
272            * deleted. Likewise, if a group scope permission is granted to resources
273            * that the role already had company scope permissions to, the company scope
274            * permissions are deleted. Be aware that this latter behavior can result in
275            * an overall reduction in permissions for the role.
276            * </p>
277            *
278            * <p>
279            * Depending on the scope, the value of <code>primKey</code> will have
280            * different meanings. For more information, see {@link
281            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
282            * </p>
283            *
284            * @param companyId the primary key of the company
285            * @param name the resource's name, which can be either a class name or a
286            portlet ID
287            * @param scope the scope. This method only supports company, group, and
288            group-template scope.
289            * @param primKey the primary key
290            * @param roleId the primary key of the role
291            * @param actionId the action ID
292            * @throws PortalException if scope was set to individual scope or if a role
293            with the primary key or a resource action with the name and
294            action ID could not be found
295            * @throws SystemException if a system exception occurred
296            */
297            public static void addResourcePermission(long companyId,
298                    java.lang.String name, int scope, java.lang.String primKey,
299                    long roleId, java.lang.String actionId)
300                    throws com.liferay.portal.kernel.exception.PortalException,
301                            com.liferay.portal.kernel.exception.SystemException {
302                    getService()
303                            .addResourcePermission(companyId, name, scope, primKey, roleId,
304                            actionId);
305            }
306    
307            /**
308            * Grants the role permissions at the scope to perform the actions on all
309            * resources of the type. Existing actions are retained.
310            *
311            * <p>
312            * This method should only be used to add default permissions to existing
313            * resources en masse during upgrades or while verifying permissions. For
314            * example, this method could be used to grant site members individual scope
315            * permissions to view all blog posts.
316            * </p>
317            *
318            * @param resourceName the resource's name, which can be either a class
319            name or a portlet ID
320            * @param roleName the role's name
321            * @param scope the scope
322            * @param resourceActionBitwiseValue the bitwise IDs of the actions
323            * @throws SystemException if a system exception occurred
324            */
325            public static void addResourcePermissions(java.lang.String resourceName,
326                    java.lang.String roleName, int scope, long resourceActionBitwiseValue)
327                    throws com.liferay.portal.kernel.exception.SystemException {
328                    getService()
329                            .addResourcePermissions(resourceName, roleName, scope,
330                            resourceActionBitwiseValue);
331            }
332    
333            /**
334            * Deletes all resource permissions at the scope to resources of the type.
335            * This method should not be confused with any of the
336            * <code>removeResourcePermission</code> methods, as its purpose is very
337            * different. This method should only be used for deleting resource
338            * permissions that refer to a resource when that resource is deleted. For
339            * example this method could be used to delete all individual scope
340            * permissions to a blog post when it is deleted.
341            *
342            * <p>
343            * Depending on the scope, the value of <code>primKey</code> will have
344            * different meanings. For more information, see {@link
345            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
346            * </p>
347            *
348            * @param companyId the primary key of the company
349            * @param name the resource's name, which can be either a class name or a
350            portlet ID
351            * @param scope the scope
352            * @param primKey the primary key
353            * @throws PortalException if a portal exception occurred
354            * @throws SystemException if a system exception occurred
355            */
356            public static void deleteResourcePermissions(long companyId,
357                    java.lang.String name, int scope, long primKey)
358                    throws com.liferay.portal.kernel.exception.PortalException,
359                            com.liferay.portal.kernel.exception.SystemException {
360                    getService().deleteResourcePermissions(companyId, name, scope, primKey);
361            }
362    
363            /**
364            * Deletes all resource permissions at the scope to resources of the type.
365            * This method should not be confused with any of the
366            * <code>removeResourcePermission</code> methods, as its purpose is very
367            * different. This method should only be used for deleting resource
368            * permissions that refer to a resource when that resource is deleted. For
369            * example this method could be used to delete all individual scope
370            * permissions to a blog post when it is deleted.
371            *
372            * <p>
373            * Depending on the scope, the value of <code>primKey</code> will have
374            * different meanings. For more information, see {@link
375            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
376            * </p>
377            *
378            * @param companyId the primary key of the company
379            * @param name the resource's name, which can be either a class name or a
380            portlet ID
381            * @param scope the scope
382            * @param primKey the primary key
383            * @throws PortalException if a portal exception occurred
384            * @throws SystemException if a system exception occurred
385            */
386            public static void deleteResourcePermissions(long companyId,
387                    java.lang.String name, int scope, java.lang.String primKey)
388                    throws com.liferay.portal.kernel.exception.PortalException,
389                            com.liferay.portal.kernel.exception.SystemException {
390                    getService().deleteResourcePermissions(companyId, name, scope, primKey);
391            }
392    
393            public static java.util.List<java.lang.String> getAvailableResourcePermissionActionIds(
394                    long companyId, java.lang.String name, int scope,
395                    java.lang.String primKey, long roleId,
396                    java.util.List<java.lang.String> actionIds)
397                    throws com.liferay.portal.kernel.exception.PortalException,
398                            com.liferay.portal.kernel.exception.SystemException {
399                    return getService()
400                                       .getAvailableResourcePermissionActionIds(companyId, name,
401                            scope, primKey, roleId, actionIds);
402            }
403    
404            public static com.liferay.portal.model.ResourcePermission getResourcePermission(
405                    long companyId, java.lang.String name, int scope,
406                    java.lang.String primKey, long roleId)
407                    throws com.liferay.portal.kernel.exception.PortalException,
408                            com.liferay.portal.kernel.exception.SystemException {
409                    return getService()
410                                       .getResourcePermission(companyId, name, scope, primKey,
411                            roleId);
412            }
413    
414            public static java.util.List<com.liferay.portal.model.ResourcePermission> getResourcePermissions(
415                    long companyId, java.lang.String name, int scope,
416                    java.lang.String primKey)
417                    throws com.liferay.portal.kernel.exception.SystemException {
418                    return getService()
419                                       .getResourcePermissions(companyId, name, scope, primKey);
420            }
421    
422            public static int getResourcePermissionsCount(long companyId,
423                    java.lang.String name, int scope, java.lang.String primKey)
424                    throws com.liferay.portal.kernel.exception.SystemException {
425                    return getService()
426                                       .getResourcePermissionsCount(companyId, name, scope, primKey);
427            }
428    
429            public static java.util.List<com.liferay.portal.model.ResourcePermission> getRoleResourcePermissions(
430                    long roleId) throws com.liferay.portal.kernel.exception.SystemException {
431                    return getService().getRoleResourcePermissions(roleId);
432            }
433    
434            public static java.util.List<com.liferay.portal.model.ResourcePermission> getRoleResourcePermissions(
435                    long roleId, int[] scopes, int start, int end)
436                    throws com.liferay.portal.kernel.exception.SystemException {
437                    return getService()
438                                       .getRoleResourcePermissions(roleId, scopes, start, end);
439            }
440    
441            /**
442            * Returns <code>true</code> if the resource permission grants permission to
443            * perform the resource action. Note that this method does not ensure that
444            * the resource permission refers to the same type of resource as the
445            * resource action.
446            *
447            * @param resourcePermission the resource permission
448            * @param resourceAction the resource action
449            * @return <code>true</code> if the resource permission grants permission to
450            perform the resource action
451            */
452            public static boolean hasActionId(
453                    com.liferay.portal.model.ResourcePermission resourcePermission,
454                    com.liferay.portal.model.ResourceAction resourceAction) {
455                    return getService().hasActionId(resourcePermission, resourceAction);
456            }
457    
458            /**
459            * Returns <code>true</code> if the role has permission at the scope to
460            * perform the action on resources of the type.
461            *
462            * <p>
463            * Depending on the scope, the value of <code>primKey</code> will have
464            * different meanings. For more information, see {@link
465            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
466            * </p>
467            *
468            * @param companyId the primary key of the company
469            * @param name the resource's name, which can be either a class name or a
470            portlet ID
471            * @param scope the scope
472            * @param primKey the primary key
473            * @param roleId the primary key of the role
474            * @param actionId the action ID
475            * @return <code>true</code> if the role has permission to perform the
476            action on the resource; <code>false</code> otherwise
477            * @throws PortalException if a role with the primary key or a resource
478            action with the name and action ID could not be found
479            * @throws SystemException if a system exception occurred
480            */
481            public static boolean hasResourcePermission(long companyId,
482                    java.lang.String name, int scope, java.lang.String primKey,
483                    long roleId, java.lang.String actionId)
484                    throws com.liferay.portal.kernel.exception.PortalException,
485                            com.liferay.portal.kernel.exception.SystemException {
486                    return getService()
487                                       .hasResourcePermission(companyId, name, scope, primKey,
488                            roleId, actionId);
489            }
490    
491            public static boolean hasScopeResourcePermission(long companyId,
492                    java.lang.String name, int scope, long roleId, java.lang.String actionId)
493                    throws com.liferay.portal.kernel.exception.PortalException,
494                            com.liferay.portal.kernel.exception.SystemException {
495                    return getService()
496                                       .hasScopeResourcePermission(companyId, name, scope, roleId,
497                            actionId);
498            }
499    
500            /**
501            * Reassigns all the resource permissions from the source role to the
502            * destination role, and deletes the source role.
503            *
504            * @param fromRoleId the primary key of the source role
505            * @param toRoleId the primary key of the destination role
506            * @throws PortalException if a role with the primary key could not be found
507            * @throws SystemException if a system exception occurred
508            */
509            public static void mergePermissions(long fromRoleId, long toRoleId)
510                    throws com.liferay.portal.kernel.exception.PortalException,
511                            com.liferay.portal.kernel.exception.SystemException {
512                    getService().mergePermissions(fromRoleId, toRoleId);
513            }
514    
515            /**
516            * Grants the role default permissions to all the resources of the type and
517            * at the scope stored in the resource permission, deletes the resource
518            * permission, and deletes the resource permission's role if it has no
519            * permissions remaining.
520            *
521            * @param resourcePermissionId the primary key of the resource permission
522            * @param toRoleId the primary key of the role
523            * @throws PortalException if a resource permission or role with the primary
524            key could not be found
525            * @throws SystemException if a system exception occurred
526            */
527            public static void reassignPermissions(long resourcePermissionId,
528                    long toRoleId)
529                    throws com.liferay.portal.kernel.exception.PortalException,
530                            com.liferay.portal.kernel.exception.SystemException {
531                    getService().reassignPermissions(resourcePermissionId, toRoleId);
532            }
533    
534            /**
535            * Revokes permission at the scope from the role to perform the action on
536            * resources of the type. For example, this method could be used to revoke a
537            * group scope permission to edit blog posts.
538            *
539            * <p>
540            * Depending on the scope, the value of <code>primKey</code> will have
541            * different meanings. For more information, see {@link
542            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
543            * </p>
544            *
545            * @param companyId the primary key of the company
546            * @param name the resource's name, which can be either a class name or a
547            portlet ID
548            * @param scope the scope
549            * @param primKey the primary key
550            * @param roleId the primary key of the role
551            * @param actionId the action ID
552            * @throws PortalException if a role with the primary key or a resource
553            action with the name and action ID could not be found
554            * @throws SystemException if a system exception occurred
555            */
556            public static void removeResourcePermission(long companyId,
557                    java.lang.String name, int scope, java.lang.String primKey,
558                    long roleId, java.lang.String actionId)
559                    throws com.liferay.portal.kernel.exception.PortalException,
560                            com.liferay.portal.kernel.exception.SystemException {
561                    getService()
562                            .removeResourcePermission(companyId, name, scope, primKey, roleId,
563                            actionId);
564            }
565    
566            /**
567            * Revokes all permissions at the scope from the role to perform the action
568            * on resources of the type. For example, this method could be used to
569            * revoke all individual scope permissions to edit blog posts from site
570            * members.
571            *
572            * @param companyId the primary key of the company
573            * @param name the resource's name, which can be either a class name or a
574            portlet ID
575            * @param scope the scope
576            * @param roleId the primary key of the role
577            * @param actionId the action ID
578            * @throws PortalException if a role with the primary key or a resource
579            action with the name and action ID could not be found
580            * @throws SystemException if a system exception occurred
581            */
582            public static void removeResourcePermissions(long companyId,
583                    java.lang.String name, int scope, long roleId, java.lang.String actionId)
584                    throws com.liferay.portal.kernel.exception.PortalException,
585                            com.liferay.portal.kernel.exception.SystemException {
586                    getService()
587                            .removeResourcePermissions(companyId, name, scope, roleId, actionId);
588            }
589    
590            /**
591            * Updates the role's permissions at the scope, setting the actions that can
592            * be performed on resources of the type, also setting the owner of any
593            * newly created resource permissions. Existing actions are replaced.
594            *
595            * <p>
596            * This method can be used to set permissions at any scope, but it is
597            * generally only used at the individual scope. For example, it could be
598            * used to set the guest permissions on a blog post.
599            * </p>
600            *
601            * <p>
602            * Depending on the scope, the value of <code>primKey</code> will have
603            * different meanings. For more information, see {@link
604            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
605            * </p>
606            *
607            * @param companyId the primary key of the company
608            * @param name the resource's name, which can be either a class name or a
609            portlet ID
610            * @param scope the scope
611            * @param primKey the primary key
612            * @param roleId the primary key of the role
613            * @param ownerId the primary key of the owner (generally the user that
614            created the resource)
615            * @param actionIds the action IDs of the actions
616            * @throws PortalException if a role with the primary key or a resource
617            action with the name and action ID could not be found
618            * @throws SystemException if a system exception occurred
619            */
620            public static void setOwnerResourcePermissions(long companyId,
621                    java.lang.String name, int scope, java.lang.String primKey,
622                    long roleId, long ownerId, java.lang.String[] actionIds)
623                    throws com.liferay.portal.kernel.exception.PortalException,
624                            com.liferay.portal.kernel.exception.SystemException {
625                    getService()
626                            .setOwnerResourcePermissions(companyId, name, scope, primKey,
627                            roleId, ownerId, actionIds);
628            }
629    
630            /**
631            * Updates the role's permissions at the scope, setting the actions that can
632            * be performed on resources of the type. Existing actions are replaced.
633            *
634            * <p>
635            * This method can be used to set permissions at any scope, but it is
636            * generally only used at the individual scope. For example, it could be
637            * used to set the guest permissions on a blog post.
638            * </p>
639            *
640            * <p>
641            * Depending on the scope, the value of <code>primKey</code> will have
642            * different meanings. For more information, see {@link
643            * com.liferay.portal.model.impl.ResourcePermissionImpl}.
644            * </p>
645            *
646            * @param companyId the primary key of the company
647            * @param name the resource's name, which can be either a class name or a
648            portlet ID
649            * @param scope the scope
650            * @param primKey the primary key
651            * @param roleId the primary key of the role
652            * @param actionIds the action IDs of the actions
653            * @throws PortalException if a role with the primary key or a resource
654            action with the name and action ID could not be found
655            * @throws SystemException if a system exception occurred
656            */
657            public static void setResourcePermissions(long companyId,
658                    java.lang.String name, int scope, java.lang.String primKey,
659                    long roleId, java.lang.String[] actionIds)
660                    throws com.liferay.portal.kernel.exception.PortalException,
661                            com.liferay.portal.kernel.exception.SystemException {
662                    getService()
663                            .setResourcePermissions(companyId, name, scope, primKey, roleId,
664                            actionIds);
665            }
666    
667            public static ResourcePermissionLocalService getService() {
668                    if (_service == null) {
669                            _service = (ResourcePermissionLocalService)PortalBeanLocatorUtil.locate(ResourcePermissionLocalService.class.getName());
670    
671                            ReferenceRegistry.registerReference(ResourcePermissionLocalServiceUtil.class,
672                                    "_service");
673                            MethodCache.remove(ResourcePermissionLocalService.class);
674                    }
675    
676                    return _service;
677            }
678    
679            public void setService(ResourcePermissionLocalService service) {
680                    MethodCache.remove(ResourcePermissionLocalService.class);
681    
682                    _service = service;
683    
684                    ReferenceRegistry.registerReference(ResourcePermissionLocalServiceUtil.class,
685                            "_service");
686                    MethodCache.remove(ResourcePermissionLocalService.class);
687            }
688    
689            private static ResourcePermissionLocalService _service;
690    }