Entity Value Interface - Represents a single database record.
| Type | Name and description |
|---|---|
long |
checkAgainstDatabase(java.util.List<java.lang.String> messages) |
boolean |
checkFks(boolean insertDummy)Checks to see if all foreign key records exist in the database. |
EntityValue |
cloneValue() |
int |
compareTo(EntityValue that)Compares this EntityValue to the passed object |
boolean |
containsPrimaryKey()Returns true if the entity contains all of the primary key fields. |
EntityValue |
create()Creates a record for this entity value. |
EntityValue |
createOrUpdate()Creates a record for this entity value, or updates the record if one exists that matches the primary key. |
EntityValue |
delete()Deletes the record that matches the primary key. |
void |
deleteRelated(java.lang.String relationshipName)Remove the named Related Entity for the EntityValue from the persistent store |
boolean |
deleteWithRelated(java.util.Set<java.lang.String> relationshipsToDelete)Delete this record plus records for all relationships specified. |
EntityList |
findRelated(java.lang.String relationshipName, java.util.Map<java.lang.String, java.lang.Object> byAndFields, java.util.List<java.lang.String> orderBy, java.lang.Boolean useCache, java.lang.Boolean forUpdate)Get the named Related Entity for the EntityValue from the persistent store |
long |
findRelatedCount(java.lang.String relationshipName, java.lang.Boolean useCache) |
EntityValue |
findRelatedOne(java.lang.String relationshipName, java.lang.Boolean useCache, java.lang.Boolean forUpdate)Get the named Related Entity for the EntityValue from the persistent store |
java.lang.Object |
get(java.lang.String name)Get the named field. |
java.math.BigDecimal |
getBigDecimal(java.lang.String name) |
java.lang.Boolean |
getBoolean(java.lang.String name) |
byte[] |
getBytes(java.lang.String name) |
java.sql.Date |
getDate(java.lang.String name) |
java.lang.Double |
getDouble(java.lang.String name) |
java.lang.String |
getEntityName() |
java.lang.Long |
getLong(java.lang.String name) |
java.util.Map<java.lang.String, java.lang.Object> |
getMap()Gets a cloned, mutable Map with the field values that is independent of this value object. |
java.util.Map<java.lang.String, java.lang.Object> |
getMasterValueMap(java.lang.String name)List getPlainValueMap() but uses a master definition to determine which dependent/related records to get. |
java.lang.Object |
getNoCheckSimple(java.lang.String name)Get simple fields only (no localization, no relationship) and don't check to see if it is a valid field; mostly for performance reasons and for well tested code with known field names. |
java.lang.Object |
getOriginalDbValue(java.lang.String name) |
java.util.Map<java.lang.String, java.lang.Object> |
getPlainValueMap(int dependentLevels)Get a Map with all non-null field values. |
java.util.Map<java.lang.String, java.lang.Object> |
getPrimaryKeys() |
javax.sql.rowset.serial.SerialBlob |
getSerialBlob(java.lang.String name) |
java.lang.String |
getString(java.lang.String name) |
java.sql.Time |
getTime(java.lang.String name) |
java.sql.Timestamp |
getTimestamp(java.lang.String name) |
boolean |
isField(java.lang.String name)Returns true if the name is a valid field name for the entity this is a value of, false otherwise (meaning get(), set(), etc calls with throw an exception with the field name) |
boolean |
isFieldModified(java.lang.String name)Returns true if the field has been modified |
boolean |
isFieldSet(java.lang.String name)Returns true if a value for the field is set, even if it is null |
boolean |
isModified()Returns true if any field has been modified |
boolean |
isMutable() |
org.w3c.dom.Element |
makeXmlElement(org.w3c.dom.Document document, java.lang.String prefix)Makes an XML Element object with an attribute for each field of the entity |
boolean |
mapMatches(java.util.Map<java.lang.String, java.lang.Object> theMap)Returns true if all entries in the Map match field values. |
boolean |
refresh()Refreshes this value based on the record that matches the primary key. |
EntityValue |
set(java.lang.String name, java.lang.Object value)Sets the named field to the passed value, even if the value is null |
EntityValue |
setAll(java.util.Map<java.lang.String, java.lang.Object> fields)Sets fields on this entity from the Map of fields passed in using the entity definition to only get valid fields from the Map. |
EntityValue |
setBytes(java.lang.String name, byte[] theBytes) |
EntityValue |
setFields(java.util.Map<java.lang.String, java.lang.Object> fields, boolean setIfEmpty, java.lang.String namePrefix, java.lang.Boolean pks)Sets fields on this entity from the Map of fields passed in using the entity definition to only get valid fields from the Map. |
EntityValue |
setSequencedIdPrimary()Get the next guaranteed unique seq id for this entity, and set it in the primary key field. |
EntityValue |
setSequencedIdSecondary()Look at existing values with the same primary sequenced ID (first PK field) and get the highest existing value for the secondary sequenced ID (the second PK field), add 1 to it and set the result in this entity value. |
EntityValue |
setString(java.lang.String name, java.lang.String value)Sets the named field to the passed value, converting the value from a String to the corresponding type using Type.valueOf() |
EntityValue |
store()Alias for createOrUpdate() |
EntityValue |
update()Updates the record that matches the primary key. |
int |
writeXmlText(java.io.Writer writer, java.lang.String prefix, int dependentLevels)Writes XML text with an attribute or CDATA element for each field of the entity. |
int |
writeXmlTextMaster(java.io.Writer pw, java.lang.String prefix, java.lang.String masterName) |
| Methods inherited from class | Name |
|---|---|
interface java.util.Map |
java.util.Map#remove(java.lang.Object), java.util.Map#remove(java.lang.Object, java.lang.Object), java.util.Map#get(java.lang.Object), java.util.Map#put(java.lang.Object, java.lang.Object), java.util.Map#equals(java.lang.Object), java.util.Map#values(), java.util.Map#hashCode(), java.util.Map#clear(), java.util.Map#isEmpty(), java.util.Map#replace(java.lang.Object, java.lang.Object), java.util.Map#replace(java.lang.Object, java.lang.Object, java.lang.Object), java.util.Map#replaceAll(java.util.function.BiFunction), java.util.Map#size(), java.util.Map#entrySet(), java.util.Map#putAll(java.util.Map), java.util.Map#putIfAbsent(java.lang.Object, java.lang.Object), java.util.Map#keySet(), java.util.Map#containsValue(java.lang.Object), java.util.Map#containsKey(java.lang.Object), java.util.Map#getOrDefault(java.lang.Object, java.lang.Object), java.util.Map#forEach(java.util.function.BiConsumer), java.util.Map#computeIfAbsent(java.lang.Object, java.util.function.Function), java.util.Map#computeIfPresent(java.lang.Object, java.util.function.BiFunction), java.util.Map#compute(java.lang.Object, java.util.function.BiFunction), java.util.Map#merge(java.lang.Object, java.lang.Object, java.util.function.BiFunction) |
interface java.io.Externalizable |
java.io.Externalizable#readExternal(java.io.ObjectInput), java.io.Externalizable#writeExternal(java.io.ObjectOutput) |
interface java.lang.Comparable |
java.lang.Comparable#compareTo(java.lang.Object) |
Checks to see if all foreign key records exist in the database. Will create a dummy value for those missing when specified.
insertDummy - Create a dummy record using the provided fieldsCompares this EntityValue to the passed object
that - Object to compare this toReturns true if the entity contains all of the primary key fields.
Creates a record for this entity value.
Creates a record for this entity value, or updates the record if one exists that matches the primary key.
Deletes the record that matches the primary key.
Remove the named Related Entity for the EntityValue from the persistent store
relationshipName - String containing the relationship name which is the combination of relationship.title
and relationship.related-entity-name as specified in the entity XML definition fileDelete this record plus records for all relationships specified. If any records exist for other relationships not specified that depend on this record returns false and does not delete anything. Otherwise returns true.
Get the named Related Entity for the EntityValue from the persistent store
relationshipName - String containing the relationship name which is the combination of relationship.title
and relationship.related-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 - Look in the cache before finding in the datasource. Defaults to setting on entity definition.Get the named Related Entity for the EntityValue from the persistent store
relationshipName - String containing the relationship name which is the combination of relationship.title
and relationship.related-entity-name as specified in the entity XML definition fileuseCache - Look in the cache before finding in the datasource. Defaults to setting on entity definition. Get the named field.
If there is a matching entry in the moqui.basic.LocalizedEntityField entity using the Locale in the current
ExecutionContext then that will be returned instead.
This method also supports getting related entities using their relationship name, formatted as
"${title}${related-entity-name}". When doing so it is like calling
findRelated(relationshipName, null, null, null, null) for type many relationships, or
findRelatedOne(relationshipName, null, null) for type one relationships.
name - The field name to get, or the name of the relationship to get one or more related values from.Gets a cloned, mutable Map with the field values that is independent of this value object. Can be augmented or modified without modifying or being constrained by this entity value.
List getPlainValueMap() but uses a master definition to determine which dependent/related records to get.
Get simple fields only (no localization, no relationship) and don't check to see if it is a valid field; mostly for performance reasons and for well tested code with known field names. If it is not a valid field name will just return null and not throw an error, ie doesn't check for valid field names.
Get a Map with all non-null field values. If dependentLevels is greater than zero includes nested dependents in the Map as an entry with key of the dependent relationship's short-alias or if no short-alias then the relationship name (title + related-entity-name). Each dependent entity's Map may have its own dependent records up to dependentLevels levels deep.
Returns true if the name is a valid field name for the entity this is a value of, false otherwise (meaning get(), set(), etc calls with throw an exception with the field name)
Returns true if the field has been modified
Returns true if a value for the field is set, even if it is null
Returns true if any field has been modified
Makes an XML Element object with an attribute for each field of the entity
document - The XML Document that the new Element will be part ofprefix - A prefix to put in front of the entity name in the tag nameReturns true if all entries in the Map match field values.
Refreshes this value based on the record that matches the primary key.
Sets the named field to the passed value, even if the value is null
name - The field name to setvalue - The value to setSets fields on this entity from the Map of fields passed in using the entity definition to only get valid fields from the Map. For any String values passed in this will call setString to convert based on the field definition, otherwise it sets the Object as-is.
fields - The fields Map to get the values fromSets fields on this entity from the Map of fields passed in using the entity definition to only get valid fields from the Map. For any String values passed in this will call setString to convert based on the field definition, otherwise it sets the Object as-is.
fields - The fields Map to get the values fromsetIfEmpty - Used to specify whether empty/null values in the field Map should be setnamePrefix - If not null or empty will be pre-pended to each field name (upper-casing the first letter of
the field name first), and that will be used as the fields Map lookup name instead of the field-namepks - If null, get all values, if TRUE just get PKs, if FALSE just get non-PKsGet the next guaranteed unique seq id for this entity, and set it in the primary key field. This will set it in the first primary key field in the entity definition, but it really should be used for entities with only one primary key field.
Look at existing values with the same primary sequenced ID (first PK field) and get the highest existing value for the secondary sequenced ID (the second PK field), add 1 to it and set the result in this entity value. The current value object must have the primary sequenced field already populated.
Sets the named field to the passed value, converting the value from a String to the corresponding type using
Type.valueOf()
If the String "null" is passed in it will be treated the same as a null value. If you really want to set a
String of "null" then pass in "\null".
name - The field name to setvalue - The String value to convert and setAlias for createOrUpdate()
Updates the record that matches the primary key.
Writes XML text with an attribute or CDATA element for each field of the entity. If dependents is true also writes all dependent (descendant) records.
writer - A Writer object to write toprefix - A prefix to put in front of the entity name in the tag namedependentLevels - Write dependent (descendant) records this many levels deep, zero for no dependents