Liferay 6.1.2-ce-ga3

com.liferay.portal.service.persistence
Class ShardUtil

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

public class ShardUtil
extends Object

The persistence utility for the shard service. This utility wraps ShardPersistenceImpl 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

See Also:
ShardPersistence, ShardPersistenceImpl

Constructor Summary
ShardUtil()
           
 
Method Summary
static void cacheResult(List<Shard> shards)
          Caches the shards in the entity cache if it is enabled.
static void cacheResult(Shard shard)
          Caches the shard in the entity cache if it is enabled.
static void clearCache()
           
static void clearCache(Shard shard)
           
static int countAll()
          Returns the number of shards.
static int countByC_C(long classNameId, long classPK)
          Returns the number of shards where classNameId = ? and classPK = ?.
static int countByName(String name)
          Returns the number of shards where name = ?.
 long countWithDynamicQuery(DynamicQuery dynamicQuery)
           
static Shard create(long shardId)
          Creates a new shard with the primary key.
static Shard fetchByC_C(long classNameId, long classPK)
          Returns the shard where classNameId = ? and classPK = ? or returns null if it could not be found.
static Shard fetchByC_C(long classNameId, long classPK, boolean retrieveFromCache)
          Returns the shard where classNameId = ? and classPK = ? or returns null if it could not be found, optionally using the finder cache.
static Shard fetchByName(String name)
          Returns the shard where name = ? or returns null if it could not be found.
static Shard fetchByName(String name, boolean retrieveFromCache)
          Returns the shard where name = ? or returns null if it could not be found, optionally using the finder cache.
static Shard fetchByPrimaryKey(long shardId)
          Returns the shard with the primary key or returns null if it could not be found.
static List<Shard> findAll()
          Returns all the shards.
static List<Shard> findAll(int start, int end)
          Returns a range of all the shards.
static List<Shard> findAll(int start, int end, OrderByComparator orderByComparator)
          Returns an ordered range of all the shards.
static Shard findByC_C(long classNameId, long classPK)
          Returns the shard where classNameId = ? and classPK = ? or throws a NoSuchShardException if it could not be found.
static Shard findByName(String name)
          Returns the shard where name = ? or throws a NoSuchShardException if it could not be found.
static Shard findByPrimaryKey(long shardId)
          Returns the shard with the primary key or throws a NoSuchShardException if it could not be found.
static List<Shard> findWithDynamicQuery(DynamicQuery dynamicQuery)
           
static List<Shard> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end)
           
static List<Shard> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator orderByComparator)
           
static ShardPersistence getPersistence()
           
static Shard remove(long shardId)
          Removes the shard with the primary key from the database.
static void removeAll()
          Removes all the shards from the database.
static Shard removeByC_C(long classNameId, long classPK)
          Removes the shard where classNameId = ? and classPK = ? from the database.
static Shard removeByName(String name)
          Removes the shard where name = ? from the database.
 void setPersistence(ShardPersistence persistence)
          Deprecated.  
static Shard update(Shard shard, boolean merge)
           
static Shard update(Shard shard, boolean merge, ServiceContext serviceContext)
           
static Shard updateImpl(Shard shard, boolean merge)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShardUtil

public ShardUtil()
Method Detail

clearCache

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

clearCache

public static void clearCache(Shard shard)
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<Shard> findWithDynamicQuery(DynamicQuery dynamicQuery)
                                        throws SystemException
Throws:
SystemException
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery)

findWithDynamicQuery

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

findWithDynamicQuery

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

update

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

update

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

cacheResult

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

Parameters:
shard - the shard

cacheResult

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

Parameters:
shards - the shards

create

public static Shard create(long shardId)
Creates a new shard with the primary key. Does not add the shard to the database.

Parameters:
shardId - the primary key for the new shard
Returns:
the new shard

remove

public static Shard remove(long shardId)
                    throws NoSuchShardException,
                           SystemException
Removes the shard with the primary key from the database. Also notifies the appropriate model listeners.

Parameters:
shardId - the primary key of the shard
Returns:
the shard that was removed
Throws:
NoSuchShardException - if a shard with the primary key could not be found
SystemException - if a system exception occurred

updateImpl

public static Shard updateImpl(Shard shard,
                               boolean merge)
                        throws SystemException
Throws:
SystemException

findByPrimaryKey

public static Shard findByPrimaryKey(long shardId)
                              throws NoSuchShardException,
                                     SystemException
Returns the shard with the primary key or throws a NoSuchShardException if it could not be found.

Parameters:
shardId - the primary key of the shard
Returns:
the shard
Throws:
NoSuchShardException - if a shard with the primary key could not be found
SystemException - if a system exception occurred

fetchByPrimaryKey

