Liferay 6.0.5

com.liferay.portal.service.persistence
Class ResourceUtil

java.lang.Object
  extended by com.liferay.portal.service.persistence.ResourceUtil

public class ResourceUtil
extends Object

The persistence utility for the resource service. This utility wraps ResourcePersistenceImpl and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.

Never modify this class directly. Modify service.xml and rerun ServiceBuilder to regenerate this class.

Caching information and settings can be found in portal.properties

See Also:
ResourcePersistence, ResourcePersistenceImpl
ServiceBuilder generated this class. Modifications in this class will be overwritten the next time is generated.

Constructor Summary
ResourceUtil()
           
 
Method Summary
static void cacheResult(List<Resource> resources)
          Caches the resources in the entity cache if it is enabled.
static void cacheResult(Resource resource)
          Caches the resource in the entity cache if it is enabled.
static void clearCache()
           
static void clearCache(Resource resource)
           
static int countAll()
          Counts all the resources.
static int countByC_P(long codeId, String primKey)
          Counts all the resources where codeId = ? and primKey = ?.
static int countByCodeId(long codeId)
          Counts all the resources where codeId = ?.
 long countWithDynamicQuery(DynamicQuery dynamicQuery)
           
static Resource create(long resourceId)
          Creates a new resource with the primary key.
static Resource fetchByC_P(long codeId, String primKey)
          Finds the resource where codeId = ? and primKey = ? or returns null if it could not be found.
static Resource fetchByC_P(long codeId, String primKey, boolean retrieveFromCache)
          Finds the resource where codeId = ? and primKey = ? or returns null if it could not be found, optionally using the finder cache.
static Resource fetchByPrimaryKey(long resourceId)
          Finds the resource with the primary key or returns null if it could not be found.
static List<Resource> findAll()
          Finds all the resources.
static List<Resource> findAll(int start, int end)
          Finds a range of all the resources.
static List<Resource> findAll(int start, int end, OrderByComparator orderByComparator)
          Finds an ordered range of all the resources.
static Resource findByC_P(long codeId, String primKey)
          Finds the resource where codeId = ? and primKey = ? or throws a NoSuchResourceException if it could not be found.
static Resource findByCodeId_First(long codeId, OrderByComparator orderByComparator)
          Finds the first resource in the ordered set where codeId = ?.
static Resource findByCodeId_Last(long codeId, OrderByComparator orderByComparator)
          Finds the last resource in the ordered set where codeId = ?.
static Resource[] findByCodeId_PrevAndNext(long resourceId, long codeId, OrderByComparator orderByComparator)
          Finds the resources before and after the current resource in the ordered set where codeId = ?.
static List<Resource> findByCodeId(long codeId)
          Finds all the resources where codeId = ?.
static List<Resource> findByCodeId(long codeId, int start, int end)
          Finds a range of all the resources where codeId = ?.
static List<Resource> findByCodeId(long codeId, int start, int end, OrderByComparator orderByComparator)
          Finds an ordered range of all the resources where codeId = ?.
static Resource findByPrimaryKey(long resourceId)
          Finds the resource with the primary key or throws a NoSuchResourceException if it could not be found.
static List<Resource> findWithDynamicQuery(DynamicQuery dynamicQuery)
           
static List<Resource> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end)
           
static List<Resource> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator orderByComparator)
           
static ResourcePersistence getPersistence()
           
static Resource remove(long resourceId)
          Removes the resource with the primary key from the database.
static Resource remove(Resource resource)
           
static void removeAll()
          Removes all the resources from the database.
static void removeByC_P(long codeId, String primKey)
          Removes the resource where codeId = ? and primKey = ? from the database.
static void removeByCodeId(long codeId)
          Removes all the resources where codeId = ? from the database.
 void setPersistence(ResourcePersistence persistence)
           
static Resource update(Resource resource, boolean merge)
           
static Resource update(Resource resource, boolean merge, ServiceContext serviceContext)
           
static Resource updateImpl(Resource resource, boolean merge)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceUtil

public ResourceUtil()
Method Detail

clearCache

public static void clearCache()
See Also:
BasePersistence.clearCache()

clearCache

public static void clearCache(Resource resource)
See Also:
BasePersistence.clearCache(com.liferay.portal.model.BaseModel)

countWithDynamicQuery

