Liferay 6.1.2-ce-ga3

com.liferay.portal.service
Class ResourceLocalServiceUtil

java.lang.Object
  extended by com.liferay.portal.service.ResourceLocalServiceUtil

public class ResourceLocalServiceUtil
extends Object

The utility for the resource local service. This utility wraps com.liferay.portal.service.impl.ResourceLocalServiceImpl and is the primary access point for service operations in application layer code running on the local server.

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.

See Also:
ResourceLocalService, ResourceLocalServiceBaseImpl, com.liferay.portal.service.impl.ResourceLocalServiceImpl

Constructor Summary
ResourceLocalServiceUtil()
           
 
Method Summary
static void addModelResources(AuditedModel auditedModel, ServiceContext serviceContext)
          Adds resources for the model, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.
static void addModelResources(long companyId, long groupId, long userId, String name, long primKey, String[] groupPermissions, String[] guestPermissions)
          Adds resources for the model with the name and primary key, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.
static void addModelResources(long companyId, long groupId, long userId, String name, String primKey, String[] groupPermissions, String[] guestPermissions)
          Adds resources for the model with the name and primary key string, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.
static Resource addResource(long companyId, String name, int scope, String primKey)
           
static Resource addResource(Resource resource)
          Adds the resource to the database.
static void addResources(long companyId, long groupId, long userId, String name, long primKey, boolean portletActions, boolean addGroupPermissions, boolean addGuestPermissions)
          Adds resources for the entity with the name and primary key, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.
static void addResources(long companyId, long groupId, long userId, String name, String primKey, boolean portletActions, boolean addGroupPermissions, boolean addGuestPermissions)
          Adds resources for the entity with the name and primary key string, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.
static void addResources(long companyId, long groupId, String name, boolean portletActions)
          Adds resources for the entity with the name.
static Resource createResource(long resourceId)
          Creates a new resource with the primary key.
static void deleteResource(AuditedModel auditedModel, int scope)
          Deletes the resource associated with the model at the scope.
static Resource deleteResource(long resourceId)
          Deletes the resource with the primary key from the database.
static void deleteResource(long companyId, String name, int scope, long primKey)
          Deletes the resource matching the primary key at the scope.
static void deleteResource(long companyId, String name, int scope, String primKey)
          Deletes the resource matching the primary key at the scope.
static Resource deleteResource(Resource resource)
          Deletes the resource from the database.
static void deleteResources(String name)
           
static DynamicQuery dynamicQuery()
           
static List dynamicQuery(DynamicQuery dynamicQuery)
          Performs a dynamic query on the database and returns the matching rows.
static List dynamicQuery(DynamicQuery dynamicQuery, int start, int end)
          Performs a dynamic query on the database and returns a range of the matching rows.
static List dynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator orderByComparator)
          Performs a dynamic query on the database and returns an ordered range of the matching rows.
static long dynamicQueryCount(DynamicQuery dynamicQuery)
          Returns the number of rows that match the dynamic query.
static Resource fetchResource(long resourceId)
           
static Resource fetchResource(long companyId, String name, int scope, String primKey)
           
static String getBeanIdentifier()
          Returns the Spring bean ID for this bean.
static long getLatestResourceId()
           
static PersistedModel getPersistedModel(Serializable primaryKeyObj)
           
static Resource getResource(long resourceId)
          Returns the resource with the primary key.
static Resource getResource(long companyId, String name, int scope, String primKey)
          Returns a new resource with the name and primary key at the scope.
static List<Resource> getResources()
           
static List<Resource> getResources(int start, int end)
          Returns a range of all the resources.
static int getResourcesCount()
          Returns the number of resources.
static ResourceLocalService getService()
           
static void setBeanIdentifier(String beanIdentifier)
          Sets the Spring bean ID for this bean.
 void setService(ResourceLocalService service)
          Deprecated.  