public static Shard fetchByPrimaryKey(long shardId)
                               throws SystemException
Returns the shard with the primary key or returns null if it could not be found.

Parameters:
shardId - the primary key of the shard
Returns:
the shard, or null if a shard with the primary key could not be found
Throws:
SystemException - if a system exception occurred

findByName

public static Shard findByName(String name)
                        throws NoSuchShardException,
                               SystemException
Returns the shard where name = ? or throws a NoSuchShardException if it could not be found.

Parameters:
name - the name
Returns:
the matching shard
Throws:
NoSuchShardException - if a matching shard could not be found
SystemException - if a system exception occurred

fetchByName

public static Shard fetchByName(String name)
                         throws SystemException
Returns the shard where name = ? or returns null if it could not be found. Uses the finder cache.

Parameters:
name - the name
Returns:
the matching shard, or null if a matching shard could not be found
Throws:
SystemException - if a system exception occurred

fetchByName

public static Shard fetchByName(String name,
                                boolean retrieveFromCache)
                         throws SystemException
Returns the shard where name = ? or returns null if it could not be found, optionally using the finder cache.

Parameters:
name - the name
retrieveFromCache - whether to use the finder cache
Returns:
the matching shard, or null if a matching shard could not be found
Throws:
SystemException - if a system exception occurred

findByC_C

public static Shard findByC_C(long classNameId,
                              long classPK)
                       throws NoSuchShardException,
                              SystemException
Returns the shard where classNameId = ? and classPK = ? or throws a NoSuchShardException if it could not be found.

Parameters:
classNameId - the class name ID
classPK - the class p k
Returns:
the matching shard
Throws:
NoSuchShardException - if a matching shard could not be found
SystemException - if a system exception occurred

fetchByC_C

public static Shard fetchByC_C(long classNameId,
                               long classPK)
                        throws SystemException
Returns the shard where classNameId = ? and classPK = ? or returns null if it could not be found. Uses the finder cache.

Parameters:
classNameId - the class name ID
classPK - the class p k
Returns:
the matching shard, or null if a matching shard could not be found
Throws:
SystemException - if a system exception occurred

fetchByC_C

public static Shard fetchByC_C(long classNameId,
                               long classPK,
                               boolean retrieveFromCache)
                        throws SystemException
Returns the shard where classNameId = ? and classPK = ? or returns null if it could not be found, optionally using the finder cache.

Parameters:
classNameId - the class name ID
classPK - the class p k
retrieveFromCache - whether to use the finder cache
Returns:
the matching shard, or null if a matching shard could not be found
Throws:
SystemException - if a system exception occurred

findAll

public static List<Shard> findAll()
                           throws SystemException
Returns all the shards.

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

findAll

public static List<Shard> findAll(int start,
                                  int end)
                           throws SystemException
Returns a range of all the shards.

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 shards
end - the upper bound of the range of shards (not inclusive)
Returns:
the range of shards
Throws:
SystemException - if a system exception occurred

findAll

public static List<Shard> findAll(int start,
                                  int end,
                                  OrderByComparator orderByComparator)
                           throws SystemException
Returns an ordered range of all the shards.

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 shards
end - the upper bound of the range of shards (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of shards
Throws:
SystemException - if a system exception occurred

removeByName

public static Shard removeByName(String name)
                          throws NoSuchShardException,
                                 SystemException
Removes the shard where name = ? from the database.

Parameters:
name - the name
Returns:
the shard that was removed
Throws:
SystemException - if a system exception occurred
NoSuchShardException

removeByC_C

public static Shard removeByC_C(long classNameId,
                                long classPK)
                         throws NoSuchShardException,
                                SystemException
Removes the shard where classNameId = ? and classPK = ? from the database.

Parameters:
classNameId - the class name ID
classPK - the class p k
Returns:
the shard that was removed
Throws:
SystemException - if a system exception occurred
NoSuchShardException

removeAll

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

Throws:
SystemException - if a system exception occurred

countByName

public static int countByName(String name)
                       throws SystemException
Returns the number of shards where name = ?.

Parameters:
name - the name
Returns:
the number of matching shards
Throws:
SystemException - if a system exception occurred

countByC_C

public static int countByC_C(long classNameId,
                             long classPK)
                      throws SystemException
Returns the number of shards where classNameId = ? and classPK = ?.

Parameters:
classNameId - the class name ID
classPK - the class p k
Returns:
the number of matching shards
Throws:
SystemException - if a system exception occurred

countAll

public static int countAll()
                    throws SystemException
Returns the number of shards.

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

getPersistence

public static ShardPersistence getPersistence()

setPersistence

public void setPersistence(ShardPersistence persistence)
Deprecated. 


Liferay 6.1.2-ce-ga3