001    /**
002     * Copyright (c) 2000-2010 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    
019    /**
020     * 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.
021     *
022     * <p>
023     * Never modify this class directly. Add custom service methods to {@link com.liferay.portal.service.impl.PermissionLocalServiceImpl} and rerun ServiceBuilder to regenerate this class.
024     * </p>
025     *
026     * <p>
027     * 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.
028     * </p>
029     *
030     * @author Brian Wing Shun Chan
031     * @see PermissionLocalService
032     * @see com.liferay.portal.service.base.PermissionLocalServiceBaseImpl
033     * @see com.liferay.portal.service.impl.PermissionLocalServiceImpl
034     * @generated
035     */
036    public class PermissionLocalServiceUtil {
037            /**
038            * Adds the permission to the database. Also notifies the appropriate model listeners.
039            *
040            * @param permission the permission to add
041            * @return the permission that was added
042            * @throws SystemException if a system exception occurred
043            */
044            public static com.liferay.portal.model.Permission addPermission(
045                    com.liferay.portal.model.Permission permission)
046                    throws com.liferay.portal.kernel.exception.SystemException {
047                    return getService().addPermission(permission);
048            }
049    
050            /**
051            * Creates a new permission with the primary key. Does not add the permission to the database.
052            *
053            * @param permissionId the primary key for the new permission
054            * @return the new permission
055            */
056            public static com.liferay.portal.model.Permission createPermission(
057                    long permissionId) {
058                    return getService().createPermission(permissionId);
059            }
060    
061            /**
062            * Deletes the permission with the primary key from the database. Also notifies the appropriate model listeners.
063            *
064            * @param permissionId the primary key of the permission to delete
065            * @throws PortalException if a permission with the primary key could not be found
066            * @throws SystemException if a system exception occurred
067            */
068            public static void deletePermission(long permissionId)
069                    throws com.liferay.portal.kernel.exception.PortalException,
070                            com.liferay.portal.kernel.exception.SystemException {
071                    getService().deletePermission(permissionId);
072            }
073    
074            /**
075            * Deletes the permission from the database. Also notifies the appropriate model listeners.
076            *
077            * @param permission the permission to delete
078            * @throws SystemException if a system exception occurred
079            */
080            public static void deletePermission(
081                    com.liferay.portal.model.Permission permission)
082                    throws com.liferay.portal.kernel.exception.SystemException {
083                    getService().deletePermission(permission);
084            }
085    
086            /**
087            * Performs a dynamic query on the database and returns the matching rows.
088            *
089            * @param dynamicQuery the dynamic query to search with
090            * @return the matching rows
091            * @throws SystemException if a system exception occurred
092            */
093            @SuppressWarnings("rawtypes")
094            public static java.util.List dynamicQuery(
095                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
096                    throws com.liferay.portal.kernel.exception.SystemException {
097                    return getService().dynamicQuery(dynamicQuery);
098            }
099    
100            /**
101            * Performs a dynamic query on the database and returns a range of the matching rows.
102            *
103            * <p>
104            * 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.
105            * </p>
106            *
107            * @param dynamicQuery the dynamic query to search with
108            * @param start the lower bound of the range of model instances to return
109            * @param end the upper bound of the range of model instances to return (not inclusive)
110            * @return the range of matching rows
111            * @throws SystemException if a system exception occurred
112            */
113            @SuppressWarnings("rawtypes")
114            public static java.util.List dynamicQuery(
115                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
116                    int end) throws com.liferay.portal.kernel.exception.SystemException {
117                    return getService().dynamicQuery(dynamicQuery, start, end);
118            }
119    
120            /**
121            * Performs a dynamic query on the database and returns an ordered range of the matching rows.
122            *
123            * <p>
124            * 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.
125            * </p>
126            *
127            * @param dynamicQuery the dynamic query to search with
128            * @param start the lower bound of the range of model instances to return
129            * @param end the upper bound of the range of model instances to return (not inclusive)
130            * @param orderByComparator the comparator to order the results by
131            * @return the ordered range of matching rows
132            * @throws SystemException if a system exception occurred
133            */
134            @SuppressWarnings("rawtypes")
135            public static java.util.List dynamicQuery(
136                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start,
137                    int end,
138                    com.liferay.portal.kernel.util.OrderByComparator orderByComparator)
139                    throws com.liferay.portal.kernel.exception.SystemException {
140                    return getService()
141                                       .dynamicQuery(dynamicQuery, start, end, orderByComparator);
142            }
143    
144            /**
145            * Counts the number of rows that match the dynamic query.
146            *
147            * @param dynamicQuery the dynamic query to search with
148            * @return the number of rows that match the dynamic query
149            * @throws SystemException if a system exception occurred
150            */
151            public static long dynamicQueryCount(
152                    com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
153                    throws com.liferay.portal.kernel.exception.SystemException {
154                    return getService().dynamicQueryCount(dynamicQuery);
155            }
156    
157            /**
158            * Gets the permission with the primary key.
159            *
160            * @param permissionId the primary key of the permission to get
161            * @return the permission
162            * @throws PortalException if a permission with the primary key could not be found
163            * @throws SystemException if a system exception occurred
164            */
165            public static com.liferay.portal.model.Permission getPermission(
166                    long permissionId)
167                    throws com.liferay.portal.kernel.exception.PortalException,
168                            com.liferay.portal.kernel.exception.SystemException {
169                    return getService().getPermission(permissionId);
170            }
171    
172            /**
173            * Gets a range of all the permissions.
174            *
175            * <p>
176            * 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.
177            * </p>
178            *
179            * @param start the lower bound of the range of permissions to return
180            * @param end the upper bound of the range of permissions to return (not inclusive)
181            * @return the range of permissions
182            * @throws SystemException if a system exception occurred
183            */
184            public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
185                    int start, int end)
186                    throws com.liferay.portal.kernel.exception.SystemException {
187                    return getService().getPermissions(start, end);
188            }
189    
190            /**
191            * Gets the number of permissions.
192            *
193            * @return the number of permissions
194            * @throws SystemException if a system exception occurred
195            */
196            public static int getPermissionsCount()
197                    throws com.liferay.portal.kernel.exception.SystemException {
198                    return getService().getPermissionsCount();
199            }
200    
201            /**
202            * Updates the permission in the database. Also notifies the appropriate model listeners.
203            *
204            * @param permission the permission to update
205            * @return the permission that was updated
206            * @throws SystemException if a system exception occurred
207            */
208            public static com.liferay.portal.model.Permission updatePermission(
209                    com.liferay.portal.model.Permission permission)
210                    throws com.liferay.portal.kernel.exception.SystemException {
211                    return getService().updatePermission(permission);
212            }
213    
214            /**
215            * Updates the permission in the database. Also notifies the appropriate model listeners.
216            *
217            * @param permission the permission to update
218            * @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.
219            * @return the permission that was updated
220            * @throws SystemException if a system exception occurred
221            */
222            public static com.liferay.portal.model.Permission updatePermission(
223                    com.liferay.portal.model.Permission permission, boolean merge)
224                    throws com.liferay.portal.kernel.exception.SystemException {
225                    return getService().updatePermission(permission, merge);
226            }
227    
228            public static com.liferay.portal.model.Permission addPermission(
229                    long companyId, java.lang.String actionId, long resourceId)
230                    throws com.liferay.portal.kernel.exception.SystemException {
231                    return getService().addPermission(companyId, actionId, resourceId);
232            }
233    
234            public static java.util.List<com.liferay.portal.model.Permission> addPermissions(
235                    long companyId, java.lang.String name, long resourceId,
236                    boolean portletActions)
237                    throws com.liferay.portal.kernel.exception.SystemException {
238                    return getService()
239                                       .addPermissions(companyId, name, resourceId, portletActions);
240            }
241    
242            public static java.util.List<com.liferay.portal.model.Permission> addPermissions(
243                    long companyId, java.util.List<java.lang.String> actionIds,
244                    long resourceId)
245                    throws com.liferay.portal.kernel.exception.SystemException {
246                    return getService().addPermissions(companyId, actionIds, resourceId);
247            }
248    
249            public static void addUserPermissions(long userId,
250                    java.lang.String[] actionIds, long resourceId)
251                    throws com.liferay.portal.kernel.exception.PortalException,
252                            com.liferay.portal.kernel.exception.SystemException {
253                    getService().addUserPermissions(userId, actionIds, resourceId);
254            }
255    
256            public static java.util.List<java.lang.String> getActions(
257                    java.util.List<com.liferay.portal.model.Permission> permissions) {
258                    return getService().getActions(permissions);
259            }
260    
261            public static java.util.List<com.liferay.portal.model.Permission> getGroupPermissions(
262                    long groupId, long resourceId)
263                    throws com.liferay.portal.kernel.exception.SystemException {
264                    return getService().getGroupPermissions(groupId, resourceId);
265            }
266    
267            public static java.util.List<com.liferay.portal.model.Permission> getGroupPermissions(
268                    long groupId, long companyId, java.lang.String name, int scope,
269                    java.lang.String primKey)
270                    throws com.liferay.portal.kernel.exception.SystemException {
271                    return getService()
272                                       .getGroupPermissions(groupId, companyId, name, scope, primKey);
273            }
274    
275            public static java.util.List<com.liferay.portal.model.Permission> getOrgGroupPermissions(
276                    long organizationId, long groupId, long resourceId)
277                    throws com.liferay.portal.kernel.exception.SystemException {
278                    return getService()
279                                       .getOrgGroupPermissions(organizationId, groupId, resourceId);
280            }
281    
282            public static long getLatestPermissionId()
283                    throws com.liferay.portal.kernel.exception.SystemException {
284                    return getService().getLatestPermissionId();
285            }
286    
287            public static java.util.List<com.liferay.portal.model.Permission> getPermissions(
288                    long companyId, java.lang.String[] actionIds, long resourceId)
289                    throws com.liferay.portal.kernel.exception.SystemException {
290                    return getService().getPermissions(companyId, actionIds, resourceId);
291            }
292    
293            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
294                    long roleId) throws com.liferay.portal.kernel.exception.SystemException {
295                    return getService().getRolePermissions(roleId);
296            }
297    
298            public static java.util.List<com.liferay.portal.model.Permission> getRolePermissions(
299                    long roleId, long resourceId)
300                    throws com.liferay.portal.kernel.exception.SystemException {
301                    return getService().getRolePermissions(roleId, resourceId);
302            }
303    
304            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
305                    long userId, long resourceId)
306                    throws com.liferay.portal.kernel.exception.SystemException {
307                    return getService().getUserPermissions(userId, resourceId);
308            }
309    
310            public static java.util.List<com.liferay.portal.model.Permission> getUserPermissions(
311                    long userId, long companyId, java.lang.String name, int scope,
312                    java.lang.String primKey)
313                    throws com.liferay.portal.kernel.exception.SystemException {
314                    return getService()
315                                       .getUserPermissions(userId, companyId, name, scope, primKey);
316            }
317    
318            public static boolean hasGroupPermission(long groupId,
319                    java.lang.String actionId, long resourceId)
320                    throws com.liferay.portal.kernel.exception.SystemException {
321                    return getService().hasGroupPermission(groupId, actionId, resourceId);
322            }
323    
324            public static boolean hasRolePermission(long roleId, long companyId,
325                    java.lang.String name, int scope, java.lang.String actionId)
326                    throws com.liferay.portal.kernel.exception.SystemException {
327                    return getService()
328                                       .hasRolePermission(roleId, companyId, name, scope, actionId);
329            }
330    
331            public static boolean hasRolePermission(long roleId, long companyId,
332                    java.lang.String name, int scope, java.lang.String primKey,
333                    java.lang.String actionId)
334                    throws com.liferay.portal.kernel.exception.SystemException {
335                    return getService()
336                                       .hasRolePermission(roleId, companyId, name, scope, primKey,
337                            actionId);
338            }
339    
340            public static boolean hasUserPermission(long userId,
341                    java.lang.String actionId, long resourceId)
342                    throws com.liferay.portal.kernel.exception.SystemException {
343                    return getService().hasUserPermission(userId, actionId, resourceId);
344            }
345    
346            public static boolean hasUserPermissions(long userId, long groupId,
347                    java.util.List<com.liferay.portal.model.Resource> resources,
348                    java.lang.String actionId,
349                    com.liferay.portal.security.permission.PermissionCheckerBag permissionCheckerBag)
350                    throws com.liferay.portal.kernel.exception.PortalException,
351                            com.liferay.portal.kernel.exception.SystemException {
352                    return getService()
353                                       .hasUserPermissions(userId, groupId, resources, actionId,
354                            permissionCheckerBag);
355            }
356    
357            public static void setGroupPermissions(long groupId,
358                    java.lang.String[] actionIds, long resourceId)
359                    throws com.liferay.portal.kernel.exception.PortalException,
360                            com.liferay.portal.kernel.exception.SystemException {
361                    getService().setGroupPermissions(groupId, actionIds, resourceId);
362            }
363    
364            public static void setGroupPermissions(java.lang.String className,
365                    java.lang.String classPK, long groupId, java.lang.String[] actionIds,
366                    long resourceId)
367                    throws com.liferay.portal.kernel.exception.PortalException,
368                            com.liferay.portal.kernel.exception.SystemException {
369                    getService()
370                            .setGroupPermissions(className, classPK, groupId, actionIds,
371                            resourceId);
372            }
373    
374            public static void setOrgGroupPermissions(long organizationId,
375                    long groupId, java.lang.String[] actionIds, long resourceId)
376                    throws com.liferay.portal.kernel.exception.PortalException,
377                            com.liferay.portal.kernel.exception.SystemException {
378                    getService()
379                            .setOrgGroupPermissions(organizationId, groupId, actionIds,
380                            resourceId);
381            }
382    
383            public static void setRolePermission(long roleId, long companyId,
384                    java.lang.String name, int scope, java.lang.String primKey,
385                    java.lang.String actionId)
386                    throws com.liferay.portal.kernel.exception.PortalException,
387                            com.liferay.portal.kernel.exception.SystemException {
388                    getService()
389                            .setRolePermission(roleId, companyId, name, scope, primKey, actionId);
390            }
391    
392            public static void setRolePermissions(long roleId, long companyId,
393                    java.lang.String name, int scope, java.lang.String primKey,
394                    java.lang.String[] actionIds)
395                    throws com.liferay.portal.kernel.exception.PortalException,
396                            com.liferay.portal.kernel.exception.SystemException {
397                    getService()
398                            .setRolePermissions(roleId, companyId, name, scope, primKey,
399                            actionIds);
400            }
401    
402            public static void setRolePermissions(long roleId,
403                    java.lang.String[] actionIds, long resourceId)
404                    throws com.liferay.portal.kernel.exception.PortalException,
405                            com.liferay.portal.kernel.exception.SystemException {
406                    getService().setRolePermissions(roleId, actionIds, resourceId);
407            }
408    
409            public static void setUserPermissions(long userId,
410                    java.lang.String[] actionIds, long resourceId)
411                    throws com.liferay.portal.kernel.exception.PortalException,
412                            com.liferay.portal.kernel.exception.SystemException {
413                    getService().setUserPermissions(userId, actionIds, resourceId);
414            }
415    
416            public static void unsetRolePermission(long roleId, long permissionId)
417                    throws com.liferay.portal.kernel.exception.SystemException {
418                    getService().unsetRolePermission(roleId, permissionId);
419            }
420    
421            public static void unsetRolePermission(long roleId, long companyId,
422                    java.lang.String name, int scope, java.lang.String primKey,
423                    java.lang.String actionId)
424                    throws com.liferay.portal.kernel.exception.SystemException {
425                    getService()
426                            .unsetRolePermission(roleId, companyId, name, scope, primKey,
427                            actionId);
428            }
429    
430            public static void unsetRolePermissions(long roleId, long companyId,
431                    java.lang.String name, int scope, java.lang.String actionId)
432                    throws com.liferay.portal.kernel.exception.SystemException {
433                    getService()
434                            .unsetRolePermissions(roleId, companyId, name, scope, actionId);
435            }
436    
437            public static void unsetUserPermissions(long userId,
438                    java.lang.String[] actionIds, long resourceId)
439                    throws com.liferay.portal.kernel.exception.SystemException {
440                    getService().unsetUserPermissions(userId, actionIds, resourceId);
441            }
442    
443            public static PermissionLocalService getService() {
444                    if (_service == null) {
445                            _service = (PermissionLocalService)PortalBeanLocatorUtil.locate(PermissionLocalService.class.getName());
446                    }
447    
448                    return _service;
449            }
450    
451            public void setService(PermissionLocalService service) {
452                    _service = service;
453            }
454    
455            private static PermissionLocalService _service;
456    }