Class GenericValue

All Implemented Interfaces:
Serializable, Cloneable, Comparable<GenericEntity>, Map<String,Object>

public class GenericValue extends GenericEntity
Generic Entity Value Object - Handles persisntence for any defined entity. Created Wed Aug 08 2001
Version:
1.0
Author:
David E. Jones, Eric Pabst
See Also:
  • Field Details

    • relatedCache

      public transient Map<String,List<GenericValue>> relatedCache
      HashMap to cache various related entity collections
    • relatedOneCache

      public transient Map<String,GenericValue> relatedOneCache
      HashMap to cache various related cardinality on entity collections
    • originalDbValues

      protected Map<String,Object> originalDbValues
      This Map will contain the original field values from the database iff this GenericValue came from the database. If it was made manually it will no have this Map, ie it will be null to not take up memory.
  • Constructor Details

  • Method Details

    • create

      public GenericValue create() throws GenericEntityException
      Throws:
      GenericEntityException
    • store

      public void store() throws GenericEntityException
      Throws:
      GenericEntityException
    • remove

      public void remove() throws GenericEntityException
      Throws:
      GenericEntityException
    • refresh

      public void refresh() throws GenericEntityException
      Throws:
      GenericEntityException
    • originalDbValuesAvailable

      public boolean originalDbValuesAvailable()
    • getOriginalDbValue

      public Object getOriginalDbValue(String name)
    • copyOriginalDbValues

      public void copyOriginalDbValues()
      This should only be called by the Entity Engine once a GenericValue has been read from the database so that we have a copy of the original field values from the Db.
    • getRelated

      public List<GenericValue> getRelated(String relationName) throws GenericEntityException
      Get 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 file
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelated

      public List<GenericValue> getRelated(String relationName, Map<String,?> byAndFields, List<String> orderBy) throws GenericEntityException
      Get 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 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
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedCache

      public List<GenericValue> getRelatedCache(String relationName) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store, looking first in the global generic cache (for the moment this isn't true, is same as EmbeddedCache variant)
      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
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedMulti

      public List<GenericValue> getRelatedMulti(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 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
    • getRelatedMulti

      public List<GenericValue> getRelatedMulti(String relationNameOne, String relationNameTwo) 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 relation
      relationNameTwo - String containing the relation name for second relation
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedCache

      public List<GenericValue> getRelatedCache(String relationName, Map<String,?> byAndFields, List<String> orderBy) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store, looking first in the global generic cache (for the moment this isn't true, is same as EmbeddedCache variant)
      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
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedEmbeddedCache

      public List<GenericValue> getRelatedEmbeddedCache(String relationName) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store, looking first in a cache associated with this entity which is destroyed with this ValueObject when no longer used.
      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
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedEmbeddedCache

      public List<GenericValue> getRelatedEmbeddedCache(String relationName, Map<String,?> byAndFields, List<String> orderBy) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store, looking first in a cache associated with this entity which is destroyed with this ValueObject when no longer used.
      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
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedOne

      public GenericValue getRelatedOne(String relationName) throws GenericEntityException
      Get 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 file
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedOneCache

      public GenericValue getRelatedOneCache(String relationName) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store, looking first in the global generic cache (for the moment this isn't true, is same as EmbeddedCache variant)
      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
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedOneEmbeddedCache

      public GenericValue getRelatedOneEmbeddedCache(String relationName) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store, looking first in a cache associated with this entity which is destroyed with this ValueObject when no longer used.
      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
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedByAnd

      public List<GenericValue> getRelatedByAnd(String relationName, Map<String,?> fields) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store and filter it
      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
      fields - the fields that must equal in order to keep
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedByAndCache

      public List<GenericValue> getRelatedByAndCache(String relationName, Map<String,?> fields) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store and filter it, looking first in the global generic cache (for the moment this isn't true, is same as EmbeddedCache variant)
      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
      fields - the fields that must equal in order to keep
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedByAndEmbeddedCache

      public List<GenericValue> getRelatedByAndEmbeddedCache(String relationName, Map<String,?> fields) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store and filter it, looking first in a cache associated with this entity which is destroyed with this ValueObject when no longer used.
      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
      fields - the fields that must equal in order to keep
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedOrderBy

      public List<GenericValue> getRelatedOrderBy(String relationName, List<String> orderBy) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store and order it
      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
      orderBy - the order that they should be returned
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedOrderByCache

      public List<GenericValue> getRelatedOrderByCache(String relationName, List<String> orderBy) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store and order it, looking first in the global generic cache (for the moment this isn't true, is same as EmbeddedCache variant)
      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
      orderBy - the order that they should be returned
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • getRelatedOrderByEmbeddedCache

      public List<GenericValue> getRelatedOrderByEmbeddedCache(String relationName, List<String> orderBy) throws GenericEntityException
      Get the named Related Entity for the GenericValue from the persistent store and order it, looking first in a cache associated with this entity which is destroyed with this ValueObject when no longer used.
      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
      orderBy - the order that they should be returned
      Returns:
      List of GenericValue instances as specified in the relation definition
      Throws:
      GenericEntityException
    • removeRelated

      public void removeRelated(String relationName) throws GenericEntityException
      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 file
      Throws:
      GenericEntityException
    • getRelatedDummyPK

      public GenericPK getRelatedDummyPK(String relationName) throws GenericEntityException
      Get 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 file
      Returns:
      GenericPK containing a possibly incomplete PrimaryKey object representing the related entity or entities
      Throws:
      GenericEntityException
    • getRelatedDummyPK

      public GenericPK getRelatedDummyPK(String relationName, Map<String,?> byAndFields) throws GenericEntityException
      Get 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 file
      byAndFields - the fields that must equal in order to keep; may be null
      Returns:
      GenericPK containing a possibly incomplete PrimaryKey object representing the related entity or entities
      Throws:
      GenericEntityException
    • clone

      public Object clone()
      Clones this GenericValue, this is a shallow clone & uses the default shallow HashMap clone
      Overrides:
      clone in class GenericEntity
      Returns:
      Object that is a clone of this GenericValue