Package org.apache.ofbiz.entity
Class GenericValue
- java.lang.Object
-
- org.apache.ofbiz.entity.GenericEntity
-
- org.apache.ofbiz.entity.GenericValue
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.lang.Comparable<GenericEntity>
,java.util.Map<java.lang.String,java.lang.Object>
,LocalizedMap<java.lang.Object>
- Direct Known Subclasses:
GenericValue.NullGenericValue
public class GenericValue extends GenericEntity
Generic Entity Value Object - Handles persistence for any defined entity.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
GenericValue.NullGenericValue
-
Nested classes/interfaces inherited from class org.apache.ofbiz.entity.GenericEntity
GenericEntity.NULL, GenericEntity.NullField, GenericEntity.NullGenericEntity
-
-
Field Summary
Fields Modifier and Type Field Description static GenericValue
NULL_VALUE
-
Fields inherited from class org.apache.ofbiz.entity.GenericEntity
module, NULL_ENTITY, NULL_FIELD
-
-
Constructor Summary
Constructors Constructor Description GenericValue()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.Object
clone()
Clones this GenericValue, this is a shallow clone and uses the default shallow HashMap cloneGenericValue
create()
static GenericValue
create(Delegator delegator, ModelEntity modelEntity, java.lang.Object singlePkValue)
Creates new GenericValue from existing Mapstatic GenericValue
create(Delegator delegator, ModelEntity modelEntity, java.util.Map<java.lang.String,? extends java.lang.Object> fields)
Creates new GenericValue from existing Mapstatic GenericValue
create(GenericPK primaryKey)
Creates new GenericValue from existing GenericValuestatic GenericValue
create(GenericValue value)
Creates new GenericValue from existing GenericValuestatic GenericValue
create(ModelEntity modelEntity)
Creates new GenericValueboolean
equals(java.lang.Object obj)
Determines the equality of two GenericEntity objects, overrides the default equalsjava.util.List<GenericValue>
getRelated(java.lang.String relationName)
Deprecated.java.util.List<GenericValue>
getRelated(java.lang.String relationName, java.util.List<java.lang.String> orderBy)
Deprecated.java.util.List<GenericValue>
getRelated(java.lang.String relationName, java.util.Map<java.lang.String,? extends java.lang.Object> byAndFields, java.util.List<java.lang.String> orderBy)
Deprecated.java.util.List<GenericValue>
getRelated(java.lang.String relationName, java.util.Map<java.lang.String,? extends java.lang.Object> byAndFields, java.util.List<java.lang.String> orderBy, boolean useCache)
Get the named Related Entity for the GenericValue from the persistent storeGenericPK
getRelatedDummyPK(java.lang.String relationName)
Get a dummy primary key for the named Related Entity for the GenericValueGenericPK
getRelatedDummyPK(java.lang.String relationName, java.util.Map<java.lang.String,? extends java.lang.Object> byAndFields)
Get a dummy primary key for the named Related Entity for the GenericValuejava.util.List<GenericValue>
getRelatedMulti(java.lang.String relationNameOne, java.lang.String relationNameTwo)
Get the named Related Entity for the GenericValue from the persistent store across another Relation.java.util.List<GenericValue>
getRelatedMulti(java.lang.String relationNameOne, java.lang.String relationNameTwo, java.util.List<java.lang.String> orderBy)
Get the named Related Entity for the GenericValue from the persistent store across another Relation.GenericValue
getRelatedOne(java.lang.String relationName)
Deprecated.GenericValue
getRelatedOne(java.lang.String relationName, boolean useCache)
Get the named Related Entity for the GenericValue from the persistent storestatic java.lang.String
getStackTraceAsString()
int
hashCode()
Creates a hashCode for the entity, using the default String hashCode and Map hashCode, overrides the default hashCodevoid
refresh()
void
refreshFromCache()
void
remove()
void
removeRelated(java.lang.String relationName)
Remove the named Related Entity for the GenericValue from the persistent storevoid
store()
-
Methods inherited from class org.apache.ofbiz.entity.GenericEntity
addObserver, addToXmlDocument, addToXmlElement, assertIsMutable, checkFks, clear, clearChanged, compareTo, compareToFields, containsKey, containsPrimaryKey, containsPrimaryKey, containsValue, createGenericEntity, createGenericEntity, createGenericEntity, dangerousGetNoCheckButFast, dangerousSetNoCheckButFast, deleteObserver, deleteObservers, entrySet, get, get, get, get, getAllFields, getAllKeys, getBigDecimal, getBoolean, getBytes, getDate, getDelegator, getDouble, getDuration, getEntityName, getFields, getFloat, getInteger, getIsFromEntitySync, getLong, getModelEntity, getOriginalDbValue, getPkShortValueString, getPrimaryKey, getString, getTime, getTimestamp, hasChanged, init, init, init, init, isEmpty, isModified, isMutable, isPrimaryKey, isPrimaryKey, keySet, lockEnabled, makeXmlDocument, makeXmlElement, makeXmlElement, matches, matchesFields, notifyObservers, notifyObservers, originalDbValuesAvailable, put, putAll, refreshFromValue, remove, removedFromDatasource, reset, set, set, setAllFields, setBytes, setChanged, setDelegator, setFields, setImmutable, setIsFromEntitySync, setNextSeqId, setNonPKFields, setNonPKFields, setPKFields, setPKFields, setString, size, synchronizedWithDatasource, toString, toStringInsecure, values, writeXmlText
-
-
-
-
Field Detail
-
NULL_VALUE
public static final GenericValue NULL_VALUE
-
-
Method Detail
-
create
public static GenericValue create(ModelEntity modelEntity)
Creates new GenericValue
-
create
public static GenericValue create(Delegator delegator, ModelEntity modelEntity, java.util.Map<java.lang.String,? extends java.lang.Object> fields)
Creates new GenericValue from existing Map
-
create
public static GenericValue create(Delegator delegator, ModelEntity modelEntity, java.lang.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
- 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
-
refreshFromCache
public void refreshFromCache() throws GenericEntityException
- Throws:
GenericEntityException
-
getRelated
@Deprecated public java.util.List<GenericValue> getRelated(java.lang.String relationName) throws GenericEntityException
Deprecated.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 java.util.List<GenericValue> getRelated(java.lang.String relationName, java.util.List<java.lang.String> orderBy) throws GenericEntityException
Deprecated.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 fileorderBy
- 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 java.util.List<GenericValue> getRelated(java.lang.String relationName, java.util.Map<java.lang.String,? extends java.lang.Object> byAndFields, java.util.List<java.lang.String> orderBy) throws GenericEntityException
Deprecated.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 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 descending- Returns:
- List of GenericValue instances as specified in the relation definition
- Throws:
GenericEntityException
-
getRelated
public java.util.List<GenericValue> getRelated(java.lang.String relationName, java.util.Map<java.lang.String,? extends java.lang.Object> byAndFields, java.util.List<java.lang.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 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 descendinguseCache
- Whether to cache the results- Returns:
- List of GenericValue instances as specified in the relation definition
- Throws:
GenericEntityException
-
getRelatedMulti
public java.util.List<GenericValue> getRelatedMulti(java.lang.String relationNameOne, java.lang.String relationNameTwo, java.util.List<java.lang.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 relationorderBy
- 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 java.util.List<GenericValue> getRelatedMulti(java.lang.String relationNameOne, java.lang.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 relationrelationNameTwo
- 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(java.lang.String relationName) throws GenericEntityException
Deprecated.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(java.lang.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 fileuseCache
- Whether to cache the results- Returns:
- The single related GenericValue instance
- Throws:
GenericEntityException
-
removeRelated
public void removeRelated(java.lang.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(java.lang.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(java.lang.String relationName, java.util.Map<java.lang.String,? extends java.lang.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 filebyAndFields
- 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()
Description copied from class:GenericEntity
Creates a hashCode for the entity, using the default String hashCode and Map hashCode, overrides the default hashCode- Specified by:
hashCode
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
hashCode
in classGenericEntity
- Returns:
- Hashcode corresponding to this entity
-
equals
public boolean equals(java.lang.Object obj)
Description copied from class:GenericEntity
Determines the equality of two GenericEntity objects, overrides the default equals- Specified by:
equals
in interfacejava.util.Map<java.lang.String,java.lang.Object>
- Overrides:
equals
in classGenericEntity
- Parameters:
obj
- The object (GenericEntity) to compare this two- Returns:
- boolean stating if the two objects are equal
-
clone
public java.lang.Object clone()
Clones this GenericValue, this is a shallow clone and uses the default shallow HashMap clone- Overrides:
clone
in classGenericEntity
- Returns:
- Object that is a clone of this GenericValue
-
getStackTraceAsString
public static java.lang.String getStackTraceAsString()
-
-