Interface Delegator
- All Known Implementing Classes:
GenericDelegator
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clearAllCacheLinesByDummyPK
(Collection<GenericPK> dummyPKs) void
void
This method is a shortcut to completely clear all entity engine caches.void
clearAllCaches
(boolean distribute) void
clearCacheLine
(String entityName) Remove all CACHED Generic Entity (List) from the cachevoid
clearCacheLine
(String entityName, Object... fields) Remove a CACHED Generic Entity (List) from the cache, either a PK, ByAnd, or Allvoid
clearCacheLine
(String entityName, Map<String, ? extends Object> fields) Remove a CACHED Generic Entity (List) from the cache, either a PK, ByAnd, or Allvoid
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
clearCacheLineByCondition
(String entityName, EntityCondition condition) void
clearCacheLineByCondition
(String entityName, EntityCondition condition, boolean distribute) void
clearCacheLineFlexible
(GenericEntity dummyPK) Remove a CACHED Generic Entity from the cache by its primary key.void
clearCacheLineFlexible
(GenericEntity dummyPK, boolean distribute) cloneDelegator
(String delegatorName) Creates a Entity in the form of a GenericValue and write it to the databaseCreates a Entity in the form of a GenericValue and write it to the databaseCreates a Entity in the form of a GenericValue and write it to the datasourcecreate
(GenericValue value) Creates a Entity in the form of a GenericValue and write it to the datasourcecreateOrStore
(GenericValue value) Creates or stores an EntitycreateSetNextSeqId
(GenericValue value) Sets the sequenced ID (for entity with one primary key field ONLY), and then does a create in the database as normal.createSingle
(String entityName, Object singlePkValue) Creates a Entity in the form of a GenericValue and write it to the databasedecryptFieldValue
(String entityName, ModelField.EncryptMethod encryptMethod, String encValue) encryptFieldValue
(String entityName, ModelField.EncryptMethod encryptMethod, Object fieldValue) find
(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.Finds all Generic entitiesfindByAnd
(String entityName, Map<String, ? extends Object> fields, List<String> orderBy, boolean useCache) Finds Generic Entity records by all of the specified fields (ie: combined using AND), looking first in the cache; uses orderBy for lookup, but only keys results on the entityName and fieldsfindByPrimaryKeyPartial
(GenericPK primaryKey, Set<String> keys) Find a Generic Entity by its Primary Key and only returns the values requested by the passed keys (names).long
findCountByCondition
(String entityName, EntityCondition whereEntityCondition, Set<String> fieldsToSelect, EntityCondition havingEntityCondition, EntityFindOptions findOptions) Gets the hit count of GenericValues for the given EntityCondition objects.long
findCountByCondition
(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, EntityFindOptions findOptions) Gets the hit count of GenericValues for the given EntityCondition objects.findList
(String entityName, EntityCondition entityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions, boolean useCache) Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.findList
(String entityName, EntityCondition entityCondition, EntityCondition havingEntityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions, boolean useCache) Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.findListIteratorByCondition
(DynamicViewEntity dynamicViewEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.Find a Generic Entity by its primary key.Find a Generic Entity by its Primary KeygetCache()
<T> EntityEcaHandler<T>
getEntityFieldType
(ModelEntity entity, String type) Gets a field type instance by name from the helper that corresponds to the specified entitygetEntityGroupName
(String entityName) Gets the helper name that corresponds to this delegator and the specified entityNamegetEntityHelper
(String entityName) Gets the an instance of helper that corresponds to this delegator and the specified entityNamegetEntityHelper
(ModelEntity entity) Gets the an instance of helper that corresponds to this delegator and the specified entitygetEntityHelperName
(String entityName) Gets the helper name that corresponds to this delegator and the specified entityNamegetEntityHelperName
(ModelEntity entity) Gets the helper name that corresponds to this delegator and the specified entitygetFromPrimaryKeyCache
(GenericPK primaryKey) getGroupHelperInfo
(String entityGroupName) getGroupHelperName
(String groupName) Gets the helper name that corresponds to this delegator and the specified entityNamegetModelEntity
(String entityName) Gets the instance of ModelEntity that corresponds to this delegator and the specified entityNamegetModelEntityMapByGroup
(String groupName) Gets a Map of entity name and entity model pairs that are in the named groupgetModelFieldTypeReader
(ModelEntity entity) Gets the instance of ModelGroupReader that corresponds to this delegatorGets the instance of ModelReader that corresponds to this delegatorgetMultiRelation
(GenericValue value, String relationNameOne, String relationNameTwo, List<String> orderBy) Get the named Related Entity for the GenericValue from the persistent store across another Relation.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 createdgetNextSeqId
(String seqName, long staggerMax) 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 createdgetNextSeqIdLong
(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 createdgetNextSeqIdLong
(String seqName, long staggerMax) 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 createdGets the name of the server configuration that corresponds to this delegatorgetRelated
(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy, GenericValue value, boolean useCache) Get the named Related Entity for the GenericValue from the persistent storegetRelatedDummyPK
(String relationName, Map<String, ? extends Object> byAndFields, GenericValue value) Get a dummy primary key for the named Related Entity for the GenericValue.getRelatedOne
(String relationName, GenericValue value, boolean useCache) Get related entity where relation is of type one, uses findByPrimaryKeyvoid
void
Creates a Primary Key in the form of a GenericPK without persisting itCreates a Primary Key in the form of a GenericPK without persisting itCreates a Primary Key in the form of a GenericPK without persisting itmakePKSingle
(String entityName, Object singlePkValue) Creates a Primary Key in the form of a GenericPK without persisting itmakeTestDelegator
(String delegatorName) makeValidValue
(String entityName, Object... fields) Creates a Entity in the form of a GenericValue without persisting it; only valid fields will be pulled from the fields MapmakeValidValue
(String entityName, Map<String, ? extends Object> fields) Creates a Entity in the form of a GenericValue without persisting it; only valid fields will be pulled from the fields MapCreates a Entity in the form of a GenericValue without persisting itCreates a Entity in the form of a GenericValue without persisting itCreates a Entity in the form of a GenericValue without persisting itmakeValues
(Document document) makeValueSingle
(String entityName, Object singlePkValue) Creates a Entity in the form of a GenericValue without persisting itvoid
putAllInPrimaryKeyCache
(List<GenericValue> values) void
putInPrimaryKeyCache
(GenericPK primaryKey, GenericValue value) readXmlDocument
(URL url) void
refresh
(GenericValue value) Refresh the Entity for the GenericValue from the persistent storevoid
refreshFromCache
(GenericValue value) Refresh the Entity for the GenericValue from the cachevoid
Refreshes the ID sequencer clearing all cached bank values.int
int
removeAll
(List<? extends GenericEntity> dummyPKs) Remove the Entities from the List from the persistent store.int
removeByAnd
(String entityName, Object... fields) Removes/deletes Generic Entity records found by all of the specified fields (ie: combined using AND)int
removeByAnd
(String entityName, Map<String, ? extends Object> fields) Removes/deletes Generic Entity records found by all of the specified fields (ie: combined using AND)int
removeByCondition
(String entityName, EntityCondition condition) Removes/deletes Generic Entity records found by the conditionint
removeByPrimaryKey
(GenericPK primaryKey) Remove a Generic Entity corresponding to the primaryKeyint
removeRelated
(String relationName, GenericValue value) Remove the named Related Entity for the GenericValue from the persistent storeint
removeValue
(GenericValue value) Remove a Generic Value from the databasevoid
rollback()
void
setDistributedCacheClear
(DistributedCacheClear distributedCacheClear) void
setEntityCrypto
(EntityCrypto crypto) <T> void
setEntityEcaHandler
(EntityEcaHandler<T> entityEcaHandler) void
setNextSubSeqId
(GenericValue value, String seqFieldName, int numericPadding, int incrementBy) Look at existing values for a sub-entity with a sequenced secondary ID, and get the highest plus 1void
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 storeint
storeAll
(List<GenericValue> values) Store the Entities from the List GenericValue instances to the persistent store.int
storeAll
(List<GenericValue> values, EntityStoreOptions storeOptions) Store the Entities from the List GenericValue instances to the persistent store.int
storeByCondition
(String entityName, Map<String, ? extends Object> fieldsToSet, EntityCondition condition) Store a group of values.boolean
Get use of Distributed Cache Clear mechanism status
-
Method Details
-
clearAllCacheLinesByDummyPK
-
clearAllCacheLinesByValue
-
clearAllCaches
void clearAllCaches()This method is a shortcut to completely clear all entity engine caches. For performance reasons this should not be called very often. -
clearAllCaches
void clearAllCaches(boolean distribute) -
clearCacheLine
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. Also tries to clear the corresponding all cache entry.- Parameters:
primaryKey
- The primary key to clear by.
-
clearCacheLine
-
clearCacheLine
Remove a CACHED GenericValue from as many caches as it can. Automatically tries to remove entries from the all cache, the by primary key cache, and the by and cache. This is the ONLY method that tries to clear automatically from the by and cache.- Parameters:
value
- The GenericValue to clear by.
-
clearCacheLine
-
clearCacheLine
Remove all CACHED Generic Entity (List) from the cache- Parameters:
entityName
- The Name of the Entity as defined in the entity XML file
-
clearCacheLine
Remove a CACHED Generic Entity (List) from the cache, either a PK, ByAnd, or All- Parameters:
entityName
- The Name of the Entity as defined in the entity XML filefields
- The fields of the named entity to query by with their corresponding values
-
clearCacheLine
Remove a CACHED Generic Entity (List) from the cache, either a PK, ByAnd, or All- Parameters:
entityName
- The Name of the Entity as defined in the entity XML filefields
- The fields of the named entity to query by with their corresponding values
-
clearCacheLineByCondition
-
clearCacheLineByCondition
-
clearCacheLineFlexible
Remove a CACHED Generic Entity from the cache by its primary key. Checks to see if the passed GenericPK is a complete primary key, if it is then the cache line will be removed from the primaryKeyCache; if it is NOT a complete primary key it will remove the cache line from the andCache. If the fields map is empty, then the allCache for the entity will be cleared.- Parameters:
dummyPK
- The dummy primary key to clear by.
-
clearCacheLineFlexible
-
cloneDelegator
Delegator cloneDelegator() -
cloneDelegator
-
create
Creates a Entity in the form of a GenericValue and write it to the datasource- Parameters:
primaryKey
- The GenericPK to create a value in the datasource from- Returns:
- GenericValue instance containing the new instance
- Throws:
GenericEntityException
-
create
Creates a Entity in the form of a GenericValue and write it to the datasource- Parameters:
value
- The GenericValue to create a value in the datasource from- Returns:
- GenericValue instance containing the new instance
- Throws:
GenericEntityException
-
create
GenericValue create(String entityName, Map<String, ? extends Object> fields) throws GenericEntityExceptionCreates a Entity in the form of a GenericValue and write it to the database- Returns:
- GenericValue instance containing the new instance
- Throws:
GenericEntityException
-
create
Creates a Entity in the form of a GenericValue and write it to the database- Returns:
- GenericValue instance containing the new instance
- Throws:
GenericEntityException
-
createOrStore
Creates or stores an Entity- Parameters:
value
- The GenericValue instance containing the new or existing instance- Returns:
- GenericValue instance containing the new or updated instance
- Throws:
GenericEntityException
-
createSetNextSeqId
Sets the sequenced ID (for entity with one primary key field ONLY), and then does a create in the database as normal. The reason to do it this way is that it will retry and fix the sequence if somehow the sequencer is in a bad state and returning a value that already exists.- Parameters:
value
- The GenericValue to create a value in the datasource from- Returns:
- GenericValue instance containing the new instance
- Throws:
GenericEntityException
-
createSingle
Creates a Entity in the form of a GenericValue and write it to the database- Returns:
- GenericValue instance containing the new instance
- Throws:
GenericEntityException
-
decryptFieldValue
Object decryptFieldValue(String entityName, ModelField.EncryptMethod encryptMethod, String encValue) throws EntityCryptoException - Throws:
EntityCryptoException
-
encryptFieldValue
Object encryptFieldValue(String entityName, ModelField.EncryptMethod encryptMethod, Object fieldValue) throws EntityCryptoException - Throws:
EntityCryptoException
-
find
EntityListIterator find(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.- Parameters:
entityName
- The name 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 a " ASC" for ascending or " DESC" for descendingfindOptions
- An instance of EntityFindOptions that specifies advanced query options. See the EntityFindOptions JavaDoc for more details.- Returns:
- EntityListIterator representing the result of the query: NOTE THAT THIS MUST BE CLOSED (preferably in a finally block) WHEN YOU ARE DONE WITH IT, AND DON'T LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION.
- Throws:
GenericEntityException
-
findAll
Finds all Generic entities- Parameters:
entityName
- The Name of the Entity as defined in the entity XML fileuseCache
- Whether to cache the results- Returns:
- List containing all Generic entities
- Throws:
GenericEntityException
-
findByAnd
List<GenericValue> findByAnd(String entityName, Map<String, ? extends Object> fields, List<String> orderBy, boolean useCache) throws GenericEntityExceptionFinds Generic Entity records by all of the specified fields (ie: combined using AND), looking first in the cache; uses orderBy for lookup, but only keys results on the entityName and fields- Parameters:
entityName
- The Name of the Entity as defined in the entity XML filefields
- The fields of the named entity to query by with their corresponding valuesorderBy
- The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descendinguseCache
- Whether to cache the results- Returns:
- List of GenericValue instances that match the query
- Throws:
GenericEntityException
-
findByPrimaryKeyPartial
GenericValue findByPrimaryKeyPartial(GenericPK primaryKey, Set<String> keys) throws GenericEntityException Find a Generic Entity by its Primary Key and only returns the values requested by the passed keys (names).- Parameters:
primaryKey
- The primary key to find by.keys
- The keys, or names, of the values to retrieve; only these values will be retrieved- Returns:
- The GenericValue corresponding to the primaryKey
- Throws:
GenericEntityException
-
findCountByCondition
long findCountByCondition(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, EntityFindOptions findOptions) throws GenericEntityException Gets the hit count of GenericValues for the given EntityCondition objects.- Parameters:
entityName
-whereEntityCondition
-havingEntityCondition
-findOptions
-- Returns:
- long value with hit count
- Throws:
GenericEntityException
-
findCountByCondition
long findCountByCondition(String entityName, EntityCondition whereEntityCondition, Set<String> fieldsToSelect, EntityCondition havingEntityCondition, EntityFindOptions findOptions) throws GenericEntityException Gets the hit count of GenericValues for the given EntityCondition objects.- Parameters:
entityName
-whereEntityCondition
-fieldsToSelect
-havingEntityCondition
-findOptions
-- Returns:
- long value with hit count
- Throws:
GenericEntityException
-
findList
List<GenericValue> findList(String entityName, EntityCondition entityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions, boolean useCache) throws GenericEntityException Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.- Parameters:
entityName
- The name of the Entity as defined in the entity 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 retrievedorderBy
- The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descendingfindOptions
- An instance of EntityFindOptions that specifies advanced query options. See the EntityFindOptions JavaDoc for more details.- Returns:
- List of GenericValue objects representing the result
- Throws:
GenericEntityException
-
findList
List<GenericValue> findList(String entityName, EntityCondition entityCondition, EntityCondition havingEntityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions, boolean useCache) throws GenericEntityException Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.- Parameters:
entityName
- The name of the Entity as defined in the entity 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)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 retrievedorderBy
- The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descendingfindOptions
- An instance of EntityFindOptions that specifies advanced query options. See the EntityFindOptions JavaDoc for more details.- Returns:
- List of GenericValue objects representing the result
- Throws:
GenericEntityException
-
findListIteratorByCondition
EntityListIterator findListIteratorByCondition(DynamicViewEntity dynamicViewEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.- Parameters:
dynamicViewEntity
- The DynamicViewEntity to use for the entity model for this query; generally created on the fly for limited usewhereEntityCondition
- 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 a " ASC" for ascending or " DESC" for descendingfindOptions
- An instance of EntityFindOptions that specifies advanced query options. See the EntityFindOptions JavaDoc for more details.- Returns:
- EntityListIterator representing the result of the query: NOTE THAT THIS MUST BE CLOSED WHEN YOU ARE DONE WITH IT, AND DON'T LEAVE IT OPEN TOO LONG BEACUSE IT WILL MAINTAIN A DATABASE CONNECTION.
- Throws:
GenericEntityException
-
findOne
GenericValue findOne(String entityName, boolean useCache, Object... fields) throws GenericEntityException Find a Generic Entity by its primary key.- Parameters:
entityName
- The Name of the Entity as defined in the entity XML fileuseCache
- Retrieve the Generic Entity from the cache whentrue
fields
- The fields of the named entity to query by with their corresponding values- Returns:
- The Generic Entity corresponding to the primary key
- Throws:
GenericEntityException
-
findOne
GenericValue findOne(String entityName, Map<String, ? extends Object> fields, boolean useCache) throws GenericEntityExceptionFind a Generic Entity by its Primary Key- Parameters:
entityName
- The Name of the Entity as defined in the entity XML filefields
- The fields of the named entity to query by with their corresponding values- Returns:
- The GenericValue corresponding to the primaryKey
- Throws:
GenericEntityException
-
getCache
Cache getCache() -
getCurrentSessionIdentifier
String getCurrentSessionIdentifier() -
getCurrentUserIdentifier
String getCurrentUserIdentifier() -
getDelegatorName
String getDelegatorName() -
getDelegatorBaseName
String getDelegatorBaseName() -
getDelegatorTenantId
String getDelegatorTenantId() -
getEntityEcaHandler
-
getEntityFieldType
Gets a field type instance by name from the helper that corresponds to the specified entity- Parameters:
entity
- The entitytype
- The name of the type- Returns:
- ModelFieldType instance for the named type from the helper that corresponds to the specified entity
- Throws:
GenericEntityException
-
getEntityGroupName
Gets the helper name that corresponds to this delegator and the specified entityName- Parameters:
entityName
- The name of the entity to get the helper for- Returns:
- String with the helper name that corresponds to this delegator and the specified entityName
-
getEntityHelper
Gets the an instance of helper that corresponds to this delegator and the specified entity- Parameters:
entity
- The entity to get the helper for- Returns:
- GenericHelper that corresponds to this delegator and the specified entity
- Throws:
GenericEntityException
-
getEntityHelper
Gets the an instance of helper that corresponds to this delegator and the specified entityName- Parameters:
entityName
- The name of the entity to get the helper for- Returns:
- GenericHelper that corresponds to this delegator and the specified entityName
- Throws:
GenericEntityException
-
getEntityHelperName
Gets the helper name that corresponds to this delegator and the specified entity- Parameters:
entity
- The entity to get the helper for- Returns:
- String with the helper name that corresponds to this delegator and the specified entity
-
getEntityHelperName
Gets the helper name that corresponds to this delegator and the specified entityName- Parameters:
entityName
- The name of the entity to get the helper name for- Returns:
- String with the helper name that corresponds to this delegator and the specified entityName
-
getFromPrimaryKeyCache
-
getGroupHelperName
Gets the helper name that corresponds to this delegator and the specified entityName- Parameters:
groupName
- The name of the group to get the helper name for- Returns:
- String with the helper name that corresponds to this delegator and the specified entityName
-
getGroupHelperInfo
-
getModelEntity
Gets the instance of ModelEntity that corresponds to this delegator and the specified entityName- Parameters:
entityName
- The name of the entity to get- Returns:
- ModelEntity that corresponds to this delegator and the specified entityName
-
getModelEntityMapByGroup
Gets a Map of entity name and entity model pairs that are in the named group- Parameters:
groupName
- The name of the group- Returns:
- Map of entityName String keys and ModelEntity instance values
- Throws:
GenericEntityException
-
getModelFieldTypeReader
-
getModelGroupReader
ModelGroupReader getModelGroupReader()Gets the instance of ModelGroupReader that corresponds to this delegator- Returns:
- ModelGroupReader that corresponds to this delegator
-
getModelReader
ModelReader getModelReader()Gets the instance of ModelReader that corresponds to this delegator- Returns:
- ModelReader that corresponds to this delegator
-
getMultiRelation
List<GenericValue> getMultiRelation(GenericValue value, String relationNameOne, String relationNameTwo, List<String> orderBy) throws GenericEntityException Get the named Related Entity for the GenericValue from the persistent store across another Relation. Helps to get related Values in a multi-to-multi relationship.- Parameters:
relationNameOne
- 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 descending- Returns:
- List of GenericValue instances as specified in the relation definition
- Throws:
GenericEntityException
-
getNextSeqId
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- Parameters:
seqName
- The name of the sequence to get the next seq id from- Returns:
- String with the next sequenced id for the given sequence name
-
getNextSeqId
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- Parameters:
seqName
- The name of the sequence to get the next seq id fromstaggerMax
- The maximum amount to stagger the sequenced ID, if 1 the sequence will be incremented by 1, otherwise the current sequence ID will be incremented by a value between 1 and staggerMax- Returns:
- Long with the next seq id for the given sequence name
-
getNextSeqIdLong
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- Parameters:
seqName
- The name of the sequence to get the next seq id from- Returns:
- Long with the next sequenced id for the given sequence name
-
getNextSeqIdLong
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- Parameters:
seqName
- The name of the sequence to get the next seq id fromstaggerMax
- The maximum amount to stagger the sequenced ID, if 1 the sequence will be incremented by 1, otherwise the current sequence ID will be incremented by a value between 1 and staggerMax- Returns:
- Long with the next seq id for the given sequence name
-
getOriginalDelegatorName
String getOriginalDelegatorName()Gets the name of the server configuration that corresponds to this delegator- Returns:
- server configuration name
-
getRelated
List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy, GenericValue value, boolean useCache) throws GenericEntityExceptionGet the named Related Entity for the GenericValue from the persistent store- Parameters:
relationName
- 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 entityuseCache
- Whether to cache the results- Returns:
- List of GenericValue instances as specified in the relation definition
- Throws:
GenericEntityException
-
getRelatedDummyPK
GenericPK getRelatedDummyPK(String relationName, Map<String, ? extends Object> byAndFields, GenericValue value) throws GenericEntityExceptionGet a dummy primary key for the named Related Entity for the GenericValue.- Parameters:
relationName
- 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 entity- Returns:
- GenericPK containing a possibly incomplete PrimaryKey object representing the related entity or entities
- Throws:
GenericEntityException
-
getRelatedOne
GenericValue getRelatedOne(String relationName, GenericValue value, boolean useCache) throws GenericEntityException Get related entity where relation is of type one, uses findByPrimaryKey- Parameters:
relationName
- 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 entityuseCache
- Whether to cache the results- Returns:
- GenericValue that is the related entity
- Throws:
IllegalArgumentException
- if the list found has more than one itemGenericEntityException
-
initEntityEcaHandler
void initEntityEcaHandler() -
initDistributedCacheClear
void initDistributedCacheClear() -
makePK
-
makePK
Creates a Primary Key in the form of a GenericPK without persisting it -
makePK
Creates a Primary Key in the form of a GenericPK without persisting it -
makePK
Creates a Primary Key in the form of a GenericPK without persisting it -
makePKSingle
Creates a Primary Key in the form of a GenericPK without persisting it -
makeTestDelegator
-
makeValidValue
Creates a Entity in the form of a GenericValue without persisting it; only valid fields will be pulled from the fields Map -
makeValidValue
Creates a Entity in the form of a GenericValue without persisting it; only valid fields will be pulled from the fields Map -
makeValue
-
makeValue
Creates a Entity in the form of a GenericValue without persisting it -
makeValue
Creates a Entity in the form of a GenericValue without persisting it -
makeValue
Creates a Entity in the form of a GenericValue without persisting it -
makeValues
-
makeValueSingle
Creates a Entity in the form of a GenericValue without persisting it -
putAllInPrimaryKeyCache
-
putInPrimaryKeyCache
-
readXmlDocument
List<GenericValue> readXmlDocument(URL url) throws SAXException, ParserConfigurationException, IOException -
refresh
Refresh the Entity for the GenericValue from the persistent store- Parameters:
value
- GenericValue instance containing the entity to refresh- Throws:
GenericEntityException
-
refreshFromCache
Refresh the Entity for the GenericValue from the cache- Parameters:
value
- GenericValue instance containing the entity to refresh- Throws:
GenericEntityException
-
refreshSequencer
void refreshSequencer()Refreshes the ID sequencer clearing all cached bank values. -
removeAll
Remove the Entities from the List from the persistent store.
The List contains GenericEntity objects, can be either GenericPK or GenericValue.
If a certain entity contains a complete primary key, the entity in the datasource corresponding to that primary key will be removed, this is like a removeByPrimary Key.
On the other hand, if a certain entity is an incomplete or non primary key, if will behave like the removeByAnd method.
These updates all happen in one transaction, so they will either all succeed or all fail, if the data source supports transactions.
- Parameters:
dummyPKs
- Collection of GenericEntity instances containing the entities or by and fields to remove- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
removeAll
- Throws:
GenericEntityException
-
removeByAnd
int removeByAnd(String entityName, Map<String, ? extends Object> fields) throws GenericEntityExceptionRemoves/deletes Generic Entity records found by all of the specified fields (ie: combined using AND)- Parameters:
entityName
- The Name of the Entity as defined in the entity XML filefields
- The fields of the named entity to query by with their corresponding values- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
removeByAnd
Removes/deletes Generic Entity records found by all of the specified fields (ie: combined using AND)- Parameters:
entityName
- The Name of the Entity as defined in the entity XML filefields
- The fields of the named entity to query by with their corresponding values- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
removeByCondition
Removes/deletes Generic Entity records found by the condition- Parameters:
entityName
- The Name of the Entity as defined in the entity XML filecondition
- The condition used to restrict the removing- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
removeByPrimaryKey
Remove a Generic Entity corresponding to the primaryKey- Parameters:
primaryKey
- The primary key of the entity to remove.- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
removeRelated
Remove the named Related Entity for the GenericValue from the persistent store- Parameters:
relationName
- 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 entity- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
removeValue
Remove a Generic Value from the database- Parameters:
value
- The GenericValue object of the entity to remove.- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
rollback
void rollback() -
setDistributedCacheClear
-
setEntityCrypto
-
setEntityEcaHandler
-
setNextSubSeqId
Look at existing values for a sub-entity with a sequenced secondary ID, and get the highest plus 1 -
setSequencer
Allows you to pass a SequenceUtil class (possibly one that overrides the getNextSeqId method); if null is passed will effectively refresh the sequencer. -
store
Store the Entity from the GenericValue to the persistent store- Parameters:
value
- GenericValue instance containing the entity- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
storeAll
Store the Entities from the List GenericValue instances to the persistent store.
This is different than the normal store method in that the store method only does an update, while the storeAll method checks to see if each entity exists, then either does an insert or an update as appropriate.
These updates all happen in one transaction, so they will either all succeed or all fail, if the data source supports transactions. This is just like to othersToStore feature of the GenericEntity on a create or store.
- Parameters:
values
- List of GenericValue instances containing the entities to store- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
storeAll
int storeAll(List<GenericValue> values, EntityStoreOptions storeOptions) throws GenericEntityException Store the Entities from the List GenericValue instances to the persistent store.
This is different than the normal store method in that the store method only does an update, while the storeAll method checks to see if each entity exists, then either does an insert or an update as appropriate.
These updates all happen in one transaction, so they will either all succeed or all fail, if the data source supports transactions. This is just like to othersToStore feature of the GenericEntity on a create or store.
- Parameters:
storeOptions
- An instance of EntityStoreOptions that specifies advanced store options or null for default values. See the EntityStoreOptions JavaDoc for more details.values
- List of GenericValue instances containing the entities to store- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
storeByCondition
int storeByCondition(String entityName, Map<String, ? extends Object> fieldsToSet, EntityCondition condition) throws GenericEntityExceptionStore a group of values.- Parameters:
entityName
- The name of the Entity as defined in the entity XML filefieldsToSet
- The fields of the named entity to set in the databasecondition
- The condition that restricts the list of stored values- Returns:
- int representing number of rows effected by this operation
- Throws:
GenericEntityException
-
useDistributedCacheClear
boolean useDistributedCacheClear()Get use of Distributed Cache Clear mechanism status- Returns:
- boolean true if this delegator uses a Distributed Cache Clear mechanism
-