@java.lang.SuppressWarnings("unused") public interface EntityValue extends java.util.Map, java.io.Externalizable, java.lang.Comparable, java.lang.Cloneable, SimpleEtlEntry
Entity Value Interface - Represents a single database record.
Type Params | Return Type | Name and description |
---|---|---|
|
public long |
checkAgainstDatabase(java.util.List<java.lang.String> messages) Compare this value to the database, adding messages about fields that differ or if the record doesn't exist to messages. |
|
public long |
checkAgainstDatabaseInfo(java.util.List<java.util.Map<java.lang.String, java.lang.Object>> diffInfoList, java.util.List<java.lang.String> messages, java.lang.String location) |
|
public boolean |
checkFks(boolean insertDummy) Checks to see if all foreign key records exist in the database (records this record refers to). |
|
public EntityValue |
cloneValue() |
|
public int |
compareTo(EntityValue that) Compares this EntityValue to the passed object |
|
public boolean |
containsPrimaryKey() Returns true if the entity contains all of the primary key fields. |
|
public EntityValue |
create() Creates a record for this entity value. |
|
public EntityValue |
createOrUpdate() Creates a record for this entity value, or updates the record if one exists that matches the primary key. |
|
public EntityValue |
delete() Deletes the record that matches the primary key. |
|
public void |
deleteRelated(java.lang.String relationshipName) Remove the named Related Entity for the EntityValue from the persistent store |
|
public void |
deleteWithCascade(java.util.Set<java.lang.String> clearRefEntities, java.util.Set<java.lang.String> validateAllowDeleteEntities) Deletes this record and all records that depend on it, doing the same for each (cascading delete). |
|
public boolean |
deleteWithRelated(java.util.Set<java.lang.String> relationshipsToDelete) Delete this record plus records for all relationships specified. |
|
public 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 |
|
public long |
findRelatedCount(java.lang.String relationshipName, java.lang.Boolean useCache) |
|
public EntityList |
findRelatedFk(java.util.Set<java.lang.String> skipEntities) Find all records with a foreign key reference to this record. |
|
public 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 |
|
public java.lang.Object |
get(java.lang.String name) Get the named field. |
|
public java.math.BigDecimal |
getBigDecimal(java.lang.String name) |
|
public java.lang.Boolean |
getBoolean(java.lang.String name) |
|
public byte[] |
getBytes(java.lang.String name) |
|
public java.sql.Date |
getDate(java.lang.String name) |
|
public java.lang.Double |
getDouble(java.lang.String name) |
|
public java.lang.String |
getEntityName() |
|
public java.lang.String |
getEntityNamePretty() |
|
public java.lang.Long |
getLong(java.lang.String name) |
|
public 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. |
|
public 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. |
|
public 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. |
|
public java.lang.Object |
getOriginalDbValue(java.lang.String name) |
|
public java.util.Map<java.lang.String, java.lang.Object> |
getPlainValueMap(int dependentLevels) Get a Map with all non-null field values. |
|
public java.util.Map<java.lang.String, java.lang.Object> |
getPrimaryKeys() |
|
public java.lang.String |
getPrimaryKeysString() |
|
public javax.sql.rowset.serial.SerialBlob |
getSerialBlob(java.lang.String name) |
|
public java.lang.String |
getString(java.lang.String name) |
|
public java.sql.Time |
getTime(java.lang.String name) |
|
public java.sql.Timestamp |
getTimestamp(java.lang.String name) |
|
public 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) |
|
public boolean |
isFieldModified(java.lang.String name) Returns true if the field has been modified |
|
public boolean |
isFieldSet(java.lang.String name) Returns true if a value for the field is set, even if it is null |
|
public boolean |
isModified() Returns true if any field has been modified |
|
public boolean |
isMutable() |
|
public 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 |
|
public boolean |
mapMatches(java.util.Map<java.lang.String, java.lang.Object> theMap) Returns true if all entries in the Map match field values. |
|
public boolean |
refresh() Refreshes this value based on the record that matches the primary key. |
|
public EntityValue |
set(java.lang.String name, java.lang.Object value) Sets the named field to the passed value, even if the value is null |
|
public 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. |
|
public EntityValue |
setBytes(java.lang.String name, byte[] theBytes) |
|
public 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. |
|
public EntityValue |
setSequencedIdPrimary() Get the next guaranteed unique seq id for this entity, and set it in the primary key field. |
|
public 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. |
|
public 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() |
|
public EntityValue |
store() Alias for createOrUpdate() |
|
public EntityValue |
touchField(java.lang.String name) Treat field as modified for update() even if not to force a resend to the DB |
|
public EntityValue |
update() Updates the record that matches the primary key. |
|
public 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. |
|
public 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#copyOf(java.util.Map), 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#merge(java.lang.Object, java.lang.Object, java.util.function.BiFunction), java.util.Map#entrySet(), java.util.Map#putAll(java.util.Map), java.util.Map#entry(java.lang.Object, java.lang.Object), java.util.Map#putIfAbsent(java.lang.Object, java.lang.Object), java.util.Map#compute(java.lang.Object, java.util.function.BiFunction), java.util.Map#of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), java.util.Map#of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), java.util.Map#of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), java.util.Map#of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), java.util.Map#of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), java.util.Map#of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), java.util.Map#of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), java.util.Map#of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), java.util.Map#of(java.lang.Object, java.lang.Object, java.lang.Object, java.lang.Object), java.util.Map#of(java.lang.Object, java.lang.Object), java.util.Map#of(), java.util.Map#forEach(java.util.function.BiConsumer), java.util.Map#containsKey(java.lang.Object), java.util.Map#computeIfAbsent(java.lang.Object, java.util.function.Function), java.util.Map#containsValue(java.lang.Object), java.util.Map#keySet(), java.util.Map#getOrDefault(java.lang.Object, java.lang.Object), java.util.Map#computeIfPresent(java.lang.Object, java.util.function.BiFunction), java.util.Map#ofEntries([Ljava.util.Map$Entry;) |
interface java.io.Externalizable |
java.io.Externalizable#writeExternal(java.io.ObjectOutput), java.io.Externalizable#readExternal(java.io.ObjectInput) |
interface java.lang.Comparable |
java.lang.Comparable#compareTo(java.lang.Object) |
Compare this value to the database, adding messages about fields that differ or if the record doesn't exist to messages.
Checks to see if all foreign key records exist in the database (records this record refers to). Will attempt to create a dummy value (PK only) for those missing when specified insertDummy is true.
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 fileDeletes this record and all records that depend on it, doing the same for each (cascading delete). Deletes related records that depend on this record (records with a foreign key reference to this record). To clear the reference (set fields to null) instead of deleting records specify the entity names, related to this or any related entity, in the clearRefEntities parameter. To check for records that should prevent a delete you can optionally pass a Set of entities names in the validateAllowDeleteEntities parameter. If this is not null an exception will be thrown instead of deleting any record for an entity NOT in that Set. WARNING: this may delete records you don't want to. Look at the nested relationships in the Entity Reference in the Tools app to see what might might get deleted (anything with a type one relationship to this entity, or recursing anything with a type one relationship to those).
Delete 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. Returns true if this and related records were deleted.
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.Find all records with a foreign key reference to this record. Operates on relationship definitions for any related entity that has a type one relationship to this entity. Does not recurse, finds directly related (dependant) records only. Will skip any related records whose entity name is in skipEntities. Useful as a validation before calling deleteWithCascade().
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()
Treat field as modified for update() even if not to force a resend to the DB
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