static void updateModelResources(AuditedModel auditedModel, ServiceContext serviceContext)
          Updates the resources for the model, replacing their group and guest permissions with new ones from the service context.
static Resource updateResource(Resource resource)
          Updates the resource in the database or adds it if it does not yet exist.
static Resource updateResource(Resource resource, boolean merge)
          Updates the resource in the database or adds it if it does not yet exist.
static void updateResources(long companyId, long groupId, String name, long primKey, String[] groupPermissions, String[] guestPermissions)
          Updates resources matching the group, name, and primary key at the individual scope, setting new group and guest permissions.
static void updateResources(long companyId, long groupId, String name, String primKey, String[] groupPermissions, String[] guestPermissions)
          Updates resources matching the group, name, and primary key string at the individual scope, setting new group and guest permissions.
static void updateResources(long companyId, String name, int scope, String primKey, String newPrimKey)
          Updates resources matching the name, primary key string and scope, replacing the primary key of their resource permissions with the new primary key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceLocalServiceUtil

public ResourceLocalServiceUtil()
Method Detail

addResource

public static Resource addResource(Resource resource)
                            throws SystemException
Adds the resource to the database. Also notifies the appropriate model listeners.

Parameters:
resource - the resource
Returns:
the resource that was added
Throws:
SystemException - if a system exception occurred

createResource

public static Resource createResource(long resourceId)
Creates a new resource with the primary key. Does not add the resource to the database.

Parameters:
resourceId - the primary key for the new resource
Returns:
the new resource

deleteResource

public static Resource deleteResource(long resourceId)
                               throws PortalException,
                                      SystemException
Deletes the resource with the primary key from the database. Also notifies the appropriate model listeners.

Parameters:
resourceId - the primary key of the resource
Returns:
the resource that was removed
Throws:
PortalException - if a resource with the primary key could not be found
SystemException - if a system exception occurred

deleteResource

public static Resource deleteResource(Resource resource)
                               throws SystemException
Deletes the resource from the database. Also notifies the appropriate model listeners.

Parameters:
resource - the resource
Returns:
the resource that was removed
Throws:
SystemException - if a system exception occurred

dynamicQuery

public static DynamicQuery dynamicQuery()

dynamicQuery

public static List dynamicQuery(DynamicQuery dynamicQuery)
                         throws SystemException
Performs a dynamic query on the database and returns the matching rows.

Parameters:
dynamicQuery - the dynamic query
Returns:
the matching rows
Throws:
SystemException - if a system exception occurred

dynamicQuery

public static List dynamicQuery(DynamicQuery dynamicQuery,
                                int start,
                                int end)
                         throws SystemException
Performs a dynamic query on the database and returns a range of the matching rows.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
dynamicQuery - the dynamic query
start - the lower bound of the range of model instances
end - the upper bound of the range of model instances (not inclusive)
Returns:
the range of matching rows
Throws:
SystemException - if a system exception occurred

dynamicQuery

public static List dynamicQuery(DynamicQuery dynamicQuery,
                                int start,
                                int end,
                                OrderByComparator orderByComparator)
                         throws SystemException
