public class GenericDelegator extends Object implements DelegatorInterface
| Modifier and Type | Field and Description |
|---|---|
protected UtilCache<String,List<GenericValue>> |
allCache |
protected UtilCache<GenericPK,List<GenericValue>> |
andCache |
protected Map<String,Set<Set<String>>> |
andCacheFieldSets |
protected EntityConfigUtil.DelegatorInfo |
delegatorInfo |
protected String |
delegatorName |
protected DistributedCacheClear |
distributedCacheClear |
protected ModelGroupReader |
modelGroupReader |
protected ModelReader |
modelReader |
static String |
module |
protected UtilCache<GenericEntity,GenericValue> |
primaryKeyCache |
protected SequenceUtil |
sequencer |
| Modifier | Constructor and Description |
|---|---|
protected |
GenericDelegator()
Contructor is protected to enforce creation through the factory method.
|
protected |
GenericDelegator(String delegatorName)
Contructor is protected to enforce creation through the factory method.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
absorbList(List<GenericValue> lst) |
void |
clearAllCacheLinesByDummyPK(Collection<? extends GenericEntity> dummyPKs) |
void |
clearAllCacheLinesByValue(Collection<? extends GenericValue> values) |
void |
clearAllCaches()
This method is a shortcut to completely clear all entity engine caches.
|
void |
clearAllCaches(boolean distribute) |
void |
clearCacheLine(GenericPK primaryKey)
Remove a CACHED Generic Entity from the cache by its primary key, does NOT
check to see if the passed GenericPK is a complete primary key.
|
void |
clearCacheLine(GenericPK primaryKey,
boolean distribute) |
void |
clearCacheLine(GenericValue value)
Remove a CACHED GenericValue from as many caches as it can.
|
void |
clearCacheLine(GenericValue value,
boolean distribute) |
void |
clearCacheLine(String entityName,
Map<String,?> fields)
Remove a CACHED Generic Entity (List) from the cache, either a PK, ByAnd, or All
|
void |
clearCacheLineFlexible(GenericEntity dummyPK)
Remove a CACHED Generic Entity from the cache by its primary key.
|
void |
clearCacheLineFlexible(GenericEntity dummyPK,
boolean distribute) |
int |
countAll(String entityName)
Returns the row count of the specified entity.
|
int |
countByAnd(String entityName,
String fieldName,
List<? extends EntityCondition> expressions,
EntityFindOptions findOptions)
Returns the count of the results that match all of the specified expressions (i.e.
|
int |
countByCondition(String entityName,
String fieldName,
EntityCondition entityCondition,
EntityFindOptions findOptions)
Returns the count of the results that match any of the specified expressions (ie: combined using OR).
|
int |
countByOr(String entityName,
String fieldName,
List<? extends EntityCondition> expressions,
EntityFindOptions findOptions)
Returns the count of the results that match any of the specified
expressions (i.e.
|
GenericValue |
create(GenericPK primaryKey)
Creates a Entity in the form of a GenericValue and write it to the datasource.
|
GenericValue |
create(GenericPK primaryKey,
boolean doCacheClear)
Creates a Entity in the form of a GenericValue and write it to the datasource.
|
GenericValue |
create(GenericValue value)
Creates a Entity in the form of a GenericValue and write it to the datasource.
|
GenericValue |
create(GenericValue value,
boolean doCacheClear)
Creates a Entity in the form of a GenericValue and write it to the datasource.
|
GenericValue |
create(String entityName,
Map<String,?> fields)
Creates a Entity in the form of a GenericValue and write it to the database.
|
List<GenericValue> |
findAll(String entityName)
Finds all Generic entities of the given type.
|
List<GenericValue> |
findAll(String entityName,
List<String> orderBy)
Finds all Generic entities of the given type, optionally sorted.
|
List<GenericValue> |
findAllByPrimaryKeys(Collection<? extends GenericPK> primaryKeys)
Find a number of Generic Value objects by their Primary Keys, all at once.
|
List<GenericValue> |
findAllByPrimaryKeysCache(Collection<? extends GenericPK> primaryKeys)
Find a number of Generic Value objects by their Primary Keys, all at
once; this first looks in the local cache for each PK and if there then
it puts it in the return list rather than putting it in the batch to
send to a given helper.
|
List<GenericValue> |
findAllCache(String entityName)
Finds all Generic entities of the given type, looking first in the cache.
|
List<GenericValue> |
findAllCache(String entityName,
List<String> orderBy)
Finds all Generic entities, looking first in the cache; uses orderBy for
lookup, but only keys results on the entityName and fields.
|
List<GenericValue> |
findByAnd(ModelEntity modelEntity,
Map<String,?> fields,
List<String> orderBy)
Finds any entities matching the given criteria.
|
List<GenericValue> |
findByAnd(String entityName,
List<? extends EntityCondition> expressions)
Finds Generic Entity records by all of the specified expressions (ie: combined using AND).
|
List<GenericValue> |
findByAnd(String entityName,
List<? extends EntityCondition> expressions,
List<String> orderBy)
Finds Generic Entity records by all of the specified expressions (i.e.
|
List<GenericValue> |
findByAnd(String entityName,
Map<String,?> fields)
Finds Generic Entity records by all of the specified fields (ie: combined using AND).
|
List<GenericValue> |
findByAnd(String entityName,
Map<String,?> fields,
List<String> orderBy)
Finds Generic Entity records by all of the specified fields (i.e.
|
List<GenericValue> |
findByAndCache(String entityName,
Map<String,?> fields)
Finds Generic Entity records by all of the specified fields (i.e.
|
List<GenericValue> |
findByAndCache(String entityName,
Map<String,?> fields,
List<String> orderBy)
Finds Generic Entity records by all of the specified fields (i.e.
|
List<GenericValue> |
findByCondition(String entityName,
EntityCondition entityCondition,
Collection<String> fieldsToSelect,
List<String> orderBy)
Finds any GenericValues matching the given conditions.
|
List<GenericValue> |
findByLike(String entityName,
Map<String,?> fields) |
List<GenericValue> |
findByLike(String entityName,
Map<String,?> fields,
List<String> orderBy) |
List<GenericValue> |
findByOr(String entityName,
List<? extends EntityCondition> expressions)
Finds Generic Entity records by all of the specified expressions (i.e.
|
List<GenericValue> |
findByOr(String entityName,
List<? extends EntityCondition> expressions,
List<String> orderBy)
Finds Generic Entity records by all of the specified expressions (i.e.
|
List<GenericValue> |
findByOr(String entityName,
Map<String,?> fields)
Finds Generic Entity records by any of the specified fields (i.e.
|
List<GenericValue> |
findByOr(String entityName,
Map<String,?> fields,
List<String> orderBy)
Finds Generic Entity records by all of the specified fields (i.e.
|
GenericValue |
findByPrimaryKey(GenericPK primaryKey)
Find a Generic Entity by its Primary Key.
|
GenericValue |
findByPrimaryKey(String entityName,
Map<String,?> fields)
Find a Generic Entity by its Primary Key.
|
GenericValue |
findByPrimaryKeyCache(GenericPK primaryKey)
Find a cached Generic Entity by its Primary Key.
|
GenericValue |
findByPrimaryKeyCache(String entityName,
Map<String,?> fields)
Find a CACHED Generic Entity by its Primary Key.
|
GenericValue |
findByPrimaryKeyPartial(GenericPK primaryKey,
Set<String> keys)
Find a Generic Entity by its Primary Key and only returns the values
requested by the passed keys (names).
|
EntityListIterator |
findListIteratorByCondition(String entityName,
EntityCondition entityCondition,
Collection<String> fieldsToSelect,
List<String> orderBy)
Finds GenericValues by the given conditions.
|
EntityListIterator |
findListIteratorByCondition(String entityName,
EntityCondition whereEntityCondition,
EntityCondition havingEntityCondition,
Collection<String> fieldsToSelect,
List<String> orderBy,
EntityFindOptions findOptions)
Finds GenericValues by the given conditions.
|
UtilCache<String,List<GenericValue>> |
getAllCache() |
UtilCache<GenericPK,List<GenericValue>> |
getAndCache() |
protected EntityConfigUtil.DelegatorInfo |
getDelegatorInfo() |
String |
getDelegatorName()
Gets the name of the server configuration that corresponds to this delegator.
|
ModelFieldType |
getEntityFieldType(ModelEntity entity,
String type)
Gets a field type instance by name from the helper that corresponds to the specified entity.
|
Collection<String> |
getEntityFieldTypeNames(ModelEntity entity)
Gets field type names from the helper that corresponds to the specified entity.
|
String |
getEntityGroupName(String entityName)
Gets the helper name that corresponds to this delegator and the specified entityName.
|
GenericHelper |
getEntityHelper(ModelEntity entity)
Gets the helper that corresponds to this delegator and the specified entity.
|
GenericHelper |
getEntityHelper(String entityName)
Gets the helper that corresponds to this delegator and the specified entityName.
|
String |
getEntityHelperName(ModelEntity entity)
Gets the helper name that corresponds to this delegator and the specified entity.
|
String |
getEntityHelperName(String entityName)
Gets the helper name that corresponds to this delegator and the specified entityName.
|
Set<Set<String>> |
getFieldNameSetsCopy(String entityName)
Gets a Set of Sets of fieldNames used in the by and cache for the given entityName.
|
List<GenericValue> |
getFromAllCache(String entityName) |
List<GenericValue> |
getFromAndCache(ModelEntity entity,
Map<String,?> fields) |
List<GenericValue> |
getFromAndCache(String entityName,
Map<String,?> fields) |
GenericValue |
getFromPrimaryKeyCache(GenericPK primaryKey) |
static GenericDelegator |
getGenericDelegator(String delegatorName)
Factory method for a GenericDelegator with the given name.
|
String |
getGroupHelperName(String groupName)
Gets the helper name that corresponds to this delegator and the specified entityName.
|
List<ModelEntity> |
getModelEntitiesByGroup(String groupName)
Gets a list of entity models that are in a group corresponding to the specified group name.
|
ModelEntity |
getModelEntity(String entityName)
Gets the instance of ModelEntity that corresponds to this delegator and the specified entityName.
|
Map<String,ModelEntity> |
getModelEntityMapByGroup(String groupName)
Gets a Map of entity name & entity model pairs that are in the named group.
|
ModelGroupReader |
getModelGroupReader()
Gets the instance of ModelGroupReader that corresponds to this delegator.
|
ModelReader |
getModelReader()
Gets the instance of ModelReader that corresponds to this delegator.
|
List<GenericValue> |
getMultiRelation(GenericValue value,
String relationNameOne,
String relationNameTwo)
Get the named Related Entity for the GenericValue from the persistent
store across another Relation.
|
List<GenericValue> |
getMultiRelation(GenericValue value,
String relationNameOne,
String relationNameTwo,
List<String> orderBy)
Get the named Related Entity for the GenericValue from the persistent
store across another Relation.
|
Long |
getNextSeqId(String seqName)
Get the next guaranteed unique seq id from the sequence with the given sequence name;
if the named sequence doesn't exist, it will be created.
|
UtilCache<GenericEntity,GenericValue> |
getPrimaryKeyCache() |
List<GenericValue> |
getRelated(String relationName,
GenericValue value)
Get the named Related Entity for the GenericValue from the persistent store
|
List<GenericValue> |
getRelated(String relationName,
Map<String,?> byAndFields,
List<String> orderBy,
GenericValue value)
Get the named Related Entity for the GenericValue from the persistent store.
|
List<GenericValue> |
getRelatedByAnd(String relationName,
Map<String,?> byAndFields,
GenericValue value)
Get the named Related Entity for the GenericValue from the persistent store.
|
List<GenericValue> |
getRelatedCache(String relationName,
GenericValue value)
Get the named Related Entity for the GenericValue from the persistent
store, checking first in the cache to see if the desired value is there.
|
GenericPK |
getRelatedDummyPK(String relationName,
Map<String,?> byAndFields,
GenericValue value)
Get a dummy primary key for the named Related Entity for the GenericValue.
|
GenericValue |
getRelatedOne(String relationName,
GenericValue value)
Get related entity where relation is of type one, uses findByPrimaryKey.
|
GenericValue |
getRelatedOneCache(String relationName,
GenericValue value)
Get related entity where relation is of type one, uses findByPrimaryKey,
checking first in the cache to see if the desired value is there.
|
List<GenericValue> |
getRelatedOrderBy(String relationName,
List<String> orderBy,
GenericValue value)
Get the named Related Entity for the GenericValue from the persistent store.
|
void |
initialiseAndCheckDatabase()
If you got an instance of GenericDelegator while the whole thing was locked, you need to make sure you call this
once it becomes unlocked before you do anything.
|
static boolean |
isLocked() |
static void |
lock() |
GenericPK |
makePK(Element element) |
GenericPK |
makePK(String entityName,
Map<String,?> fields)
Creates a Primary Key in the form of a GenericPK without persisting it.
|
GenericValue |
makeValue(Element element) |
GenericValue |
makeValue(String entityName,
Map<String,?> fields)
Creates a Entity in the form of a GenericValue without persisting it.
|
List<GenericValue> |
makeValues(Document document)
Parses the given XML document for entities.
|
void |
putAllInPrimaryKeyCache(List<? extends GenericValue> values) |
void |
putInAllCache(ModelEntity entity,
List<? extends GenericValue> values) |
void |
putInAllCache(String entityName,
List<? extends GenericValue> values) |
void |
putInAndCache(ModelEntity entity,
Map<String,?> fields,
List<? extends GenericValue> values) |
void |
putInAndCache(String entityName,
Map<String,?> fields,
List<? extends GenericValue> values) |
void |
putInPrimaryKeyCache(GenericPK primaryKey,
GenericValue value) |
List<GenericValue> |
readXmlDocument(URL url)
Parses the given XML file for entities.
|
void |
refresh(GenericValue value)
Refresh the Entity for the GenericValue from the persistent store.
|
void |
refresh(GenericValue value,
boolean doCacheClear)
Refresh the Entity for the GenericValue from the persistent store.
|
void |
refreshSequencer()
Refreshes the ID sequencer clearing all cached bank values.
|
int |
removeAll(List<? extends GenericEntity> dummyPKs)
Remove the Entities from the List from the persistent store.
|
int |
removeAll(List<? extends GenericEntity> dummyPKs,
boolean doCacheClear)
Remove the Entities from the List from the persistent store.
|
int |
removeByAnd(String entityName,
Map<String,?> fields)
Removes/deletes Generic Entity records found by all of the specified fields (ie: combined using AND).
|
int |
removeByAnd(String entityName,
Map<String,?> fields,
boolean doCacheClear)
Removes/deletes Generic Entity records found by all of the specified fields (ie: combined using AND).
|
int |
removeByCondition(String entityName,
EntityCondition whereCondition)
Removes/deletes Generic Entity records found by matching the EntityCondition.
|
int |
removeByCondition(String entityName,
EntityCondition whereCondition,
boolean doCacheClear)
Removes/deletes Generic Entity records found by matching the EntityCondition.
|
int |
removeByPrimaryKey(GenericPK primaryKey)
Remove a Generic Entity corresponding to the primaryKey.
|
int |
removeByPrimaryKey(GenericPK primaryKey,
boolean doCacheClear)
Remove a Generic Entity corresponding to the primaryKey.
|
static void |
removeGenericDelegator(String delegatorName)
Removes any references to the delegator with the given name.
|
int |
removeRelated(String relationName,
GenericValue value)
Remove the named Related Entity for the GenericValue from the persistent store.
|
int |
removeRelated(String relationName,
GenericValue value,
boolean doCacheClear)
Remove the named Related Entity for the GenericValue from the persistent store.
|
int |
removeValue(GenericValue value)
Remove a Generic Value from the database.
|
int |
removeValue(GenericValue value,
boolean doCacheClear)
Remove a Generic Value from the database.
|
void |
setSequencer(SequenceUtil sequencer)
Allows you to pass a SequenceUtil class (possibly one that overrides the getNextSeqId method);
if null is passed will effectively refresh the sequencer.
|
int |
store(GenericValue value)
Store the Entity from the GenericValue to the persistent store.
|
int |
store(GenericValue value,
boolean doCacheClear)
Store the Entity from the GenericValue to the persistent store.
|
int |
storeAll(List<? extends GenericValue> values)
Store the Entities from the List GenericValue instances to the persistent store.
|
int |
storeAll(List<? extends GenericValue> values,
boolean doCacheClear)
Store the Entities from the List GenericValue instances to the persistent store.
|
List<GenericValue> |
transform(String entityName,
EntityCondition entityCondition,
List<String> orderBy,
String lockField,
Transformation transformation)
Applies the given transformation to any entities matching the given condition.
|
static void |
unlock() |
public static final String module
protected EntityConfigUtil.DelegatorInfo delegatorInfo
protected DistributedCacheClear distributedCacheClear
protected ModelGroupReader modelGroupReader
protected ModelReader modelReader
protected SequenceUtil sequencer
protected String delegatorName
protected UtilCache<GenericEntity,GenericValue> primaryKeyCache
protected UtilCache<GenericPK,List<GenericValue>> andCache
protected UtilCache<String,List<GenericValue>> allCache
protected GenericDelegator()
protected GenericDelegator(String delegatorName) throws GenericEntityException
delegatorName - the name of the server configuration that corresponds to this delegatorGenericEntityExceptionpublic static GenericDelegator getGenericDelegator(String delegatorName)
delegatorName - the name of the server configuration that corresponds to this delegatorRuntimeException - if the delegator could not be instantiatedpublic static void removeGenericDelegator(String delegatorName)
delegatorName - the name of the server configuration that corresponds to this delegatorpublic static void lock()
public static void unlock()
public static boolean isLocked()
public void initialiseAndCheckDatabase()
public String getDelegatorName()
getDelegatorName in interface DelegatorInterfaceprotected EntityConfigUtil.DelegatorInfo getDelegatorInfo()
public ModelReader getModelReader()
getModelReader in interface DelegatorInterfacepublic ModelGroupReader getModelGroupReader()
getModelGroupReader in interface DelegatorInterfacepublic ModelEntity getModelEntity(String entityName)
getModelEntity in interface DelegatorInterfaceentityName - The name of the entity to getpublic String getEntityGroupName(String entityName)
getEntityGroupName in interface DelegatorInterfaceentityName - The name of the entity to get the helper forpublic List<ModelEntity> getModelEntitiesByGroup(String groupName)
getModelEntitiesByGroup in interface DelegatorInterfacegroupName - The name of the grouppublic Map<String,ModelEntity> getModelEntityMapByGroup(String groupName)
getModelEntityMapByGroup in interface DelegatorInterfacegroupName - The name of the grouppublic String getGroupHelperName(String groupName)
getGroupHelperName in interface DelegatorInterfacegroupName - The name of the group to get the helper name forpublic String getEntityHelperName(String entityName)
getEntityHelperName in interface DelegatorInterfaceentityName - The name of the entity to get the helper name forpublic String getEntityHelperName(ModelEntity entity)
getEntityHelperName in interface DelegatorInterfaceentity - the entity for which to get the helper (can be null)public GenericHelper getEntityHelper(String entityName) throws GenericEntityException
getEntityHelper in interface DelegatorInterfaceentityName - The name of the entity to get the helper forGenericEntityExceptionpublic GenericHelper getEntityHelper(ModelEntity entity) throws GenericEntityException
getEntityHelper in interface DelegatorInterfaceentity - The entity for which to get the helper (required)GenericEntityExceptionpublic ModelFieldType getEntityFieldType(ModelEntity entity, String type) throws GenericEntityException
getEntityFieldType in interface DelegatorInterfaceentity - The entitytype - The name of the typeGenericEntityExceptionpublic Collection<String> getEntityFieldTypeNames(ModelEntity entity) throws GenericEntityException
getEntityFieldTypeNames in interface DelegatorInterfaceentity - The entityGenericEntityExceptionpublic GenericValue makeValue(String entityName, Map<String,?> fields)
makeValue in interface DelegatorInterfaceentityName - the type of entity to create (must exist in the model)fields - the entity fields and their values (can be null)public GenericPK makePK(String entityName, Map<String,?> fields)
makePK in interface DelegatorInterfaceentityName - the type of entity for which to create a PK (must exist in the model)fields - the primary key fields and their values (can be null)public GenericValue create(String entityName, Map<String,?> fields) throws GenericEntityException
create in interface DelegatorInterfaceentityName - the type of entity to create (if null, this method does nothing)fields - the field values to use (if null, this method does nothing)GenericEntityExceptionpublic GenericValue create(GenericValue value) throws GenericEntityException
create in interface DelegatorInterfacevalue - The GenericValue to create a value in the datasource fromGenericEntityExceptionpublic GenericValue create(GenericValue value, boolean doCacheClear) throws GenericEntityException
create in interface DelegatorInterfacevalue - The GenericValue from which to create a value in the datasource (required)doCacheClear - whether to automatically clear cache entries related to this operationGenericEntityExceptionpublic GenericValue create(GenericPK primaryKey) throws GenericEntityException
create in interface DelegatorInterfaceprimaryKey - The GenericPK to create a value in the datasource fromGenericEntityExceptionpublic GenericValue create(GenericPK primaryKey, boolean doCacheClear) throws GenericEntityException
create in interface DelegatorInterfaceprimaryKey - the PK from which to create a value in the datasource (required)doCacheClear - whether to clear related cache entries for this primaryKey to be createdGenericEntityExceptionpublic GenericValue findByPrimaryKey(GenericPK primaryKey) throws GenericEntityException
findByPrimaryKey in interface DelegatorInterfaceprimaryKey - The primary key to find by.GenericEntityExceptionpublic GenericValue findByPrimaryKeyCache(GenericPK primaryKey) throws GenericEntityException
findByPrimaryKeyCache in interface DelegatorInterfaceprimaryKey - The primary key to find by.GenericEntityExceptionpublic GenericValue findByPrimaryKey(String entityName, Map<String,?> fields) throws GenericEntityException
findByPrimaryKey in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesGenericEntityExceptionpublic GenericValue findByPrimaryKeyCache(String entityName, Map<String,?> fields) throws GenericEntityException
findByPrimaryKeyCache in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesGenericEntityExceptionpublic GenericValue findByPrimaryKeyPartial(GenericPK primaryKey, Set<String> keys) throws GenericEntityException
findByPrimaryKeyPartial in interface DelegatorInterfaceprimaryKey - The primary key to find by.keys - The keys, or names, of the values to retrieve; only these values will be retrievedGenericEntityExceptionpublic List<GenericValue> findAllByPrimaryKeys(Collection<? extends GenericPK> primaryKeys) throws GenericEntityException
findAllByPrimaryKeys in interface DelegatorInterfaceprimaryKeys - A Collection of primary keys to find by.GenericEntityExceptionpublic List<GenericValue> findAllByPrimaryKeysCache(Collection<? extends GenericPK> primaryKeys) throws GenericEntityException
findAllByPrimaryKeysCache in interface DelegatorInterfaceprimaryKeys - A Collection of primary keys to find by.GenericEntityExceptionpublic List<GenericValue> findAll(String entityName) throws GenericEntityException
findAll in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML fileGenericEntityExceptionpublic List<GenericValue> findAll(String entityName, List<String> orderBy) throws GenericEntityException
findAll in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML fileorderBy - the entity fields by which to order the query; optionally
add " ASC" for ascending or " DESC" for descending to each field nameGenericEntityExceptionpublic List<GenericValue> findAllCache(String entityName) throws GenericEntityException
findAllCache in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML fileGenericEntityExceptionpublic List<GenericValue> findAllCache(String entityName, List<String> orderBy) throws GenericEntityException
findAllCache in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML fileorderBy - The fields of the named entity by which to order the
query; optionally add " ASC" for ascending or " DESC" for descendingGenericEntityExceptionpublic List<GenericValue> findByAnd(String entityName, Map<String,?> fields) throws GenericEntityException
findByAnd in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesGenericEntityExceptionpublic List<GenericValue> findByOr(String entityName, Map<String,?> fields) throws GenericEntityException
findByOr in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesGenericEntityExceptionpublic List<GenericValue> findByAnd(String entityName, Map<String,?> fields, List<String> orderBy) throws GenericEntityException
findByAnd in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - the names and values of the fields by which to query (can be null)orderBy - The fields of the named entity to order the query by;
optionally add a " ASC" for ascending or " DESC" for descendingGenericEntityExceptionpublic List<GenericValue> findByAnd(ModelEntity modelEntity, Map<String,?> fields, List<String> orderBy) throws GenericEntityException
findByAnd in interface DelegatorInterfacemodelEntity - the type of entity to find (required)fields - the names and values of the fields by which to query (can be null)orderBy - the names of fields by which to sort the results (can be null)GenericEntityExceptionpublic List<GenericValue> findByOr(String entityName, Map<String,?> fields, List<String> orderBy) throws GenericEntityException
findByOr in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesorderBy - The fields of the named entity to order the query by;
optionally add a " ASC" for ascending or " DESC" for descendingGenericEntityExceptionpublic List<GenericValue> findByAndCache(String entityName, Map<String,?> fields) throws GenericEntityException
findByAndCache in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesGenericEntityExceptionpublic List<GenericValue> findByAndCache(String entityName, Map<String,?> fields, List<String> orderBy) throws GenericEntityException
findByAndCache in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesorderBy - The fields of the named entity to order the query by;
optionally add " ASC" for ascending or " DESC" for descendingGenericEntityExceptionpublic List<GenericValue> findByAnd(String entityName, List<? extends EntityCondition> expressions) throws GenericEntityException
findByAnd in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML fileexpressions - The expressions to use for the lookup, each
consisting of at least a field name, an EntityOperator, and a value to
compare toGenericEntityExceptionpublic List<GenericValue> findByAnd(String entityName, List<? extends EntityCondition> expressions, List<String> orderBy) throws GenericEntityException
findByAnd in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML fileexpressions - The expressions to use for the lookup, each
consisting of at least a field name, an EntityOperator, and a value to
compare toorderBy - The fields of the named entity to order the query by;
optionally add " ASC" for ascending or " DESC" for descendingGenericEntityExceptionpublic List<GenericValue> findByOr(String entityName, List<? extends EntityCondition> expressions) throws GenericEntityException
findByOr in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML fileexpressions - The expressions to use for the lookup, each
consisting of at least a field name, an EntityOperator, and a value to
compare toGenericEntityExceptionpublic List<GenericValue> findByOr(String entityName, List<? extends EntityCondition> expressions, List<String> orderBy) throws GenericEntityException
findByOr in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML fileexpressions - The expressions to use for the lookup, each
consisting of at least a field name, an EntityOperator, and a value to compare toorderBy - The fields of the named entity to order the query by;
optionally add " ASC" for ascending or " DESC" for descendingGenericEntityExceptionpublic List<GenericValue> findByLike(String entityName, Map<String,?> fields) throws GenericEntityException
findByLike in interface DelegatorInterfaceGenericEntityExceptionpublic List<GenericValue> findByLike(String entityName, Map<String,?> fields, List<String> orderBy) throws GenericEntityException
findByLike in interface DelegatorInterfaceGenericEntityExceptionpublic List<GenericValue> findByCondition(String entityName, EntityCondition entityCondition, Collection<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException
findByCondition in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity model XML fileentityCondition - The EntityCondition object that specifies how to constrain this queryfieldsToSelect - The fields of the named entity to get from the
database; if empty or null all fields will be retreivedorderBy - The fields of the named entity by which to order the
query; optionally add " ASC" for ascending or " DESC" for descendingGenericEntityExceptionpublic int countByAnd(String entityName, String fieldName, List<? extends EntityCondition> expressions, EntityFindOptions findOptions) throws GenericEntityException
countByAnd in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity model XML filefieldName - The field of the named entity to count, if null this is equivalent to count(*)expressions - The expressions to use for the lookup, each
consisting of at least a field name, an EntityOperator, and a value to
compare tofindOptions - An instance of EntityFindOptions that specifies
advanced query options. The only option that is used is distinct, in
which case a select (distinct fieldname) is issued.If you issue a
distinct without a fieldName, it will be ignored because select
count (distinct *) makes no sense
GenericEntityExceptionpublic int countByOr(String entityName, String fieldName, List<? extends EntityCondition> expressions, EntityFindOptions findOptions) throws GenericEntityException
countByOr in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity model XML filefieldName - The field of the named entity to count, if null this is equivalent to count(*)expressions - The expressions to use for the lookup, each
consisting of at least a field name, an EntityOperator, and a value to compare tofindOptions - An instance of EntityFindOptions that specifies
advanced query options. The only option that is used is distinct, in
which case a select (distinct fieldname) is issued.If
you issue a distinct without a fieldName, it will be ignored because
select count (distinct *) makes no sense
GenericEntityExceptionpublic int countByCondition(String entityName, String fieldName, EntityCondition entityCondition, EntityFindOptions findOptions) throws GenericEntityException
countByCondition in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity model XML filefieldName - The field of the named entity to count, if null this is equivalent to count(*)entityCondition - The EntityCondition object that specifies how to
constrain this query The expressions to use for the lookup, each
consisting of at least a field name, an EntityOperator, and a value to
compare tofindOptions - An instance of EntityFindOptions that specifies
advanced query options. The only option that is used is distinct, in
which case a select (distinct fieldname) is issued.If you issue a
distinct without a fieldName, it will be ignored as select count
(distinct *) makes no sense
GenericEntityExceptionpublic int countAll(String entityName) throws GenericEntityException
countAll in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity model XML fileGenericEntityExceptionpublic EntityListIterator findListIteratorByCondition(String entityName, EntityCondition entityCondition, Collection<String> fieldsToSelect, List<String> orderBy) throws GenericEntityException
findListIteratorByCondition in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity model
XML fileentityCondition - The EntityCondition object that specifies how to
constrain this query before any groupings are done (if this is a view
entity with group-by aliases)fieldsToSelect - The fields of the named entity to get from the
database; if empty or null all fields will be retreivedorderBy - The fields of the named entity to order the query by;
optionally add " ASC" for ascending or " DESC" for descendingGenericEntityExceptionpublic EntityListIterator findListIteratorByCondition(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException
findListIteratorByCondition in interface DelegatorInterfaceentityName - The ModelEntity of the Entity as defined in the entity
XML filewhereEntityCondition - The EntityCondition object that specifies
how to constrain this query before any groupings are done (if this is a
view entity with group-by aliases)havingEntityCondition - The EntityCondition object that specifies
how to constrain this query after any groupings are done (if this is a
view entity with group-by aliases)fieldsToSelect - The fields of the named entity to get from the
database; if empty or null all fields will be retreivedorderBy - The fields of the named entity to order the query by;
optionally add " ASC" for ascending or " DESC" for descendingfindOptions - An instance of EntityFindOptions that specifies
advanced query options. See the EntityFindOptions JavaDoc for more
details.GenericEntityExceptionEntityConditionpublic int removeByPrimaryKey(GenericPK primaryKey) throws GenericEntityException
removeByPrimaryKey in interface DelegatorInterfaceprimaryKey - The primary key of the entity to remove.GenericEntityExceptionpublic int removeByPrimaryKey(GenericPK primaryKey, boolean doCacheClear) throws GenericEntityException
removeByPrimaryKey in interface DelegatorInterfaceprimaryKey - The primary key of the entity to remove.doCacheClear - boolean that specifies whether to clear cache entries for this primaryKey to be removedGenericEntityExceptionpublic int removeValue(GenericValue value) throws GenericEntityException
removeValue in interface DelegatorInterfacevalue - The GenericValue object of the entity to remove.GenericEntityExceptionpublic int removeValue(GenericValue value, boolean doCacheClear) throws GenericEntityException
removeValue in interface DelegatorInterfacevalue - The GenericValue object of the entity to remove.doCacheClear - boolean that specifies whether to clear cache entries for this value to be removedGenericEntityExceptionpublic int removeByAnd(String entityName, Map<String,?> fields) throws GenericEntityException
removeByAnd in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesGenericEntityExceptionpublic int removeByAnd(String entityName, Map<String,?> fields, boolean doCacheClear) throws GenericEntityException
removeByAnd in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuesdoCacheClear - boolean that specifies whether to clear cache entries for this value to be removedGenericEntityExceptionpublic int removeByCondition(String entityName, EntityCondition whereCondition) throws GenericEntityException
removeByCondition in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filewhereCondition - The EntityCondition object that specifies how to constrain this queryGenericEntityExceptionpublic int removeByCondition(String entityName, EntityCondition whereCondition, boolean doCacheClear) throws GenericEntityException
removeByCondition in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filewhereCondition - The EntityCondition object that specifies how to constrain this querydoCacheClear - boolean that specifies whether to clear cache entries for this value to be removedGenericEntityExceptionpublic List<GenericValue> getMultiRelation(GenericValue value, String relationNameOne, String relationNameTwo, List<String> orderBy) throws GenericEntityException
getMultiRelation in interface DelegatorInterfacerelationNameOne - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as
specified in the entity XML definition file, for first relationrelationNameTwo - String containing the relation name for second relationvalue - GenericValue instance containing the entityorderBy - The fields of the named entity to order the query by; may be null;
optionally add a " ASC" for ascending or " DESC" for descendingGenericEntityExceptionpublic List<GenericValue> getMultiRelation(GenericValue value, String relationNameOne, String relationNameTwo) throws GenericEntityException
getMultiRelation in interface DelegatorInterfacerelationNameOne - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as
specified in the entity XML definition file, for first relationrelationNameTwo - String containing the relation name for second relationvalue - GenericValue instance containing the entityGenericEntityExceptionpublic List<GenericValue> getRelated(String relationName, GenericValue value) throws GenericEntityException
getRelated in interface DelegatorInterfacerelationName - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as
specified in the entity XML definition filevalue - GenericValue instance containing the entityGenericEntityExceptionpublic List<GenericValue> getRelatedByAnd(String relationName, Map<String,?> byAndFields, GenericValue value) throws GenericEntityException
getRelatedByAnd in interface DelegatorInterfacerelationName - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as
specified in the entity XML definition filebyAndFields - the fields that must equal in order to keep; may be nullvalue - GenericValue instance containing the entityGenericEntityExceptionpublic List<GenericValue> getRelatedOrderBy(String relationName, List<String> orderBy, GenericValue value) throws GenericEntityException
getRelatedOrderBy in interface DelegatorInterfacerelationName - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as
specified in the entity XML definition fileorderBy - The fields of the named entity to order the query by; may be null;
optionally add a " ASC" for ascending or " DESC" for descendingvalue - GenericValue instance containing the entityGenericEntityExceptionpublic List<GenericValue> getRelated(String relationName, Map<String,?> byAndFields, List<String> orderBy, GenericValue value) throws GenericEntityException
getRelated in interface DelegatorInterfacerelationName - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as
specified in the entity XML definition filebyAndFields - the fields that must equal in order to keep; may be nullorderBy - The fields of the named entity to order the query by; may be null;
optionally add a " ASC" for ascending or " DESC" for descendingvalue - GenericValue instance containing the entityGenericEntityExceptionpublic GenericPK getRelatedDummyPK(String relationName, Map<String,?> byAndFields, GenericValue value) throws GenericEntityException
getRelatedDummyPK in interface DelegatorInterfacerelationName - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as
specified in the entity XML definition filebyAndFields - the fields that must equal in order to keep; may be nullvalue - GenericValue instance containing the entityGenericEntityExceptionpublic List<GenericValue> getRelatedCache(String relationName, GenericValue value) throws GenericEntityException
getRelatedCache in interface DelegatorInterfacerelationName - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as
specified in the entity XML definition filevalue - GenericValue instance containing the entityGenericEntityExceptionpublic GenericValue getRelatedOne(String relationName, GenericValue value) throws GenericEntityException
getRelatedOne in interface DelegatorInterfacerelationName - the name of the relation to get (required)value - the value whose relation to get (required)IllegalArgumentException - if the list found has more than one itemGenericEntityExceptionpublic GenericValue getRelatedOneCache(String relationName, GenericValue value) throws GenericEntityException
getRelatedOneCache in interface DelegatorInterfacerelationName - the name of the relation to get (required)value - the value whose relation to get (required)IllegalArgumentException - if the list found has more than one itemGenericEntityExceptionpublic int removeRelated(String relationName, GenericValue value) throws GenericEntityException
removeRelated in interface DelegatorInterfacerelationName - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as
specified in the entity XML definition filevalue - GenericValue instance containing the entityGenericEntityExceptionpublic int removeRelated(String relationName, GenericValue value, boolean doCacheClear) throws GenericEntityException
removeRelated in interface DelegatorInterfacerelationName - String containing the relation name which is the
combination of relation.title and relation.rel-entity-name as specified
in the entity XML definition filevalue - GenericValue instance containing the entitydoCacheClear - boolean that specifies whether to clear cache
entries for this value to be removedGenericEntityExceptionpublic void refresh(GenericValue value) throws GenericEntityException
refresh in interface DelegatorInterfacevalue - GenericValue instance containing the entity to refreshGenericEntityExceptionpublic void refresh(GenericValue value, boolean doCacheClear) throws GenericEntityException
refresh in interface DelegatorInterfacevalue - GenericValue instance containing the entity to refreshdoCacheClear - whether to automatically clear cache entries related to this operationGenericEntityExceptionpublic int store(GenericValue value) throws GenericEntityException
store in interface DelegatorInterfacevalue - GenericValue instance containing the entityGenericEntityExceptionpublic int store(GenericValue value, boolean doCacheClear) throws GenericEntityException
store in interface DelegatorInterfacevalue - GenericValue instance containing the entitydoCacheClear - whether to automatically clear cache entries related to this operationGenericEntityExceptionpublic int storeAll(List<? extends GenericValue> values) throws GenericEntityException
storeAll in interface DelegatorInterfacevalues - List of GenericValue instances containing the entities to storeGenericEntityExceptionpublic int storeAll(List<? extends GenericValue> values, boolean doCacheClear) throws GenericEntityException
storeAll in interface DelegatorInterfacevalues - List of GenericValue instances containing the entities to storedoCacheClear - whether to automatically clear cache entries related to this operationGenericEntityExceptionpublic int removeAll(List<? extends GenericEntity> dummyPKs) throws GenericEntityException
removeAll in interface DelegatorInterfacedummyPKs - Collection of GenericEntity instances containing the entities or by and fields to removeGenericEntityExceptionpublic int removeAll(List<? extends GenericEntity> dummyPKs, boolean doCacheClear) throws GenericEntityException
removeAll in interface DelegatorInterfacedummyPKs - Collection of GenericEntity instances containing the entities or by and fields to removedoCacheClear - whether to automatically clear cache entries related to this operationGenericEntityExceptionpublic void clearAllCaches()
clearAllCaches in interface DelegatorInterfacepublic void clearAllCaches(boolean distribute)
clearAllCaches in interface DelegatorInterfacepublic void clearCacheLine(String entityName, Map<String,?> fields)
clearCacheLine in interface DelegatorInterfaceentityName - The Name of the Entity as defined in the entity XML filefields - The fields of the named entity to query by with their corresponging valuespublic void clearCacheLineFlexible(GenericEntity dummyPK)
clearCacheLineFlexible in interface DelegatorInterfacedummyPK - The dummy primary key to clear by.public void clearCacheLineFlexible(GenericEntity dummyPK, boolean distribute)
clearCacheLineFlexible in interface DelegatorInterfacepublic void clearCacheLine(GenericPK primaryKey)
clearCacheLine in interface DelegatorInterfaceprimaryKey - The primary key to clear by.public void clearCacheLine(GenericPK primaryKey, boolean distribute)
clearCacheLine in interface DelegatorInterfacepublic void clearCacheLine(GenericValue value)
clearCacheLine in interface DelegatorInterfacevalue - The primary key to clear by.public void clearCacheLine(GenericValue value, boolean distribute)
clearCacheLine in interface DelegatorInterfacepublic Set<Set<String>> getFieldNameSetsCopy(String entityName)
getFieldNameSetsCopy in interface DelegatorInterfaceentityName - the entity for which to get the field names (can be null)public void clearAllCacheLinesByDummyPK(Collection<? extends GenericEntity> dummyPKs)
clearAllCacheLinesByDummyPK in interface DelegatorInterfacepublic void clearAllCacheLinesByValue(Collection<? extends GenericValue> values)
clearAllCacheLinesByValue in interface DelegatorInterfacepublic GenericValue getFromPrimaryKeyCache(GenericPK primaryKey)
getFromPrimaryKeyCache in interface DelegatorInterfacepublic List<GenericValue> getFromAllCache(String entityName)
getFromAllCache in interface DelegatorInterfacepublic List<GenericValue> getFromAndCache(String entityName, Map<String,?> fields)
getFromAndCache in interface DelegatorInterfacepublic List<GenericValue> getFromAndCache(ModelEntity entity, Map<String,?> fields)
getFromAndCache in interface DelegatorInterfacepublic void putInPrimaryKeyCache(GenericPK primaryKey, GenericValue value)
putInPrimaryKeyCache in interface DelegatorInterfacepublic void putAllInPrimaryKeyCache(List<? extends GenericValue> values)
putAllInPrimaryKeyCache in interface DelegatorInterfacepublic void putInAllCache(String entityName, List<? extends GenericValue> values)
putInAllCache in interface DelegatorInterfacepublic void putInAllCache(ModelEntity entity, List<? extends GenericValue> values)
putInAllCache in interface DelegatorInterfacepublic void putInAndCache(String entityName, Map<String,?> fields, List<? extends GenericValue> values)
putInAndCache in interface DelegatorInterfacepublic void putInAndCache(ModelEntity entity, Map<String,?> fields, List<? extends GenericValue> values)
putInAndCache in interface DelegatorInterfacepublic List<GenericValue> readXmlDocument(URL url) throws SAXException, ParserConfigurationException, IOException
url - the URL of the XML file (can be null)SAXExceptionParserConfigurationExceptionIOExceptionpublic List<GenericValue> makeValues(Document document)
document - the document to parse (can be null)public GenericValue makeValue(Element element)
public Long getNextSeqId(String seqName)
getNextSeqId in interface DelegatorInterfaceseqName - The name of the sequence to get the next seq id frompublic void setSequencer(SequenceUtil sequencer)
setSequencer in interface DelegatorInterfacesequencer - the sequencer to setpublic void refreshSequencer()
refreshSequencer in interface DelegatorInterfaceprotected void absorbList(List<GenericValue> lst)
public UtilCache<GenericEntity,GenericValue> getPrimaryKeyCache()
getPrimaryKeyCache in interface DelegatorInterfacepublic UtilCache<GenericPK,List<GenericValue>> getAndCache()
getAndCache in interface DelegatorInterfacepublic UtilCache<String,List<GenericValue>> getAllCache()
getAllCache in interface DelegatorInterfacepublic List<GenericValue> transform(String entityName, EntityCondition entityCondition, List<String> orderBy, String lockField, Transformation transformation) throws GenericEntityException
DelegatorInterfacetransform in interface DelegatorInterfaceentityName - the type of entity to transform (required)entityCondition - the condition that selects the entities to transform (null means transform all)orderBy - the order in which the entities should be selected for updating (null means no ordering)lockField - the entity field to use for optimistic locking; the value of this field will be read
between the SELECT and the UPDATE to determine whether another process has updated one of the target records in
the meantime; if so, the transformation will be reapplied and another UPDATE attemptedtransformation - the transformation to apply (required)GenericEntityExceptionCopyright © 2016 Atlassian. All rights reserved.