Class GenericDelegator

java.lang.Object
org.apache.ofbiz.entity.GenericDelegator
All Implemented Interfaces:
Delegator

public class GenericDelegator extends Object implements Delegator
The default implementation of the Delegator interface.
  • Constructor Details

    • GenericDelegator

      protected GenericDelegator()
      Only allow creation through the factory method
    • GenericDelegator

      protected GenericDelegator(String delegatorFullName) throws GenericEntityException
      Only allow creation through the factory method
      Throws:
      GenericEntityException
  • Method Details

    • getUserIdentifierStack

      protected static List<String> getUserIdentifierStack()
    • pushUserIdentifier

      public static void pushUserIdentifier(String userIdentifier)
    • popUserIdentifier

      public static String popUserIdentifier()
    • clearUserIdentifierStack

      public static void clearUserIdentifierStack()
    • getSessionIdentifierStack

      protected static List<String> getSessionIdentifierStack()
    • pushSessionIdentifier

      public static void pushSessionIdentifier(String sessionIdentifier)
    • popSessionIdentifier

      public static String popSessionIdentifier()
    • clearSessionIdentifierStack

      public static void clearSessionIdentifierStack()
    • createHelperCallable

      protected Callable<Void> createHelperCallable(String groupName)
      Create helper callable callable.
      Parameters:
      groupName - the group name
      Returns:
      the callable
    • setDelegatorNames

      protected void setDelegatorNames(String delegatorFullName)
      Sets delegator names.
      Parameters:
      delegatorFullName - the delegator full name
    • initEntityEcaHandler

      public void initEntityEcaHandler()
      Specified by:
      initEntityEcaHandler in interface Delegator
    • createEntityEcaHandler

      protected EntityEcaHandler<?> createEntityEcaHandler()
      Create entity eca handler entity eca handler.
      Returns:
      the entity eca handler
    • getDelegatorName

      public String getDelegatorName()
      Specified by:
      getDelegatorName in interface Delegator
    • getDelegatorBaseName

      public String getDelegatorBaseName()
      Specified by:
      getDelegatorBaseName in interface Delegator
    • getDelegatorTenantId

      public String getDelegatorTenantId()
      Specified by:
      getDelegatorTenantId in interface Delegator
    • getOriginalDelegatorName

      public String getOriginalDelegatorName()
      Description copied from interface: Delegator
      Gets the name of the server configuration that corresponds to this delegator
      Specified by:
      getOriginalDelegatorName in interface Delegator
      Returns:
      server configuration name
    • getModelReader

      public ModelReader getModelReader()
      Description copied from interface: Delegator
      Gets the instance of ModelReader that corresponds to this delegator
      Specified by:
      getModelReader in interface Delegator
      Returns:
      ModelReader that corresponds to this delegator
    • getModelGroupReader

      public ModelGroupReader getModelGroupReader()
      Description copied from interface: Delegator
      Gets the instance of ModelGroupReader that corresponds to this delegator
      Specified by:
      getModelGroupReader in interface Delegator
      Returns:
      ModelGroupReader that corresponds to this delegator
    • getModelEntity

      public ModelEntity getModelEntity(String entityName)
      Description copied from interface: Delegator
      Gets the instance of ModelEntity that corresponds to this delegator and the specified entityName
      Specified by:
      getModelEntity in interface Delegator
      Parameters:
      entityName - The name of the entity to get
      Returns:
      ModelEntity that corresponds to this delegator and the specified entityName
    • getEntityGroupName

      public String getEntityGroupName(String entityName)
      Description copied from interface: Delegator
      Gets the helper name that corresponds to this delegator and the specified entityName
      Specified by:
      getEntityGroupName in interface Delegator
      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
    • getModelEntityMapByGroup

      public Map<String,ModelEntity> getModelEntityMapByGroup(String groupName) throws GenericEntityException
      Description copied from interface: Delegator
      Gets a Map of entity name and entity model pairs that are in the named group
      Specified by:
      getModelEntityMapByGroup in interface Delegator
      Parameters:
      groupName - The name of the group
      Returns:
      Map of entityName String keys and ModelEntity instance values
      Throws:
      GenericEntityException
    • getGroupHelperName

      public String getGroupHelperName(String groupName)
      Description copied from interface: Delegator
      Gets the helper name that corresponds to this delegator and the specified entityName
      Specified by:
      getGroupHelperName in interface Delegator
      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

      public GenericHelperInfo getGroupHelperInfo(String entityGroupName)
      Specified by:
      getGroupHelperInfo in interface Delegator
    • getEntityHelperInfo

      protected GenericHelperInfo getEntityHelperInfo(String entityName)
      Gets entity helper info.
      Parameters:
      entityName - the entity name
      Returns:
      the entity helper info
    • getEntityHelperName

      public String getEntityHelperName(String entityName)
      Description copied from interface: Delegator
      Gets the helper name that corresponds to this delegator and the specified entityName
      Specified by:
      getEntityHelperName in interface Delegator
      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
    • getEntityHelperName

      public String getEntityHelperName(ModelEntity entity)
      Description copied from interface: Delegator
      Gets the helper name that corresponds to this delegator and the specified entity
      Specified by:
      getEntityHelperName in interface Delegator
      Parameters:
      entity - The entity to get the helper for
      Returns:
      String with the helper name that corresponds to this delegator and the specified entity
    • getEntityHelper

      public GenericHelper getEntityHelper(String entityName) throws GenericEntityException
      Description copied from interface: Delegator
      Gets the an instance of helper that corresponds to this delegator and the specified entityName
      Specified by:
      getEntityHelper in interface Delegator
      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
    • getEntityHelper

      public GenericHelper getEntityHelper(ModelEntity entity) throws GenericEntityException
      Description copied from interface: Delegator
      Gets the an instance of helper that corresponds to this delegator and the specified entity
      Specified by:
      getEntityHelper in interface Delegator
      Parameters:
      entity - The entity to get the helper for
      Returns:
      GenericHelper that corresponds to this delegator and the specified entity
      Throws:
      GenericEntityException
    • getEntityFieldType

      public ModelFieldType getEntityFieldType(ModelEntity entity, String type) throws GenericEntityException
      Description copied from interface: Delegator
      Gets a field type instance by name from the helper that corresponds to the specified entity
      Specified by:
      getEntityFieldType in interface Delegator
      Parameters:
      entity - The entity
      type - The name of the type
      Returns:
      ModelFieldType instance for the named type from the helper that corresponds to the specified entity
      Throws:
      GenericEntityException
    • getModelFieldTypeReader

      public ModelFieldTypeReader getModelFieldTypeReader(ModelEntity entity)
      Specified by:
      getModelFieldTypeReader in interface Delegator
    • makeValue

      public GenericValue makeValue(String entityName)
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue without persisting it
      Specified by:
      makeValue in interface Delegator
    • makeValue

      public GenericValue makeValue(String entityName, Object... fields)
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue without persisting it
      Specified by:
      makeValue in interface Delegator
    • makeValue

      public GenericValue makeValue(String entityName, Map<String,? extends Object> fields)
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue without persisting it
      Specified by:
      makeValue in interface Delegator
    • makeValueSingle

      public GenericValue makeValueSingle(String entityName, Object singlePkValue)
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue without persisting it
      Specified by:
      makeValueSingle in interface Delegator
    • makeValidValue

      public GenericValue makeValidValue(String entityName, Object... fields)
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue without persisting it; only valid fields will be pulled from the fields Map
      Specified by:
      makeValidValue in interface Delegator
    • makeValidValue

      public GenericValue makeValidValue(String entityName, Map<String,? extends Object> fields)
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue without persisting it; only valid fields will be pulled from the fields Map
      Specified by:
      makeValidValue in interface Delegator
    • makePK

      public GenericPK makePK(String entityName)
      Description copied from interface: Delegator
      Creates a Primary Key in the form of a GenericPK without persisting it
      Specified by:
      makePK in interface Delegator
    • makePK

      public GenericPK makePK(String entityName, Object... fields)
      Description copied from interface: Delegator
      Creates a Primary Key in the form of a GenericPK without persisting it
      Specified by:
      makePK in interface Delegator
    • makePK

      public GenericPK makePK(String entityName, Map<String,? extends Object> fields)
      Description copied from interface: Delegator
      Creates a Primary Key in the form of a GenericPK without persisting it
      Specified by:
      makePK in interface Delegator
    • makePKSingle

      public GenericPK makePKSingle(String entityName, Object singlePkValue)
      Description copied from interface: Delegator
      Creates a Primary Key in the form of a GenericPK without persisting it
      Specified by:
      makePKSingle in interface Delegator
    • create

      public GenericValue create(GenericPK primaryKey) throws GenericEntityException
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue and write it to the datasource
      Specified by:
      create in interface Delegator
      Parameters:
      primaryKey - The GenericPK to create a value in the datasource from
      Returns:
      GenericValue instance containing the new instance
      Throws:
      GenericEntityException
    • create

      public GenericValue create(String entityName, Object... fields) throws GenericEntityException
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue and write it to the database
      Specified by:
      create in interface Delegator
      Returns:
      GenericValue instance containing the new instance
      Throws:
      GenericEntityException
    • create

      public GenericValue create(String entityName, Map<String,? extends Object> fields) throws GenericEntityException
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue and write it to the database
      Specified by:
      create in interface Delegator
      Returns:
      GenericValue instance containing the new instance
      Throws:
      GenericEntityException
    • createSingle

      public GenericValue createSingle(String entityName, Object singlePkValue) throws GenericEntityException
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue and write it to the database
      Specified by:
      createSingle in interface Delegator
      Returns:
      GenericValue instance containing the new instance
      Throws:
      GenericEntityException
    • createSetNextSeqId

      public GenericValue createSetNextSeqId(GenericValue value) throws GenericEntityException
      Description copied from interface: Delegator
      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.
      Specified by:
      createSetNextSeqId in interface Delegator
      Parameters:
      value - The GenericValue to create a value in the datasource from
      Returns:
      GenericValue instance containing the new instance
      Throws:
      GenericEntityException
    • create

      public GenericValue create(GenericValue value) throws GenericEntityException
      Description copied from interface: Delegator
      Creates a Entity in the form of a GenericValue and write it to the datasource
      Specified by:
      create in interface Delegator
      Parameters:
      value - The GenericValue to create a value in the datasource from
      Returns:
      GenericValue instance containing the new instance
      Throws:
      GenericEntityException
    • createOrStore

      public GenericValue createOrStore(GenericValue value) throws GenericEntityException
      Description copied from interface: Delegator
      Creates or stores an Entity
      Specified by:
      createOrStore in interface Delegator
      Parameters:
      value - The GenericValue instance containing the new or existing instance
      Returns:
      GenericValue instance containing the new or updated instance
      Throws:
      GenericEntityException
    • saveEntitySyncRemoveInfo

      protected void saveEntitySyncRemoveInfo(GenericEntity dummyPK) throws GenericEntityException
      Save entity sync remove info.
      Parameters:
      dummyPK - the dummy pk
      Throws:
      GenericEntityException - the generic entity exception
    • removeByPrimaryKey

      public int removeByPrimaryKey(GenericPK primaryKey) throws GenericEntityException
      Description copied from interface: Delegator
      Remove a Generic Entity corresponding to the primaryKey
      Specified by:
      removeByPrimaryKey in interface Delegator
      Parameters:
      primaryKey - The primary key of the entity to remove.
      Returns:
      int representing number of rows effected by this operation
      Throws:
      GenericEntityException
    • removeValue

      public int removeValue(GenericValue value) throws GenericEntityException
      Description copied from interface: Delegator
      Remove a Generic Value from the database
      Specified by:
      removeValue in interface Delegator
      Parameters:
      value - The GenericValue object of the entity to remove.
      Returns:
      int representing number of rows effected by this operation
      Throws:
      GenericEntityException
    • removeByAnd

      public int removeByAnd(String entityName, Object... fields) throws GenericEntityException
      Description copied from interface: Delegator
      Removes/deletes Generic Entity records found by all of the specified fields (ie: combined using AND)
      Specified by:
      removeByAnd in interface Delegator
      Parameters:
      entityName - The Name of the Entity as defined in the entity XML file
      fields - 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

      public int removeByAnd(String entityName, Map<String,? extends Object> fields) throws GenericEntityException
      Description copied from interface: Delegator
      Removes/deletes Generic Entity records found by all of the specified fields (ie: combined using AND)
      Specified by:
      removeByAnd in interface Delegator
      Parameters:
      entityName - The Name of the Entity as defined in the entity XML file
      fields - 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

      public int removeByCondition(String entityName, EntityCondition condition) throws GenericEntityException
      Description copied from interface: Delegator
      Removes/deletes Generic Entity records found by the condition
      Specified by:
      removeByCondition in interface Delegator
      Parameters:
      entityName - The Name of the Entity as defined in the entity XML file
      condition - The condition used to restrict the removing
      Returns:
      int representing number of rows effected by this operation
      Throws:
      GenericEntityException
    • removeRelated

      public int removeRelated(String relationName, GenericValue value) throws GenericEntityException
      Description copied from interface: Delegator
      Remove the named Related Entity for the GenericValue from the persistent store
      Specified by:
      removeRelated in interface Delegator
      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 file
      value - GenericValue instance containing the entity
      Returns:
      int representing number of rows effected by this operation
      Throws:
      GenericEntityException
    • refresh

      public void refresh(GenericValue value) throws GenericEntityException
      Description copied from interface: Delegator
      Refresh the Entity for the GenericValue from the persistent store
      Specified by:
      refresh in interface Delegator
      Parameters:
      value - GenericValue instance containing the entity to refresh
      Throws:
      GenericEntityException
    • refreshFromCache

      public void refreshFromCache(GenericValue value) throws GenericEntityException
      Description copied from interface: Delegator
      Refresh the Entity for the GenericValue from the cache
      Specified by:
      refreshFromCache in interface Delegator
      Parameters:
      value - GenericValue instance containing the entity to refresh
      Throws:
      GenericEntityException
    • storeByCondition

      public int storeByCondition(String entityName, Map<String,? extends Object> fieldsToSet, EntityCondition condition) throws GenericEntityException
      Description copied from interface: Delegator
      Store a group of values.
      Specified by:
      storeByCondition in interface Delegator
      Parameters:
      entityName - The name of the Entity as defined in the entity XML file
      fieldsToSet - The fields of the named entity to set in the database
      condition - The condition that restricts the list of stored values
      Returns:
      int representing number of rows effected by this operation
      Throws:
      GenericEntityException
    • store

      public int store(GenericValue value) throws GenericEntityException
      Description copied from interface: Delegator
      Store the Entity from the GenericValue to the persistent store
      Specified by:
      store in interface Delegator
      Parameters:
      value - GenericValue instance containing the entity
      Returns:
      int representing number of rows effected by this operation
      Throws:
      GenericEntityException
    • storeAll

      public int storeAll(List<GenericValue> values) throws GenericEntityException
      Description copied from interface: Delegator

      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.

      Specified by:
      storeAll in interface Delegator
      Parameters:
      values - List of GenericValue instances containing the entities to store
      Returns:
      int representing number of rows effected by this operation
      Throws:
      GenericEntityException
    • storeAll

      public int storeAll(List<GenericValue> values, EntityStoreOptions storeOptions) throws GenericEntityException
      Description copied from interface: Delegator

      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.

      Specified by:
      storeAll in interface Delegator
      Parameters:
      values - List of GenericValue instances containing the entities to store
      storeOptions - An instance of EntityStoreOptions that specifies advanced store options or null for default values. See the EntityStoreOptions JavaDoc for more details.
      Returns:
      int representing number of rows effected by this operation
      Throws:
      GenericEntityException
    • removeAll

      public int removeAll(String entityName) throws GenericEntityException
      Specified by:
      removeAll in interface Delegator
      Throws:
      GenericEntityException
    • removeAll

      public int removeAll(List<? extends GenericEntity> dummyPKs) throws GenericEntityException
      Description copied from interface: Delegator

      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.

      Specified by:
      removeAll in interface Delegator
      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
    • findOne

      public GenericValue findOne(String entityName, boolean useCache, Object... fields) throws GenericEntityException
      Description copied from interface: Delegator
      Find a Generic Entity by its primary key.
      Specified by:
      findOne in interface Delegator
      Parameters:
      entityName - The Name of the Entity as defined in the entity XML file
      useCache - Retrieve the Generic Entity from the cache when true
      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

      public GenericValue findOne(String entityName, Map<String,? extends Object> fields, boolean useCache) throws GenericEntityException
      Description copied from interface: Delegator
      Find a Generic Entity by its Primary Key
      Specified by:
      findOne in interface Delegator
      Parameters:
      entityName - The Name of the Entity as defined in the entity XML file
      fields - The fields of the named entity to query by with their corresponding values
      Returns:
      The GenericValue corresponding to the primaryKey
      Throws:
      GenericEntityException
    • findByPrimaryKeyPartial

      public GenericValue findByPrimaryKeyPartial(GenericPK primaryKey, Set<String> keys) throws GenericEntityException
      Description copied from interface: Delegator
      Find a Generic Entity by its Primary Key and only returns the values requested by the passed keys (names).
      Specified by:
      findByPrimaryKeyPartial in interface Delegator
      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
    • findAll

      public List<GenericValue> findAll(String entityName, boolean useCache) throws GenericEntityException
      Finds all Generic entities
      Specified by:
      findAll in interface Delegator
      Parameters:
      entityName - The Name of the Entity as defined in the entity XML file
      useCache - Whether to cache the results
      Returns:
      List containing all Generic entities
      Throws:
      GenericEntityException
      See Also:
    • findByAnd

      public List<GenericValue> findByAnd(String entityName, Map<String,? extends Object> fields, List<String> orderBy, boolean useCache) throws GenericEntityException
      Description copied from interface: Delegator
      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 fields
      Specified by:
      findByAnd in interface Delegator
      Parameters:
      entityName - The Name of the Entity as defined in the entity XML file
      fields - The fields of the named entity to query by with their corresponding values
      orderBy - The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending
      useCache - Whether to cache the results
      Returns:
      List of GenericValue instances that match the query
      Throws:
      GenericEntityException
    • find

      public EntityListIterator find(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException
      Description copied from interface: Delegator
      Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.
      Specified by:
      find in interface Delegator
      Parameters:
      entityName - The name of the Entity as defined in the entity XML file
      whereEntityCondition - 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 retreived
      orderBy - The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending
      findOptions - 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
    • findList

      public List<GenericValue> findList(String entityName, EntityCondition entityCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions, boolean useCache) throws GenericEntityException
      Description copied from interface: Delegator
      Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.
      Specified by:
      findList in interface Delegator
      Parameters:
      entityName - The name of the Entity as defined in the entity XML file
      entityCondition - 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 retrieved
      orderBy - The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending
      findOptions - 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

      public List<GenericValue> findList(String entityName, EntityCondition entityCondition, EntityCondition havingCondition, Set<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions, boolean useCache) throws GenericEntityException
      Description copied from interface: Delegator
      Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.
      Specified by:
      findList in interface Delegator
      Parameters:
      entityName - The name of the Entity as defined in the entity XML file
      entityCondition - 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)
      havingCondition - 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 retrieved
      orderBy - The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending
      findOptions - 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

      public EntityListIterator findListIteratorByCondition(DynamicViewEntity dynamicViewEntity, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, Collection<String> fieldsToSelect, List<String> orderBy, EntityFindOptions findOptions) throws GenericEntityException
      Description copied from interface: Delegator
      Finds GenericValues by the conditions specified in the EntityCondition object, the the EntityCondition javadoc for more details.
      Specified by:
      findListIteratorByCondition in interface Delegator
      Parameters:
      dynamicViewEntity - The DynamicViewEntity to use for the entity model for this query; generally created on the fly for limited use
      whereEntityCondition - 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 retreived
      orderBy - The fields of the named entity to order the query by; optionally add a " ASC" for ascending or " DESC" for descending
      findOptions - 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
    • findCountByCondition

      public long findCountByCondition(String entityName, EntityCondition whereEntityCondition, EntityCondition havingEntityCondition, EntityFindOptions findOptions) throws GenericEntityException
      Description copied from interface: Delegator
      Gets the hit count of GenericValues for the given EntityCondition objects.
      Specified by:
      findCountByCondition in interface Delegator
      Returns:
      long value with hit count
      Throws:
      GenericEntityException
    • findCountByCondition

      public long findCountByCondition(String entityName, EntityCondition whereEntityCondition, Set<String> fieldsToSelect, EntityCondition havingEntityCondition, EntityFindOptions findOptions) throws GenericEntityException
      Description copied from interface: Delegator
      Gets the hit count of GenericValues for the given EntityCondition objects.
      Specified by:
      findCountByCondition in interface Delegator
      Returns:
      long value with hit count
      Throws:
      GenericEntityException
    • getMultiRelation

      public List<GenericValue> getMultiRelation(GenericValue value, String relationNameOne, String relationNameTwo, List<String> orderBy) throws GenericEntityException
      Description copied from interface: Delegator
      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.
      Specified by:
      getMultiRelation in interface Delegator
      Parameters:
      value - GenericValue instance containing the entity
      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 relation
      relationNameTwo - String containing the relation name for second relation
      orderBy - 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
    • getRelated

      public List<GenericValue> getRelated(String relationName, Map<String,? extends Object> byAndFields, List<String> orderBy, GenericValue value, boolean useCache) throws GenericEntityException
      Description copied from interface: Delegator
      Get the named Related Entity for the GenericValue from the persistent store
      Specified by:
      getRelated in interface Delegator
      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 file
      byAndFields - the fields that must equal in order to keep; may be null
      orderBy - The fields of the named entity to order the query by; may be null; optionally add a " ASC" for ascending or " DESC" for descending
      value - GenericValue instance containing the entity
      useCache - Whether to cache the results
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedDummyPK

      public GenericPK getRelatedDummyPK(String relationName, Map<String,? extends Object> byAndFields, GenericValue value) throws GenericEntityException
      Description copied from interface: Delegator
      Get a dummy primary key for the named Related Entity for the GenericValue.
      Specified by:
      getRelatedDummyPK in interface Delegator
      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 file
      byAndFields - the fields that must equal in order to keep; may be null
      value - GenericValue instance containing the entity
      Returns:
      GenericPK containing a possibly incomplete PrimaryKey object representing the related entity or entities
      Throws:
      GenericEntityException
    • getRelatedOne

      public GenericValue getRelatedOne(String relationName, GenericValue value, boolean useCache) throws GenericEntityException
      Description copied from interface: Delegator
      Get related entity where relation is of type one, uses findByPrimaryKey
      Specified by:
      getRelatedOne in interface Delegator
      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 file
      value - GenericValue instance containing the entity
      useCache - Whether to cache the results
      Returns:
      GenericValue that is the related entity
      Throws:
      GenericEntityException
    • clearAllCaches

      public void clearAllCaches()
      Description copied from interface: Delegator
      This method is a shortcut to completely clear all entity engine caches. For performance reasons this should not be called very often.
      Specified by:
      clearAllCaches in interface Delegator
    • clearAllCaches

      public void clearAllCaches(boolean distribute)
      Specified by:
      clearAllCaches in interface Delegator
    • clearCacheLine

      public void clearCacheLine(String entityName)
      Description copied from interface: Delegator
      Remove all CACHED Generic Entity (List) from the cache
      Specified by:
      clearCacheLine in interface Delegator
      Parameters:
      entityName - The Name of the Entity as defined in the entity XML file
    • clearCacheLine

      public void clearCacheLine(String entityName, Object... fields)
      Description copied from interface: Delegator
      Remove a CACHED Generic Entity (List) from the cache, either a PK, ByAnd, or All
      Specified by:
      clearCacheLine in interface Delegator
      Parameters:
      entityName - The Name of the Entity as defined in the entity XML file
      fields - The fields of the named entity to query by with their corresponding values
    • clearCacheLine

      public void clearCacheLine(String entityName, Map<String,? extends Object> fields)
      Description copied from interface: Delegator
      Remove a CACHED Generic Entity (List) from the cache, either a PK, ByAnd, or All
      Specified by:
      clearCacheLine in interface Delegator
      Parameters:
      entityName - The Name of the Entity as defined in the entity XML file
      fields - The fields of the named entity to query by with their corresponding values
    • clearCacheLineFlexible

      public void clearCacheLineFlexible(GenericEntity dummyPK)
      Description copied from interface: Delegator
      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.
      Specified by:
      clearCacheLineFlexible in interface Delegator
      Parameters:
      dummyPK - The dummy primary key to clear by.
    • clearCacheLineFlexible

      public void clearCacheLineFlexible(GenericEntity dummyPK, boolean distribute)
      Specified by:
      clearCacheLineFlexible in interface Delegator
    • clearCacheLineByCondition

      public void clearCacheLineByCondition(String entityName, EntityCondition condition)
      Specified by:
      clearCacheLineByCondition in interface Delegator
    • clearCacheLineByCondition

      public void clearCacheLineByCondition(String entityName, EntityCondition condition, boolean distribute)
      Specified by:
      clearCacheLineByCondition in interface Delegator
    • clearCacheLine

      public void clearCacheLine(GenericPK primaryKey)
      Description copied from interface: Delegator
      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.
      Specified by:
      clearCacheLine in interface Delegator
      Parameters:
      primaryKey - The primary key to clear by.
    • clearCacheLine

      public void clearCacheLine(GenericPK primaryKey, boolean distribute)
      Specified by:
      clearCacheLine in interface Delegator
    • clearCacheLine

      public void clearCacheLine(GenericValue value)
      Description copied from interface: Delegator
      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.
      Specified by:
      clearCacheLine in interface Delegator
      Parameters:
      value - The GenericValue to clear by.
    • clearCacheLine

      public void clearCacheLine(GenericValue value, boolean distribute)
      Specified by:
      clearCacheLine in interface Delegator
    • clearAllCacheLinesByDummyPK

      public void clearAllCacheLinesByDummyPK(Collection<GenericPK> dummyPKs)
      Specified by:
      clearAllCacheLinesByDummyPK in interface Delegator
    • clearAllCacheLinesByValue

      public void clearAllCacheLinesByValue(Collection<GenericValue> values)
      Specified by:
      clearAllCacheLinesByValue in interface Delegator
    • getFromPrimaryKeyCache

      public GenericValue getFromPrimaryKeyCache(GenericPK primaryKey)
      Specified by:
      getFromPrimaryKeyCache in interface Delegator
    • putInPrimaryKeyCache

      public void putInPrimaryKeyCache(GenericPK primaryKey, GenericValue value)
      Specified by:
      putInPrimaryKeyCache in interface Delegator
    • putAllInPrimaryKeyCache

      public void putAllInPrimaryKeyCache(List<GenericValue> values)
      Specified by:
      putAllInPrimaryKeyCache in interface Delegator
    • setDistributedCacheClear

      public void setDistributedCacheClear(DistributedCacheClear distributedCacheClear)
      Specified by:
      setDistributedCacheClear in interface Delegator
    • readXmlDocument

      Specified by:
      readXmlDocument in interface Delegator
      Throws:
      SAXException
      ParserConfigurationException
      IOException
    • makeValues

      public List<GenericValue> makeValues(Document document)
      Specified by:
      makeValues in interface Delegator
    • makePK

      public GenericPK makePK(Element element)
      Specified by:
      makePK in interface Delegator
    • makeValue

      public GenericValue makeValue(Element element)
      Specified by:
      makeValue in interface Delegator
    • getEcaRuleRunner

      protected GenericDelegator.EntityEcaRuleRunner<?> getEcaRuleRunner(String entityName)
      Gets eca rule runner.
      Parameters:
      entityName - the entity name
      Returns:
      the eca rule runner
    • createEntityEcaRuleRunner

      protected static <T> GenericDelegator.EntityEcaRuleRunner<T> createEntityEcaRuleRunner(EntityEcaHandler<T> entityEcaHandler, String entityName)
    • setEntityEcaHandler

      public <T> void setEntityEcaHandler(EntityEcaHandler<T> entityEcaHandler)
      Specified by:
      setEntityEcaHandler in interface Delegator
    • getEntityEcaHandler

      public <T> EntityEcaHandler<T> getEntityEcaHandler()
      Specified by:
      getEntityEcaHandler in interface Delegator
    • getNextSeqId

      public String getNextSeqId(String seqName)
      Description copied from interface: Delegator
      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
      Specified by:
      getNextSeqId in interface Delegator
      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

      public String getNextSeqId(String seqName, long staggerMax)
      Description copied from interface: Delegator
      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
      Specified by:
      getNextSeqId in interface Delegator
      Parameters:
      seqName - The name of the sequence to get the next seq id from
      staggerMax - 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

      public Long getNextSeqIdLong(String seqName)
      Description copied from interface: Delegator
      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
      Specified by:
      getNextSeqIdLong in interface Delegator
      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

      public Long getNextSeqIdLong(String seqName, long staggerMax)
      Description copied from interface: Delegator
      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
      Specified by:
      getNextSeqIdLong in interface Delegator
      Parameters:
      seqName - The name of the sequence to get the next seq id from
      staggerMax - 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
    • setSequencer

      public void setSequencer(SequenceUtil sequencer)
      Description copied from interface: Delegator
      Allows you to pass a SequenceUtil class (possibly one that overrides the getNextSeqId method); if null is passed will effectively refresh the sequencer.
      Specified by:
      setSequencer in interface Delegator
    • refreshSequencer

      public void refreshSequencer()
      Description copied from interface: Delegator
      Refreshes the ID sequencer clearing all cached bank values.
      Specified by:
      refreshSequencer in interface Delegator
    • setNextSubSeqId

      public void setNextSubSeqId(GenericValue value, String seqFieldName, int numericPadding, int incrementBy)
      Description copied from interface: Delegator
      Look at existing values for a sub-entity with a sequenced secondary ID, and get the highest plus 1
      Specified by:
      setNextSubSeqId in interface Delegator
    • encryptFieldValue

      public Object encryptFieldValue(String entityName, ModelField.EncryptMethod encryptMethod, Object fieldValue) throws EntityCryptoException
      Specified by:
      encryptFieldValue in interface Delegator
      Throws:
      EntityCryptoException
    • decryptFieldValue

      public Object decryptFieldValue(String entityName, ModelField.EncryptMethod encryptMethod, String encValue) throws EntityCryptoException
      Specified by:
      decryptFieldValue in interface Delegator
      Throws:
      EntityCryptoException
    • setEntityCrypto

      public void setEntityCrypto(EntityCrypto crypto)
      Specified by:
      setEntityCrypto in interface Delegator
    • absorbList

      protected void absorbList(List<GenericValue> lst)
      Absorb list.
      Parameters:
      lst - the lst
    • getCache

      public Cache getCache()
      Specified by:
      getCache in interface Delegator
    • createEntityAuditLogAll

      protected void createEntityAuditLogAll(GenericValue value, boolean isUpdate, boolean isRemove) throws GenericEntityException
      Create entity audit log all.
      Parameters:
      value - the value
      isUpdate - the is update
      isRemove - the is remove
      Throws:
      GenericEntityException - the generic entity exception
    • createEntityAuditLogSingle

      protected void createEntityAuditLogSingle(GenericValue value, ModelField mf, boolean isUpdate, boolean isRemove, Timestamp nowTimestamp) throws GenericEntityException
      Create entity audit log single.
      Parameters:
      value - the value
      mf - the mf
      isUpdate - the is update
      isRemove - the is remove
      nowTimestamp - the now timestamp
      Throws:
      GenericEntityException - the generic entity exception
    • cloneDelegator

      public Delegator cloneDelegator(String delegatorFullName)
      Specified by:
      cloneDelegator in interface Delegator
    • cloneDelegator

      public Delegator cloneDelegator()
      Specified by:
      cloneDelegator in interface Delegator
    • makeTestDelegator

      public Delegator makeTestDelegator(String delegatorName)
      Specified by:
      makeTestDelegator in interface Delegator
    • rollback

      public void rollback()
      Specified by:
      rollback in interface Delegator
    • initDistributedCacheClear

      public void initDistributedCacheClear()
      Specified by:
      initDistributedCacheClear in interface Delegator
    • createDistributedCacheClear

      protected DistributedCacheClear createDistributedCacheClear()
      Create distributed cache clear distributed cache clear.
      Returns:
      the distributed cache clear
    • getDistributedCacheClear

      protected DistributedCacheClear getDistributedCacheClear()
      Gets distributed cache clear.
      Returns:
      the distributed cache clear
    • useDistributedCacheClear

      public boolean useDistributedCacheClear()
      Description copied from interface: Delegator
      Get use of Distributed Cache Clear mechanism status
      Specified by:
      useDistributedCacheClear in interface Delegator
      Returns:
      boolean true if this delegator uses a Distributed Cache Clear mechanism
    • getCurrentSessionIdentifier

      public String getCurrentSessionIdentifier()
      Specified by:
      getCurrentSessionIdentifier in interface Delegator
    • getCurrentUserIdentifier

      public String getCurrentUserIdentifier()
      Specified by:
      getCurrentUserIdentifier in interface Delegator