Class GenericValue

java.lang.Object
org.apache.ofbiz.entity.GenericEntity
org.apache.ofbiz.entity.GenericValue
All Implemented Interfaces:
Serializable, Cloneable, Comparable<GenericEntity>, Map<String,Object>, LocalizedMap<Object>
Direct Known Subclasses:
GenericValue.NullGenericValue

public class GenericValue extends GenericEntity
Generic Entity Value Object - Handles persistence for any defined entity.
See Also:
  • Field Details

  • Constructor Details

    • GenericValue

      public GenericValue()
  • Method Details

    • create

      public static GenericValue create(ModelEntity modelEntity)
      Creates new GenericValue
    • create

      public static GenericValue create(Delegator delegator, ModelEntity modelEntity, Map<String,? extends Object> fields)
      Creates new GenericValue from existing Map
    • create

      public static GenericValue create(Delegator delegator, ModelEntity modelEntity, Object singlePkValue)
      Creates new GenericValue from existing Map
    • create

      public static GenericValue create(GenericValue value)
      Creates new GenericValue from existing GenericValue
    • create

      public static GenericValue create(GenericPK primaryKey)
      Creates new GenericValue from existing GenericValue
    • create

      public GenericValue create() throws GenericEntityException
      Creates new GenericValue from existing GenericValue
      Throws:
      GenericEntityException
    • store

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

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

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

      public void refreshFromCache() throws GenericEntityException
      refresh from cache
      Throws:
      GenericEntityException
    • getRelated

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

      @Deprecated public List<GenericValue> getRelated(String relationName, 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
      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

      @Deprecated public List<GenericValue> getRelated(String relationName, Map<String,? extends Object> 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
    • getRelated

      public List<GenericValue> getRelated(String relationName, Map<String,? extends Object> byAndFields, List<String> orderBy, boolean useCache) 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
      useCache - Whether to cache the results
      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
    • getRelatedOne

      @Deprecated 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
    • getRelatedOne

      public GenericValue getRelatedOne(String relationName, boolean useCache) 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
      useCache - Whether to cache the results
      Returns:
      The single related GenericValue instance
      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,? extends Object> 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
    • hashCode

      public int hashCode()
      hash code
      Specified by:
      hashCode in interface Map<String,Object>
      Overrides:
      hashCode in class GenericEntity
      Returns:
      Hashcode corresponding to this entity
    • equals

      public boolean equals(Object obj)
      equals
      Specified by:
      equals in interface Map<String,Object>
      Overrides:
      equals in class GenericEntity
      Parameters:
      obj - The object (GenericEntity) to compare this two
      Returns:
      boolean stating if the two objects are equal
    • clone

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

      public static String getStackTraceAsString()