|
Liferay 6.1.2-ce-ga3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.liferay.portal.service.persistence.ResourceUtil
public class ResourceUtil
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.
Caching information and settings can be found in portal.properties
ResourcePersistence
,
ResourcePersistenceImpl
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()
Returns the number of resources. |
static int |
countByC_P(long codeId,
String primKey)
Returns the number of resources where codeId = ? and primKey = ?. |
static int |
countByCodeId(long codeId)
Returns the number of resources where codeId = ?. |
static int |
countByPrimKey(String primKey)
Returns the number of resources where primKey = ?. |
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)
Returns 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)
Returns the resource where codeId = ? and primKey = ? or returns null if it could not be found, optionally using the finder cache. |
static Resource |
fetchByCodeId_First(long codeId,
OrderByComparator orderByComparator)
Returns the first resource in the ordered set where codeId = ?. |
static Resource |
fetchByCodeId_Last(long codeId,
OrderByComparator orderByComparator)
Returns the last resource in the ordered set where codeId = ?. |
static Resource |
fetchByPrimaryKey(long resourceId)
Returns the resource with the primary key or returns null if it could not be found. |
static Resource |
fetchByPrimKey_First(String primKey,
OrderByComparator orderByComparator)
Returns the first resource in the ordered set where primKey = ?. |
static Resource |
fetchByPrimKey_Last(String primKey,
OrderByComparator orderByComparator)
Returns the last resource in the ordered set where primKey = ?. |
static List<Resource> |
findAll()
Returns all the resources. |
static List<Resource> |
findAll(int start,
int end)
Returns a range of all the resources. |
static List<Resource> |
findAll(int start,
int end,
OrderByComparator orderByComparator)
Returns an ordered range of all the resources. |
static Resource |
findByC_P(long codeId,
String primKey)
Returns the resource where codeId = ? and primKey = ? or throws a NoSuchResourceException if it could not be found. |
static Resource |
findByCodeId_First(long codeId,
OrderByComparator orderByComparator)
Returns the first resource in the ordered set where codeId = ?. |
static Resource |
findByCodeId_Last(long codeId,
OrderByComparator orderByComparator)
Returns the last resource in the ordered set where codeId = ?. |
static Resource[] |
findByCodeId_PrevAndNext(long resourceId,
long codeId,
OrderByComparator orderByComparator)
Returns the resources before and after the current resource in the ordered set where codeId = ?. |
static List<Resource> |
findByCodeId(long codeId)
Returns all the resources where codeId = ?. |
static List<Resource> |
findByCodeId(long codeId,
int start,
int end)
Returns a range of all the resources where codeId = ?. |
static List<Resource> |
findByCodeId(long codeId,
int start,
int end,
OrderByComparator orderByComparator)
Returns an ordered range of all the resources where codeId = ?. |
static Resource |
findByPrimaryKey(long resourceId)
Returns the resource with the primary key or throws a NoSuchResourceException if it could not be found. |
static Resource |
findByPrimKey_First(String primKey,
OrderByComparator orderByComparator)
Returns the first resource in the ordered set where primKey = ?. |
static Resource |
findByPrimKey_Last(String primKey,
OrderByComparator orderByComparator)
Returns the last resource in the ordered set where primKey = ?. |
static Resource[] |
findByPrimKey_PrevAndNext(long resourceId,
String primKey,
OrderByComparator orderByComparator)
Returns the resources before and after the current resource in the ordered set where primKey = ?. |
static List<Resource> |
findByPrimKey(String primKey)
Returns all the resources where primKey = ?. |
static List<Resource> |
findByPrimKey(String primKey,
int start,
int end)
Returns a range of all the resources where primKey = ?. |
static List<Resource> |
findByPrimKey(String primKey,
int start,
int end,
OrderByComparator orderByComparator)
Returns an ordered range of all the resources where primKey = ?. |
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 void |
removeAll()
Removes all the resources from the database. |
static Resource |
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. |
static void |
removeByPrimKey(String primKey)
Removes all the resources where primKey = ? from the database. |
void |
setPersistence(ResourcePersistence persistence)
Deprecated. |
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 |
---|
public ResourceUtil()
Method Detail |
---|
public static void clearCache()
BasePersistence.clearCache()
public static void clearCache(Resource resource)
BasePersistence.clearCache(com.liferay.portal.model.BaseModel)
public long countWithDynamicQuery(DynamicQuery dynamicQuery) throws SystemException
SystemException
BasePersistence.countWithDynamicQuery(DynamicQuery)
public static List<Resource> findWithDynamicQuery(DynamicQuery dynamicQuery) throws SystemException
SystemException
BasePersistence.findWithDynamicQuery(DynamicQuery)
public static List<Resource> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end) throws SystemException
SystemException
BasePersistence.findWithDynamicQuery(DynamicQuery, int, int)
public static List<Resource> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator orderByComparator) throws SystemException
SystemException
BasePersistence.findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
public static Resource update(Resource resource, boolean merge) throws SystemException
SystemException
BasePersistence.update(com.liferay.portal.model.BaseModel, boolean)
public static Resource update(Resource resource, boolean merge, ServiceContext serviceContext) throws SystemException
SystemException
BasePersistence.update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)
public static void cacheResult(Resource resource)
resource
- the resourcepublic static void cacheResult(List<Resource> resources)
resources
- the resourcespublic static Resource create(long resourceId)
resourceId
- the primary key for the new resource
public static Resource remove(long resourceId) throws NoSuchResourceException, SystemException
resourceId
- the primary key of the resource
NoSuchResourceException
- if a resource with the primary key could not be found
SystemException
- if a system exception occurredpublic static Resource updateImpl(Resource resource, boolean merge) throws SystemException
SystemException
public static Resource findByPrimaryKey(long resourceId) throws NoSuchResourceException, SystemException
NoSuchResourceException
if it could not be found.
resourceId
- the primary key of the resource
NoSuchResourceException
- if a resource with the primary key could not be found
SystemException
- if a system exception occurredpublic static Resource fetchByPrimaryKey(long resourceId) throws SystemException
null
if it could not be found.
resourceId
- the primary key of the resource
null
if a resource with the primary key could not be found
SystemException
- if a system exception occurredpublic static List<Resource> findByCodeId(long codeId) throws SystemException
codeId
- the code ID
SystemException
- if a system exception occurredpublic static List<Resource> findByCodeId(long codeId, int start, int end) throws SystemException
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.
codeId
- the code IDstart
- the lower bound of the range of resourcesend
- the upper bound of the range of resources (not inclusive)
SystemException
- if a system exception occurredpublic static List<Resource> findByCodeId(long codeId, int start, int end, OrderByComparator orderByComparator) throws SystemException
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.
codeId
- the code IDstart
- the lower bound of the range of resourcesend
- the upper bound of the range of resources (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)
SystemException
- if a system exception occurredpublic static Resource findByCodeId_First(long codeId, OrderByComparator orderByComparator) throws NoSuchResourceException, SystemException
codeId
- the code IDorderByComparator
- the comparator to order the set by (optionally null
)
NoSuchResourceException
- if a matching resource could not be found
SystemException
- if a system exception occurredpublic static Resource fetchByCodeId_First(long codeId, OrderByComparator orderByComparator) throws SystemException
codeId
- the code IDorderByComparator
- the comparator to order the set by (optionally null
)
null
if a matching resource could not be found
SystemException
- if a system exception occurredpublic static Resource findByCodeId_Last(long codeId, OrderByComparator orderByComparator) throws NoSuchResourceException, SystemException
codeId
- the code IDorderByComparator
- the comparator to order the set by (optionally null
)
NoSuchResourceException
- if a matching resource could not be found
SystemException
- if a system exception occurredpublic static Resource fetchByCodeId_Last(long codeId, OrderByComparator orderByComparator) throws SystemException
codeId
- the code IDorderByComparator
- the comparator to order the set by (optionally null
)
null
if a matching resource could not be found
SystemException
- if a system exception occurredpublic static Resource[] findByCodeId_PrevAndNext(long resourceId, long codeId, OrderByComparator orderByComparator) throws NoSuchResourceException, SystemException
resourceId
- the primary key of the current resourcecodeId
- the code IDorderByComparator
- the comparator to order the set by (optionally null
)
NoSuchResourceException
- if a resource with the primary key could not be found
SystemException
- if a system exception occurredpublic static List<Resource> findByPrimKey(String primKey) throws SystemException
primKey
- the prim key
SystemException
- if a system exception occurredpublic static List<Resource> findByPrimKey(String primKey, int start, int end) throws SystemException
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.
primKey
- the prim keystart
- the lower bound of the range of resourcesend
- the upper bound of the range of resources (not inclusive)
SystemException
- if a system exception occurredpublic static List<Resource> findByPrimKey(String primKey, int start, int end, OrderByComparator orderByComparator) throws SystemException
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.
primKey
- the prim keystart
- the lower bound of the range of resourcesend
- the upper bound of the range of resources (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)
SystemException
- if a system exception occurredpublic static Resource findByPrimKey_First(String primKey, OrderByComparator orderByComparator) throws NoSuchResourceException, SystemException
primKey
- the prim keyorderByComparator
- the comparator to order the set by (optionally null
)
NoSuchResourceException
- if a matching resource could not be found
SystemException
- if a system exception occurredpublic static Resource fetchByPrimKey_First(String primKey, OrderByComparator orderByComparator) throws SystemException
primKey
- the prim keyorderByComparator
- the comparator to order the set by (optionally null
)
null
if a matching resource could not be found
SystemException
- if a system exception occurredpublic static Resource findByPrimKey_Last(String primKey, OrderByComparator orderByComparator) throws NoSuchResourceException, SystemException
primKey
- the prim keyorderByComparator
- the comparator to order the set by (optionally null
)
NoSuchResourceException
- if a matching resource could not be found
SystemException
- if a system exception occurredpublic static Resource fetchByPrimKey_Last(String primKey, OrderByComparator orderByComparator) throws SystemException
primKey
- the prim keyorderByComparator
- the comparator to order the set by (optionally null
)
null
if a matching resource could not be found
SystemException
- if a system exception occurredpublic static Resource[] findByPrimKey_PrevAndNext(long resourceId, String primKey, OrderByComparator orderByComparator) throws NoSuchResourceException, SystemException
resourceId
- the primary key of the current resourceprimKey
- the prim keyorderByComparator
- the comparator to order the set by (optionally null
)
NoSuchResourceException
- if a resource with the primary key could not be found
SystemException
- if a system exception occurredpublic static Resource findByC_P(long codeId, String primKey) throws NoSuchResourceException, SystemException
NoSuchResourceException
if it could not be found.
codeId
- the code IDprimKey
- the prim key
NoSuchResourceException
- if a matching resource could not be found
SystemException
- if a system exception occurredpublic static Resource fetchByC_P(long codeId, String primKey) throws SystemException
null
if it could not be found. Uses the finder cache.
codeId
- the code IDprimKey
- the prim key
null
if a matching resource could not be found
SystemException
- if a system exception occurredpublic static Resource fetchByC_P(long codeId, String primKey, boolean retrieveFromCache) throws SystemException
null
if it could not be found, optionally using the finder cache.
codeId
- the code IDprimKey
- the prim keyretrieveFromCache
- whether to use the finder cache
null
if a matching resource could not be found
SystemException
- if a system exception occurredpublic static List<Resource> findAll() throws SystemException
SystemException
- if a system exception occurredpublic static List<Resource> findAll(int start, int end) throws SystemException
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.
start
- the lower bound of the range of resourcesend
- the upper bound of the range of resources (not inclusive)
SystemException
- if a system exception occurredpublic static List<Resource> findAll(int start, int end, OrderByComparator orderByComparator) throws SystemException
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.
start
- the lower bound of the range of resourcesend
- the upper bound of the range of resources (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)
SystemException
- if a system exception occurredpublic static void removeByCodeId(long codeId) throws SystemException
codeId
- the code ID
SystemException
- if a system exception occurredpublic static void removeByPrimKey(String primKey) throws SystemException
primKey
- the prim key
SystemException
- if a system exception occurredpublic static Resource removeByC_P(long codeId, String primKey) throws NoSuchResourceException, SystemException
codeId
- the code IDprimKey
- the prim key
SystemException
- if a system exception occurred
NoSuchResourceException
public static void removeAll() throws SystemException
SystemException
- if a system exception occurredpublic static int countByCodeId(long codeId) throws SystemException
codeId
- the code ID
SystemException
- if a system exception occurredpublic static int countByPrimKey(String primKey) throws SystemException
primKey
- the prim key
SystemException
- if a system exception occurredpublic static int countByC_P(long codeId, String primKey) throws SystemException
codeId
- the code IDprimKey
- the prim key
SystemException
- if a system exception occurredpublic static int countAll() throws SystemException
SystemException
- if a system exception occurredpublic static ResourcePersistence getPersistence()
public void setPersistence(ResourcePersistence persistence)
|
Liferay 6.1.2-ce-ga3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |