Package org.apache.ofbiz.entity
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
Generic Entity Value Object - Handles persistence for any defined entity.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.ofbiz.entity.GenericEntity
GenericEntity.NULL, GenericEntity.NullField, GenericEntity.NullGenericEntity
-
Field Summary
Fields inherited from class org.apache.ofbiz.entity.GenericEntity
NULL_ENTITY, NULL_FIELD
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Clones this GenericValue, this is a shallow clone and uses the default shallow HashMap clonecreate()
Creates new GenericValue from existing GenericValuestatic GenericValue
create
(Delegator delegator, ModelEntity modelEntity, Object singlePkValue) Creates new GenericValue from existing Mapstatic GenericValue
Creates new GenericValue from existing Mapstatic GenericValue
Creates new GenericValue from existing GenericValuestatic GenericValue
create
(GenericValue value) Creates new GenericValue from existing GenericValuestatic GenericValue
create
(ModelEntity modelEntity) Creates new GenericValueboolean
equalsgetRelated
(String relationName) Deprecated.getRelated
(String relationName, List<String> orderBy) Deprecated.Deprecated.getRelated
(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy, boolean useCache) Get the named Related Entity for the GenericValue from the persistent storegetRelatedDummyPK
(String relationName) Get a dummy primary key for the named Related Entity for the GenericValuegetRelatedDummyPK
(String relationName, Map<String, ? extends Object> byAndFields) Get a dummy primary key for the named Related Entity for the GenericValuegetRelatedMulti
(String relationNameOne, String relationNameTwo) Get the named Related Entity for the GenericValue from the persistent store across another Relation.getRelatedMulti
(String relationNameOne, String relationNameTwo, List<String> orderBy) Get the named Related Entity for the GenericValue from the persistent store across another Relation.getRelatedOne
(String relationName) Deprecated.getRelatedOne
(String relationName, boolean useCache) Get the named Related Entity for the GenericValue from the persistent storestatic String
int
hashCode()
hash codevoid
refresh()
refreshvoid
refresh from cachevoid
remove()
removevoid
removeRelated
(String relationName) Remove the named Related Entity for the GenericValue from the persistent storevoid
store()
storeMethods 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
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Field Details
-
NULL_VALUE
-
-
Constructor Details
-
GenericValue
public GenericValue()
-
-
Method Details
-
create
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
Creates new GenericValue from existing GenericValue -
create
Creates new GenericValue from existing GenericValue -
create
Creates new GenericValue from existing GenericValue- Throws:
GenericEntityException
-
store
store- Throws:
GenericEntityException
-
remove
remove- Throws:
GenericEntityException
-
refresh
refresh- Throws:
GenericEntityException
-
refreshFromCache
refresh from cache- Throws:
GenericEntityException
-
getRelated
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 List<GenericValue> getRelated(String relationName, List<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 List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy) throws GenericEntityExceptionDeprecated.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 List<GenericValue> getRelated(String relationName, Map<String, ? extends Object> byAndFields, List<String> orderBy, boolean useCache) throws GenericEntityExceptionGet the named Related Entity for the GenericValue from the persistent store- Parameters:
relationName
- String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified in the entity XML definition filebyAndFields
- the fields that must equal in order to keep; may be nullorderBy
- The fields of the named entity to order the query by; may be null; optionally add a " ASC" for ascending or " DESC" for descendinguseCache
- 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 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 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 relationrelationNameTwo
- String containing the relation name for second relation- Returns:
- List of GenericValue instances as specified in the relation definition
- Throws:
GenericEntityException
-
getRelatedOne
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(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
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
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 GenericEntityExceptionGet a dummy primary key for the named Related Entity for the GenericValue- Parameters:
relationName
- String containing the relation name which is the combination of relation.title and relation.rel-entity-name as specified in the entity XML definition filebyAndFields
- the fields that must equal in order to keep; may be null- Returns:
- GenericPK containing a possibly incomplete PrimaryKey object representing the related entity or entities
- Throws:
GenericEntityException
-
hashCode
public int hashCode()hash code -
equals
equals -
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
-
getRelated(String, Map, List, boolean)