Liferay 7.0-ce-m6

com.liferay.portal.service.persistence
Class ShardUtil

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

@ProviderType
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 = ?.
static 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 Map<Serializable,Shard> fetchByPrimaryKeys(Set<Serializable> primaryKeys)
           
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<Shard> 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<Shard> 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. As of 6.2.0
static Shard update(Shard shard)
           
static Shard update(Shard shard, ServiceContext serviceContext)
           
static Shard updateImpl(Shard shard)
           
 
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 static long countWithDynamicQuery(DynamicQuery dynamicQuery)
See Also:
BasePersistence.countWithDynamicQuery(DynamicQuery)

findWithDynamicQuery

public static List<Shard> findWithDynamicQuery(DynamicQuery dynamicQuery)
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery)

findWithDynamicQuery

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

findWithDynamicQuery

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

update

public static Shard update(Shard shard)
See Also:
BasePersistence.update(com.liferay.portal.model.BaseModel)

update

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

findByName

public static Shard findByName(String name)
                        throws NoSuchShardException
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

fetchByName

public static Shard fetchByName(String name)
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

fetchByName

public 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.

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

removeByName

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

Parameters:
name - the name
Returns:
the shard that was removed
Throws:
NoSuchShardException

countByName

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

Parameters:
name - the name
Returns:
the number of matching shards

findByC_C

public static Shard findByC_C(long classNameId,
                              long classPK)
                       throws NoSuchShardException
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

fetchByC_C

public static Shard fetchByC_C(long classNameId,
                               long classPK)
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

fetchByC_C

public 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.

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

removeByC_C

public static Shard removeByC_C(long classNameId,
                                long classPK)
                         throws NoSuchShardException
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:
NoSuchShardException

countByC_C

public static int countByC_C(long classNameId,
                             long classPK)
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

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
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

updateImpl

public static Shard updateImpl(Shard shard)

findByPrimaryKey

public static Shard findByPrimaryKey(long shardId)
                              throws NoSuchShardException
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

fetchByPrimaryKey

public static Shard fetchByPrimaryKey(long shardId)
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

fetchByPrimaryKeys

public static Map<Serializable,Shard> fetchByPrimaryKeys(Set<Serializable> primaryKeys)

findAll

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

Returns:
the shards

findAll

public static List<Shard> findAll(int start,
                                  int end)
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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from ShardModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

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

findAll

public static List<Shard> findAll(int start,
                                  int end,
                                  OrderByComparator<Shard> orderByComparator)
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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from ShardModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

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

removeAll

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


countAll

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

Returns:
the number of shards

getPersistence

public static ShardPersistence getPersistence()

setPersistence

@Deprecated
public void setPersistence(ShardPersistence persistence)
Deprecated. As of 6.2.0


Liferay 7.0-ce-m6