public long countWithDynamicQuery(DynamicQuery dynamicQuery)
                           throws SystemException
Throws:
SystemException
See Also:
BasePersistence.countWithDynamicQuery(DynamicQuery)

findWithDynamicQuery

public static List<Resource> findWithDynamicQuery(DynamicQuery dynamicQuery)
                                           throws SystemException
Throws:
SystemException
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery)

findWithDynamicQuery

public static List<Resource> findWithDynamicQuery(DynamicQuery dynamicQuery,
                                                  int start,
                                                  int end)
                                           throws SystemException
Throws:
SystemException
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery, int, int)

findWithDynamicQuery

public static List<Resource> findWithDynamicQuery(DynamicQuery dynamicQuery,
                                                  int start,
                                                  int end,
                                                  OrderByComparator orderByComparator)
                                           throws SystemException
Throws:
SystemException
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)

remove

public static Resource remove(Resource resource)
                       throws SystemException
Throws:
SystemException
See Also:
BasePersistence.remove(com.liferay.portal.model.BaseModel)

update

public static Resource update(Resource resource,
                              boolean merge)
                       throws SystemException
Throws:
SystemException
See Also:
BasePersistence.update(com.liferay.portal.model.BaseModel, boolean)

update

public static Resource update(Resource resource,
                              boolean merge,
                              ServiceContext serviceContext)
                       throws SystemException
Throws:
SystemException
See Also:
BasePersistence.update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)

cacheResult

public static void cacheResult(Resource resource)
Caches the resource in the entity cache if it is enabled.

Parameters:
resource - the resource to cache

cacheResult

public static void cacheResult(List<Resource> resources)
Caches the resources in the entity cache if it is enabled.

Parameters:
resources - the resources to cache

create

