001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.service;
016    
017    import com.liferay.portal.kernel.bean.PortalBeanLocatorUtil;
018    import com.liferay.portal.kernel.util.MethodCache;
019    import com.liferay.portal.kernel.util.ReferenceRegistry;
020    
021    /**
022     * The utility for the permission local service. This utility wraps {@link com.liferay.portal.service.impl.PermissionLocalServiceImpl} and is the primary access point for service operations in application layer code running on the local server.
023     *
024     * <p>
025     * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
026     * </p>
027     *
028     * @author Brian Wing Shun Chan
029     * @see PermissionLocalService
030     * @see com.liferay.portal.service.base.PermissionLocalServiceBaseImpl
031     * @see com.liferay.portal.service.impl.PermissionLocalServiceImpl
032     * @generated
033     */
034    public class PermissionLocalServiceUtil {
035            /*
036             * NOTE FOR DEVELOPERS:
037             *
038             * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.PermissionLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
039             */
040    
041            /**
042            * Adds the permission to the database. Also notifies the appropriate model listeners.
043            *
044            * @param permission the permission
045            * @return the permission that was added
046            * @throws SystemException if a system exception occurred
047            */
048            public static com.liferay.portal.model.Permission addPermission(
049                    com.liferay.portal.model.Permission permission)
050                    throws com.liferay.portal.kernel.exception.SystemException {
051                    return getService().addPermission(permission);
052            }
053    
054            /**
055            * Creates a new permission with the primary key. Does not add the permission to the database.
056            *
057            * @param permissionId the primary key for the new permission
058            * @return the new permission
059            */
060            public static com.liferay.portal.model.Permission createPermission(
061                    long permissionId) {
062                    return getService().createPermission(permissionId);
063            }
064    
065            /**
066            * Deletes the permission with the primary key from the database. Also notifies the appropriate model listeners.
067            *
068            * @param permissionId the primary key of the permission
069            * @throws PortalException if a permission with the primary key could not be found
070            * @throws SystemException if a system exception occurred
071            */
072            public static void deletePermission(long permissionId)
073                    throws com.liferay.portal.kernel.exception.PortalException,
074                            com.liferay.portal.kernel.exception.SystemException {
075                    getService().deletePermission(permissionId);
076            }
077    
078            /**
079            * Deletes the permission from the database. Also notifies the appropriate model listeners.
080            *
081            * @param permission the permission
082            * @throws SystemException if a system exception occurred
083            */
084            public static void deletePermission(
085                    com.liferay.portal.model.Permission permission)
086                    throws com.liferay.portal.kernel.exception.SystemException {
087                    getService().deletePermission(permission);
088            }
089    
090            /**
091            * Performs a dynamic query on the database and returns the matching rows.
092            *
093            * @param dynamicQuery the dynamic query
094            * @return the matching rows
095            * @throws SystemException if a system exception occurred
096            */
097            @SuppressWarnings("rawtypes")
098            public static java.util.List dynamicQuery(
099                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
100                    throws com.liferay.portal.kernel.exception.SystemException {
101                    return getService().dynamicQuery(dynamicQuery);
102            }
103    
104            /**
105            * Performs a dynamic query on the database and returns a range of the matching rows.
106            *
107            * <p>
108            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
109            * </p>
110            *
111            * @param dynamicQuery the dynamic query
112            * @param start the lower bound of the range of model instances
113            * @param end the upper bound of the range of model instances (not inclusive)
114            * @return the range of matching rows
115            * @throws SystemException if a system exception occurred
116            */
117            @SuppressWarnings("rawtypes")
118            public static java.util.List dynamicQuery(
119                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
120                    int end) throws com.liferay.portal.kernel.exception.SystemException {
121                    return getService().dynamicQuery(dynamicQuery, start, end);
122            }
123    
124            /**
125            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
126            *
127            * <p>
128            * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
129            * </p>
130            *
131            * @param dynamicQuery the dynamic query
132            * @param start the lower bound of the range of model instances
133            * @param end the upper bound of the range of model instances (not inclusive)
134            * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
135            * @return the ordered range of matching rows
136            * @throws SystemException if a system exception occurred
137            */
138            @SuppressWarnings("rawtypes")
139            public static java.util.List dynamicQuery(
140                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
141                    int end,
142                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
143                    throws com.liferay.portal.kernel.exception.SystemException {
144                    return getService()
145                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
146            }
147    
148            /**
149            * Returns the number of rows that match the dynamic query.
150            *
151            * @param dynamicQuery the dynamic query
152            * @return the number of rows that match the dynamic query
153            * @throws SystemException if a system exception occurred
154            */
155            public static long dynamicQueryCount(
156                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
157                    throws com.liferay.portal.kernel.exception.SystemException {
158                    return getService().dynamicQueryCount(dynamicQuery);
159            }
160    
161            /**
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            public static com.liferay.portal.model.Permission addPermission(
258                    long companyId, java.lang.String actionId, long resourceId)
259                    throws com.liferay.portal.kernel.exception.SystemException {
260                    return getService().addPermission(companyId, actionId, resourceId);
261            }
262    
263            public static java.util.List<com.liferay.portal.model.Permission> addPermissions(
264                    long companyId, java.util.List<java.lang.String> actionIds,
265                    long resourceId)
266                    throws com.liferay.portal.kernel.exception.SystemException {
267                    return getService().addPermissions(companyId, actionIds, resourceId);
268            }
269    
270            public static java.util.List<com.liferay.portal.model.Permission> addPermissions(
271                    long companyId, java.lang.String name, long resourceId,
272                    boolean portletActions)
273                    throws com.liferay.portal.kernel.exception.SystemException {
274                    return getService()
275                                       .addPermissions(companyId, name, resourceId, portletActions);
276            }
277    
278            public static void addUserPermissions(long userId,
279                    java.lang.String[] actionIds, long resourceId)
280                    throws com.liferay.portal.kernel.exception.PortalException,
281                            com.liferay.portal.kernel.exception.SystemException {
282                    getService().addUserPermissions(userId, actionIds, resourceId);
283            }
284    
285            public static void checkPermissions(java.lang.String name,
286                    java.util.List<java.lang.String> actionIds)
287                    throws com.liferay.portal.kernel.exception.PortalException,
288                            com.liferay.portal.kernel.exception.SystemException {
289                    getService().checkPermissions(name, actionIds);
290            }
291    
292            public static java.util.List<java.lang.String> getActions(
293                    java.util.List<com.liferay.portal.model.Permission> permissions) {
294                    return getService().getActions(permissions);
295            }
296    
297            public static java.util.List<com.liferay.portal.model.Permission> getGroupPermissions(
298                    long groupId, long resourceId)
299                    throws com.liferay.portal.kernel.exception.SystemException {
300                    return getService().getGroupPermissions(groupId, resourceId);
301            }
302    
303            public static java.util.List<com.liferay.portal.model.Permission> getGroupPermissions(
304                    long groupId, long companyId, java.lang.String name, int scope,
305                    java.lang.String primKey)
306                    throws com.liferay.portal.kernel.exception.SystemException {
307                    return getService()
308                                       .getGroupPermissions(groupId, companyId, name, scope, primKey);
309            }
310    
311            public static long getLatestPermissionId()
312                    throws com.liferay.portal.kernel.exception.SystemException {
313                    return getService().getLatestPermissionId();
314            }
315    
316            public static java.util.List<com.liferay.portal.model.Permission> getOrgGroupPermissions(
317                    long organizationId, long groupId, long resourceId)
318                    throws com.liferay.portal.kernel.exception.SystemException {
319                    return getService()
320                                       .getOrgGroupPermissions(organizationId, groupId, resourceId);
321            }
322    
323            public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
324                    long companyId, java.lang.String[] actionIds, long resourceId)
325                    throws com.liferay.portal.kernel.exception.SystemException {
326                    return getService().getPermissions(companyId, actionIds, resourceId);
327            }
328    
329            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
330                    long roleId) throws com.liferay.portal.kernel.exception.SystemException {
331                    return getService().getRolePermissions(roleId);
332            }
333    
334            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
335                    long roleId, long resourceId)
336                    throws com.liferay.portal.kernel.exception.SystemException {
337                    return getService().getRolePermissions(roleId, resourceId);
338            }
339    
340            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
341                    long userId, long resourceId)
342                    throws com.liferay.portal.kernel.exception.SystemException {
343                    return getService().getUserPermissions(userId, resourceId);
344            }
345    
346            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
347                    long userId, long companyId, java.lang.String name, int scope,
348                    java.lang.String primKey)
349                    throws com.liferay.portal.kernel.exception.SystemException {
350                    return getService()
351                                       .getUserPermissions(userId, companyId, name, scope, primKey);
352            }
353    
354            public static boolean hasGroupPermission(long groupId,
355                    java.lang.String actionId, long resourceId)
356                    throws com.liferay.portal.kernel.exception.SystemException {
357                    return getService().hasGroupPermission(groupId, actionId, resourceId);
358            }
359    
360            public static boolean hasRolePermission(long roleId, long companyId,
361                    java.lang.String name, int scope, java.lang.String actionId)
362                    throws com.liferay.portal.kernel.exception.SystemException {
363                    return getService()
364                                       .hasRolePermission(roleId, companyId, name, scope, actionId);
365            }
366    
367            public static boolean hasRolePermission(long roleId, long companyId,
368                    java.lang.String name, int scope, java.lang.String primKey,
369                    java.lang.String actionId)
370                    throws com.liferay.portal.kernel.exception.SystemException {
371                    return getService()
372                                       .hasRolePermission(roleId, companyId, name, scope, primKey,
373                            actionId);
374            }
375    
376            public static boolean hasUserPermission(long userId,
377                    java.lang.String actionId, long resourceId)
378                    throws com.liferay.portal.kernel.exception.SystemException {
379                    return getService().hasUserPermission(userId, actionId, resourceId);
380            }
381    
382            public static boolean hasUserPermissions(long userId, long groupId,
383                    java.util.List<com.liferay.portal.model.Resource> resources,
384                    java.lang.String actionId,
385                    com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
386                    throws com.liferay.portal.kernel.exception.PortalException,
387                            com.liferay.portal.kernel.exception.SystemException {
388                    return getService()
389                                       .hasUserPermissions(userId, groupId, resources, actionId,
390                            permissionCheckerBag);
391            }
392    
393            public static void setContainerResourcePermissions(java.lang.String name,
394                    java.lang.String roleName, java.lang.String actionId)
395                    throws com.liferay.portal.kernel.exception.PortalException,
396                            com.liferay.portal.kernel.exception.SystemException {
397                    getService().setContainerResourcePermissions(name, roleName, actionId);
398            }
399    
400            public static void setGroupPermissions(long groupId,
401                    java.lang.String[] actionIds, long resourceId)
402                    throws com.liferay.portal.kernel.exception.PortalException,
403                            com.liferay.portal.kernel.exception.SystemException {
404                    getService().setGroupPermissions(groupId, actionIds, resourceId);
405            }
406    
407            public static void setGroupPermissions(java.lang.String className,
408                    java.lang.String classPK, long groupId, java.lang.String[] actionIds,
409                    long resourceId)
410                    throws com.liferay.portal.kernel.exception.PortalException,
411                            com.liferay.portal.kernel.exception.SystemException {
412                    getService()
413                            .setGroupPermissions(className, classPK, groupId, actionIds,
414                            resourceId);
415            }
416    
417            public static void setOrgGroupPermissions(long organizationId,
418                    long groupId, java.lang.String[] actionIds, long resourceId)
419                    throws com.liferay.portal.kernel.exception.PortalException,
420                            com.liferay.portal.kernel.exception.SystemException {
421                    getService()
422                            .setOrgGroupPermissions(organizationId, groupId, actionIds,
423                            resourceId);
424            }
425    
426            public static void setRolePermission(long roleId, long companyId,
427                    java.lang.String name, int scope, java.lang.String primKey,
428                    java.lang.String actionId)
429                    throws com.liferay.portal.kernel.exception.PortalException,
430                            com.liferay.portal.kernel.exception.SystemException {
431                    getService()
432                            .setRolePermission(roleId, companyId, name, scope, primKey, actionId);
433            }
434    
435            public static void setRolePermissions(long roleId, long companyId,
436                    java.lang.String name, int scope, java.lang.String primKey,
437                    java.lang.String[] actionIds)
438                    throws com.liferay.portal.kernel.exception.PortalException,
439                            com.liferay.portal.kernel.exception.SystemException {
440                    getService()
441                            .setRolePermissions(roleId, companyId, name, scope, primKey,
442                            actionIds);
443            }
444    
445            public static void setRolePermissions(long roleId,
446                    java.lang.String[] actionIds, long resourceId)
447                    throws com.liferay.portal.kernel.exception.PortalException,
448                            com.liferay.portal.kernel.exception.SystemException {
449                    getService().setRolePermissions(roleId, actionIds, resourceId);
450            }
451    
452            public static void setUserPermissions(long userId,
453                    java.lang.String[] actionIds, long resourceId)
454                    throws com.liferay.portal.kernel.exception.PortalException,
455                            com.liferay.portal.kernel.exception.SystemException {
456                    getService().setUserPermissions(userId, actionIds, resourceId);
457            }
458    
459            public static void unsetRolePermission(long roleId, long permissionId)
460                    throws com.liferay.portal.kernel.exception.SystemException {
461                    getService().unsetRolePermission(roleId, permissionId);
462            }
463    
464            public static void unsetRolePermission(long roleId, long companyId,
465                    java.lang.String name, int scope, java.lang.String primKey,
466                    java.lang.String actionId)
467                    throws com.liferay.portal.kernel.exception.SystemException {
468                    getService()
469                            .unsetRolePermission(roleId, companyId, name, scope, primKey,
470                            actionId);
471            }
472    
473            public static void unsetRolePermissions(long roleId, long companyId,
474                    java.lang.String name, int scope, java.lang.String actionId)
475                    throws com.liferay.portal.kernel.exception.SystemException {
476                    getService()
477                            .unsetRolePermissions(roleId, companyId, name, scope, actionId);
478            }
479    
480            public static void unsetUserPermissions(long userId,
481                    java.lang.String[] actionIds, long resourceId)
482                    throws com.liferay.portal.kernel.exception.SystemException {
483                    getService().unsetUserPermissions(userId, actionIds, resourceId);
484            }
485    
486            public static PermissionLocalService getService() {
487                    if (_service == null) {
488                            _service = (PermissionLocalService)PortalBeanLocatorUtil.locate(PermissionLocalService.class.getName());
489    
490                            ReferenceRegistry.registerReference(PermissionLocalServiceUtil.class,
491                                    "_service");
492                            MethodCache.remove(PermissionLocalService.class);
493                    }
494    
495                    return _service;
496            }
497    
498            public void setService(PermissionLocalService service) {
499                    MethodCache.remove(PermissionLocalService.class);
500    
501                    _service = service;
502    
503                    ReferenceRegistry.registerReference(PermissionLocalServiceUtil.class,
504                            "_service");
505                    MethodCache.remove(PermissionLocalService.class);
506            }
507    
508            private static PermissionLocalService _service;
509    }