Performs a dynamic query on the database and returns an ordered range of the matching rows.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
dynamicQuery - the dynamic query
start - the lower bound of the range of model instances
end - the upper bound of the range of model instances (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of matching rows
Throws:
SystemException - if a system exception occurred

dynamicQueryCount

public static long dynamicQueryCount(DynamicQuery dynamicQuery)
                              throws SystemException
Returns the number of rows that match the dynamic query.

Parameters:
dynamicQuery - the dynamic query
Returns:
the number of rows that match the dynamic query
Throws:
SystemException - if a system exception occurred

fetchResource

public static Resource fetchResource(long resourceId)
                              throws SystemException
Throws:
SystemException

getResource

public static Resource getResource(long resourceId)
                            throws PortalException,
                                   SystemException
Returns the resource with the primary key.

Parameters:
resourceId - the primary key of the resource
Returns:
the resource
Throws:
PortalException - if a resource with the primary key could not be found
SystemException - if a system exception occurred

getPersistedModel

public static PersistedModel getPersistedModel(Serializable primaryKeyObj)
                                        throws PortalException,
                                               SystemException
Throws:
PortalException
SystemException

getResources

public static List<Resource> getResources(int start,
                                          int end)
                                   throws SystemException
Returns a range of all the resources.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
start - the lower bound of the range of resources
end - the upper bound of the range of resources (not inclusive)
Returns:
the range of resources
Throws:
SystemException - if a system exception occurred

getResourcesCount

public static int getResourcesCount()
                             throws SystemException
Returns the number of resources.

Returns:
the number of resources
Throws:
SystemException - if a system exception occurred

updateResource

public static Resource updateResource(Resource resource)
                               throws SystemException
Updates the resource in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.

Parameters:
resource - the resource
Returns:
the resource that was updated
Throws:
SystemException - if a system exception occurred

updateResource

public static Resource updateResource(Resource resource,
                                      boolean merge)
                               throws SystemException
Updates the resource in the database or adds it if it does not yet exist. Also notifies the appropriate model listeners.

Parameters:
resource - the resource
merge - whether to merge the resource with the current session. See BatchSession.update(com.liferay.portal.kernel.dao.orm.Session, com.liferay.portal.model.BaseModel, boolean) for an explanation.
Returns:
the resource that was updated
Throws:
SystemException - if a system exception occurred

getBeanIdentifier

public static String getBeanIdentifier()
Returns the Spring bean ID for this bean.

Returns:
the Spring bean ID for this bean

setBeanIdentifier

public static void setBeanIdentifier(String beanIdentifier)
Sets the Spring bean ID for this bean.

Parameters:
beanIdentifier - the Spring bean ID for this bean

addModelResources

public static void addModelResources(AuditedModel auditedModel,
                                     ServiceContext serviceContext)
                              throws PortalException,
                                     SystemException
Adds resources for the model, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.
  1. If the service context specifies that default group or default guest permissions are to be added, then only default permissions are added. See ServiceContext.setAddGroupPermissions( boolean) and ServiceContext.setAddGuestPermissions( boolean).
  2. Else ...
    1. If the service context specifies to derive default permissions, then default group and guest permissions are derived from the model and added. See ServiceContext.setDeriveDefaultPermissions( boolean).
    2. Lastly group and guest permissions from the service context are applied. See ServiceContext.setGroupPermissions(String[]) and com.liferay.portal.service.ServiceContext#setGuesPermissions(String[]).

Parameters:
auditedModel - the model to associate with the resources
serviceContext - the service context to apply. Can set whether to add the model's default group and guest permissions, set whether to derive default group and guest permissions from the model, set group permissions to apply, and set guest permissions to apply.
Throws:
PortalException - if no portal actions could be found associated with the model or if a portal exception occurred
SystemException - if a system exception occurred

addModelResources

public static void addModelResources(long companyId,
                                     long groupId,
                                     long userId,
                                     String name,
                                     long primKey,
                                     String[] groupPermissions,
                                     String[] guestPermissions)
                              throws PortalException,
                                     SystemException
Adds resources for the model with the name and primary key, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.

Parameters:
companyId - the primary key of the portal instance
groupId - the primary key of the group
userId - the primary key of the user adding the resources
name - a name for the resource, typically the model's class name
primKey - the primary key of the model instance, optionally 0 if no instance exists
groupPermissions - the group permissions to be applied
guestPermissions - the guest permissions to be applied
Throws:
PortalException - if no portal actions could be found associated with the model or if a portal exception occurred
SystemException - if a system exception occurred

addModelResources

public static void addModelResources(long companyId,
                                     long groupId,
                                     long userId,
                                     String name,
                                     String primKey,
                                     String[] groupPermissions,
                                     String[] guestPermissions)
                              throws PortalException,
                                     SystemException
Adds resources for the model with the name and primary key string, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.

Parameters:
companyId - the primary key of the portal instance
groupId - the primary key of the group
userId - the primary key of the user adding the resources
name - a name for the resource, typically the model's class name
primKey - the primary key string of the model instance, optionally an empty string if no instance exists
groupPermissions - the group permissions to be applied
guestPermissions - the guest permissions to be applied
Throws:
PortalException - if no portal actions could be found associated with the model or if a portal exception occurred
SystemException - if a system exception occurred

addResource

public static Resource addResource(long companyId,
                                   String name,
                                   int scope,
                                   String primKey)
                            throws SystemException
Throws:
SystemException

addResources

public static void addResources(long companyId,
                                long groupId,
                                long userId,
                                String name,
                                long primKey,
                                boolean portletActions,
                                boolean addGroupPermissions,
                                boolean addGuestPermissions)
                         throws PortalException,
                                SystemException
Adds resources for the entity with the name and primary key, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.

Parameters:
companyId - the primary key of the portal instance
groupId - the primary key of the group
userId - the primary key of the user adding the resources
name - a name for the resource, which should be a portlet ID if the resource is a portlet or the resource's class name otherwise
primKey - the primary key of the resource instance, optionally 0 if no instance exists
portletActions - whether to associate portlet actions with the resource
addGroupPermissions - whether to add group permissions
addGuestPermissions - whether to add guest permissions
Throws:
PortalException - if no portal actions could be found associated with the resource or if a portal exception occurred
SystemException - if a system exception occurred

addResources

public static void addResources(long companyId,
                                long groupId,
                                long userId,
                                String name,
                                String primKey,
                                boolean portletActions,
                                boolean addGroupPermissions,
                                boolean addGuestPermissions)
                         throws PortalException,
                                SystemException
Adds resources for the entity with the name and primary key string, always creating a resource at the individual scope and only creating resources at the group, group template, and company scope if such resources don't already exist.

Parameters:
companyId - the primary key of the portal instance
groupId - the primary key of the group
userId - the primary key of the user adding the resources
name - a name for the resource, which should be a portlet ID if the resource is a portlet or the resource's class name otherwise
primKey - the primary key string of the resource instance, optionally an empty string if no instance exists
portletActions - whether to associate portlet actions with the resource
addGroupPermissions - whether to add group permissions
addGuestPermissions - whether to add guest permissions
Throws:
PortalException - if no portal actions could be found associated with the resource or if a portal exception occurred
SystemException - if a system exception occurred

addResources

public static void addResources(long companyId,
                                long groupId,
                                String name,
                                boolean portletActions)
                         throws PortalException,
                                SystemException
Adds resources for the entity with the name. Use this method if the user is unknown or irrelevant and there is no current entity instance.

Parameters:
companyId - the primary key of the portal instance
groupId - the primary key of the group
name - a name for the resource, which should be a portlet ID if the resource is a portlet or the resource's class name otherwise
portletActions - whether to associate portlet actions with the resource
Throws:
PortalException - if no portal actions could be found associated with the resource or if a portal exception occurred
SystemException - if a system exception occurred

deleteResource

public static void deleteResource(AuditedModel auditedModel,
                                  int scope)
                           throws PortalException,
                                  SystemException
Deletes the resource associated with the model at the scope.

Parameters:
auditedModel - the model associated with the resource
scope - the scope of the resource. For more information see ResourceConstants.
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

deleteResource

public static void deleteResource(long companyId,
                                  String name,
                                  int scope,
                                  long primKey)
                           throws PortalException,
                                  SystemException
Deletes the resource matching the primary key at the scope.

Parameters:
companyId - the primary key of the portal instance
name - the resource's name, which should be a portlet ID if the resource is a portlet or the resource's class name otherwise
scope - the scope of the resource. For more information see ResourceConstants.
primKey - the primary key of the resource instance
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

deleteResource

public static void deleteResource(long companyId,
                                  String name,
                                  int scope,
                                  String primKey)
                           throws PortalException,
                                  SystemException
Deletes the resource matching the primary key at the scope.

Parameters:
companyId - the primary key of the portal instance
name - the resource's name, which should be a portlet ID if the resource is a portlet or the resource's class name otherwise
scope - the scope of the resource. For more information see ResourceConstants.
primKey - the primary key string of the resource instance
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

deleteResources

public static void deleteResources(String name)
                            throws SystemException
Throws:
SystemException

fetchResource

public static Resource fetchResource(long companyId,
                                     String name,
                                     int scope,
                                     String primKey)
                              throws SystemException
Throws:
SystemException

getLatestResourceId

public static long getLatestResourceId()
                                throws SystemException
Throws:
SystemException

getResource

public static Resource getResource(long companyId,
                                   String name,
                                   int scope,
                                   String primKey)
                            throws PortalException,
                                   SystemException
Returns a new resource with the name and primary key at the scope.

Parameters:
companyId - the primary key of the portal instance
name - a name for the resource, which should be a portlet ID if the resource is a portlet or the resource's class name otherwise
scope - the scope of the resource. For more information see ResourceConstants.
primKey - the primary key string of the resource
Returns:
the new resource
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

getResources

public static List<Resource> getResources()
                                   throws SystemException
Throws:
SystemException

updateModelResources

public static void updateModelResources(AuditedModel auditedModel,
                                        ServiceContext serviceContext)
                                 throws PortalException,
                                        SystemException
Updates the resources for the model, replacing their group and guest permissions with new ones from the service context.

Parameters:
auditedModel - the model associated with the resources
serviceContext - the service context to be applied. Can set group and guest permissions.
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

updateResources

public static void updateResources(long companyId,
                                   long groupId,
                                   String name,
                                   long primKey,
                                   String[] groupPermissions,
                                   String[] guestPermissions)
                            throws PortalException,
                                   SystemException
Updates resources matching the group, name, and primary key at the individual scope, setting new group and guest permissions.

Parameters:
companyId - the primary key of the portal instance
groupId - the primary key of the group
name - the resource's name, which should be a portlet ID if the resource is a portlet or the resource's class name otherwise
primKey - the primary key of the resource instance
groupPermissions - the group permissions to be applied
guestPermissions - the guest permissions to be applied
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

updateResources

public static void updateResources(long companyId,
                                   long groupId,
                                   String name,
                                   String primKey,
                                   String[] groupPermissions,
                                   String[] guestPermissions)
                            throws PortalException,
                                   SystemException
Updates resources matching the group, name, and primary key string at the individual scope, setting new group and guest permissions.

Parameters:
companyId - the primary key of the portal instance
groupId - the primary key of the group
name - the resource's name, which should be a portlet ID if the resource is a portlet or the resource's class name otherwise
primKey - the primary key string of the resource instance
groupPermissions - the group permissions to be applied
guestPermissions - the guest permissions to be applied
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

updateResources

public static void updateResources(long companyId,
                                   String name,
                                   int scope,
                                   String primKey,
                                   String newPrimKey)
                            throws PortalException,
                                   SystemException
Updates resources matching the name, primary key string and scope, replacing the primary key of their resource permissions with the new primary key.

Parameters:
companyId - the primary key of the portal instance
name - the resource's name, which should be a portlet ID if the resource is a portlet or the resource's class name otherwise
scope - the scope of the resource. For more information see ResourceConstants.
primKey - the primary key string of the resource instance
newPrimKey - the new primary key string of the resource
Throws:
PortalException - if a portal exception occurred
SystemException - if a system exception occurred

getService

public static ResourceLocalService getService()

setService

public void setService(ResourceLocalService service)
Deprecated. 


Liferay 6.1.2-ce-ga3