public static Resource create(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

remove

public static Resource remove(long resourceId)
                       throws NoSuchResourceException,
                              SystemException
Removes the resource with the primary key from the database. Also notifies the appropriate model listeners.

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

updateImpl

public static Resource updateImpl(Resource resource,
                                  boolean merge)
                           throws SystemException
Throws:
SystemException

findByPrimaryKey

public static Resource findByPrimaryKey(long resourceId)
                                 throws NoSuchResourceException,
                                        SystemException
Finds the resource with the primary key or throws a NoSuchResourceException if it could not be found.

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

fetchByPrimaryKey

public static Resource fetchByPrimaryKey(long resourceId)
                                  throws SystemException
Finds the resource with the primary key or returns null if it could not be found.

Parameters:
resourceId - the primary key of the resource to find
Returns:
the resource, or null if a resource with the primary key could not be found
Throws:
SystemException - if a system exception occurred

findByCodeId

public static List<Resource> findByCodeId(long codeId)
                                   throws SystemException
Finds all the resources where codeId = ?.

Parameters:
codeId - the code id to search with
Returns:
the matching resources
Throws:
SystemException - if a system exception occurred

findByCodeId

public static List<Resource> findByCodeId(long codeId,
                                          int start,
                                          int end)
                                   throws SystemException
Finds a range of all the resources where codeId = ?.

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:
codeId - the code id to search with
start - the lower bound of the range of resources to return
end - the upper bound of the range of resources to return (not inclusive)
Returns:
the range of matching resources
Throws:
SystemException - if a system exception occurred

findByCodeId

public static List<Resource> findByCodeId(long codeId,
                                          int start,
                                          int end,
                                          OrderByComparator orderByComparator)
                                   throws SystemException
Finds an ordered range of all the resources where codeId = ?.

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:
codeId - the code id to search with
start - the lower bound of the range of resources to return
end - the upper bound of the range of resources to return (not inclusive)
orderByComparator - the comparator to order the results by
Returns:
the ordered range of matching resources
Throws:
SystemException - if a system exception occurred

findByCodeId_First

public static Resource findByCodeId_First(long codeId,
                                          OrderByComparator orderByComparator)
                                   throws NoSuchResourceException,
                                          SystemException
Finds the first resource in the ordered set where codeId = ?.

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:
codeId - the code id to search with
orderByComparator - the comparator to order the set by
Returns:
the first matching resource
Throws:
NoSuchResourceException - if a matching resource could not be found
SystemException - if a system exception occurred

findByCodeId_Last

public static Resource findByCodeId_Last(long codeId,
                                         OrderByComparator orderByComparator)
                                  throws NoSuchResourceException,
                                         SystemException
Finds the last resource in the ordered set where codeId = ?.

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:
codeId - the code id to search with
orderByComparator - the comparator to order the set by
Returns:
the last matching resource
Throws:
NoSuchResourceException - if a matching resource could not be found
SystemException - if a system exception occurred

findByCodeId_PrevAndNext

public static Resource[] findByCodeId_PrevAndNext(long resourceId,
                                                  long codeId,
                                                  OrderByComparator orderByComparator)
                                           throws NoSuchResourceException,
                                                  SystemException
Finds the resources before and after the current resource in the ordered set where codeId = ?.

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:
resourceId - the primary key of the current resource
codeId - the code id to search with
orderByComparator - the comparator to order the set by
Returns:
the previous, current, and next resource
Throws:
NoSuchResourceException - if a resource with the primary key could not be found
SystemException - if a system exception occurred

findByC_P

public static Resource findByC_P(long codeId,
                                 String primKey)
                          throws NoSuchResourceException,
                                 SystemException
Finds the resource where codeId = ? and primKey = ? or throws a NoSuchResourceException if it could not be found.

Parameters:
codeId - the code id to search with
primKey - the prim key to search with
Returns:
the matching resource
Throws:
NoSuchResourceException - if a matching resource could not be found
SystemException - if a system exception occurred

fetchByC_P

public static Resource fetchByC_P(long codeId,
                                  String primKey)
                           throws SystemException
Finds the resource where codeId = ? and primKey = ? or returns null if it could not be found. Uses the finder cache.

Parameters:
codeId - the code id to search with
primKey - the prim key to search with
Returns:
the matching resource, or null if a matching resource could not be found
Throws:
SystemException - if a system exception occurred

fetchByC_P

public static Resource fetchByC_P(long codeId,
                                  String primKey,
                                  boolean retrieveFromCache)
                           throws SystemException
Finds the resource where codeId = ? and primKey = ? or returns null if it could not be found, optionally using the finder cache.

Parameters:
codeId - the code id to search with
primKey - the prim key to search with
Returns:
the matching resource, or null if a matching resource could not be found
Throws:
SystemException - if a system exception occurred

findAll

public static List<Resource> findAll()
                              throws SystemException
Finds all the resources.

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

findAll

public static List<Resource> findAll(int start,
                                     int end)
                              throws SystemException
Finds 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 to return
end - the upper bound of the range of resources to return (not inclusive)
Returns:
the range of resources
Throws:
SystemException - if a system exception occurred

findAll

public static List<Resource> findAll(int start,
                                     int end,
                                     OrderByComparator orderByComparator)
                              throws SystemException
Finds an ordered 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 to return
end - the upper bound of the range of resources to return (not inclusive)
orderByComparator - the comparator to order the results by
Returns:
the ordered range of resources
Throws:
SystemException - if a system exception occurred

removeByCodeId

public static void removeByCodeId(long codeId)
                           throws SystemException
Removes all the resources where codeId = ? from the database.

Parameters:
codeId - the code id to search with
Throws:
SystemException - if a system exception occurred

removeByC_P

public static void removeByC_P(long codeId,
                               String primKey)
                        throws NoSuchResourceException,
                               SystemException
Removes the resource where codeId = ? and primKey = ? from the database.

Parameters:
codeId - the code id to search with
primKey - the prim key to search with
Throws:
SystemException - if a system exception occurred
NoSuchResourceException

removeAll

public static void removeAll()
                      throws SystemException
Removes all the resources from the database.

Throws:
SystemException - if a system exception occurred

countByCodeId

public static int countByCodeId(long codeId)
                         throws SystemException
Counts all the resources where codeId = ?.

Parameters:
codeId - the code id to search with
Returns:
the number of matching resources
Throws:
SystemException - if a system exception occurred

countByC_P

public static int countByC_P(long codeId,
                             String primKey)
                      throws SystemException
Counts all the resources where codeId = ? and primKey = ?.

Parameters:
codeId - the code id to search with
primKey - the prim key to search with
Returns:
the number of matching resources
Throws:
SystemException - if a system exception occurred

countAll

public static int countAll()
                    throws SystemException
Counts all the resources.

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

getPersistence

public static ResourcePersistence getPersistence()

setPersistence

public void setPersistence(ResourcePersistence persistence)

Liferay 6.0.5