public class EntityDef extends SchemaPart implements Cloneable, SchemaProblemsSupplier
internalId, internalName, log, TIMESTAMP_FORMAT
SERIALIZED_CLASS_NAME, TYPE
XML_SERIALIZED_CLASS_NAME
Modifier and Type | Method and Description |
---|---|
EntityDef |
addField(FieldDef field) |
EntityDef |
addIndex(IndexDef index) |
EntityDef |
addValidation(Filter validation) |
EntityDef |
addValidation(String validationExpression) |
EntityDef |
clone() |
boolean |
containsField(String name)
Returns true if this entity contains a
FieldDef with the specified name . |
boolean |
containsIndex(String name)
Returns true if this entity contains an
IndexDef with the specified name . |
boolean |
containsInheritedField(String name)
Returns true if this entity or any of its super entities contains a
FieldDef with the specified name . |
boolean |
containsInheritedIndex(String name)
Returns true if this entity or any of its super entities contains an
IndexDef with the specified name . |
Record |
createEmptyRecord() |
boolean |
equals(Object obj) |
EntityDef |
fromJson(String jsonString) |
EntityDef |
fromRecord(Record source)
Loads this instance's state from a record and returns
this (for fluid API call chaining). |
EntityDef |
fromXmlElement(Element entityDefElement) |
void |
generateJavaCode(JavaCodeBuilder code) |
Attributes |
getAttributes()
User-defined key-value pairs to attached arbitrary metadata to this entity.
|
String |
getDescription()
The human-readable summary of this entity.
|
FieldDef |
getField(String name)
Returns the
FieldDef that matches the specified name. |
int |
getFieldCount() |
List<String> |
getFieldNames() |
List<FieldDef> |
getFields() |
List<FieldDef> |
getFields(boolean create) |
List<FieldDef> |
getFields(String name) |
IndexDef |
getIndex(String name) |
int |
getIndexCount()
Returns the number of indexes in this entity.
|
List<IndexDef> |
getIndexes() |
List<IndexDef> |
getIndexes(boolean create) |
List<IndexDef> |
getIndexes(String name) |
List<String> |
getIndexNames()
Returns the names of all indexes in this entity.
|
int |
getInheritedFieldCount() |
List<FieldDef> |
getInheritedFields()
Returns the fields in this entity and its super entities with overridden super fields removed.
|
List<FieldDef> |
getInheritedFields(boolean excludeOverriddenFields)
Returns the fields in this entity and its super entities, optionally removing overridden super fields.
|
List<FieldDef> |
getInheritedFields(List<FieldDef> result,
boolean excludeOverriddenFields)
Returns the fields in this entity and its super entities, optionally removing overridden super fields.
|
int |
getInheritedIndexCount()
Returns the number of indexes in this entity and its super entities.
|
String |
getName()
The human-readable text identifier for this entity.
|
List<String> |
getPrimaryKeyFieldNames() |
List<FieldDef> |
getPrimaryKeyFields() |
String |
getQualifiedName()
Returns the fully qualified name that includes the name of this entity and all names in its hierarchy separated by period.
|
SchemaDef |
getSchemaDef()
The parent schema this entity belongs to.
|
SchemaPart |
getSchemaPartContainer() |
String |
getSchemaPartName() |
SchemaPartType |
getSchemaPartType() |
void |
getSchemaProblems(List<SchemaProblem> problems,
boolean includeChildren) |
EntityDef |
getSuperEntity()
Returns the parent entity this entity inherits from (a superclass in object-oriented programming).
|
String |
getSuperEntityName()
Returns the name of the parent entity this entity inherits from (a superclass in object-oriented programming).
|
Tags |
getTags()
The set of labels used to organize, filter, and classify this entity.
|
List<Filter> |
getValidations()
The list of arbitrary validations associated with this entity.
|
List<Filter> |
getValidations(boolean create) |
List<String> |
getValidationsSource()
The list of
toString() results from all filters. |
boolean |
hasCompositePrimaryKeys() |
int |
hashCode() |
int |
indexOfField(String fieldName) |
int |
indexOfField(String fieldName,
boolean throwExceptionOnFailure) |
int |
indexOfIndex(String indexName)
Returns the zero-based position of the
IndexDef with the specified name or -1 if it is not found. |
int |
indexOfIndex(String indexName,
boolean throwExceptionOnFailure)
Returns the zero-based position of the
IndexDef with the specified name or -1 if it is not found and throwExceptionOnFailure is false, otherwise a DataException is thrown. |
boolean |
isAddMissingOptionalFields()
Indicates if data mapping should add optional fields in this entity that are not present in the data (doesn't apply during validation).
|
boolean |
isAllowExtraFieldsInMapping()
Indicates if data mapping should fail when the data contains fields not present in this entity (doesn't apply during validation).
|
boolean |
isAllowExtraFieldsInValidation()
Indicates if data validation should fail when the data contains fields not present in this entity (doesn't apply during mapping ).
|
ValidationResult |
mapAndValidateRecord(Record record) |
ValidationResult |
mapAndValidateRecord(Record record,
ValidationResult result) |
ValidationResult |
mapRecord(Record record) |
ValidationResult |
mapRecord(Record record,
ValidationResult result) |
void |
moveField(int oldIndex,
int newIndex)
Moves the field at the
oldIndex to the newIndex , shifting any existing elements at or after newIndex to the right. |
void |
moveField(String fieldName,
int newIndex)
Moves the field with the given name to the
newIndex , shifting any existing elements at or after newIndex to the right. |
void |
moveFieldAfter(String fieldName,
String afterFieldName)
Moves the field with the given
fieldName after to the field with the specified afterFieldName , shifting any existing elements after afterFieldName to the right. |
void |
moveFieldBefore(String fieldName,
String beforeFieldName)
Moves the field with the given
fieldName before to the field with the specified beforeFieldName , shifting elements at or after beforeFieldName to the right. |
void |
moveIndex(int oldIndex,
int newIndex)
Moves the index at the
oldIndex to the newIndex , shifting any existing elements at or after newIndex to the right. |
void |
moveIndex(String indexName,
int newIndex)
Moves the index with the given name to the
newIndex , shifting any existing elements at or after newIndex to the right. |
void |
moveIndexAfter(String indexName,
String afterIndexName)
Moves the index with the given
indexName after to the index with the specified afterIndexName , shifting any existing elements after afterIndexName to the right. |
void |
moveIndexBefore(String indexName,
String beforeIndexName)
Moves the index with the given
indexName before to the index with the specified beforeIndexName , shifting elements at or after beforeIndexName to the right. |
EntityDef |
setAddMissingOptionalFields(boolean addMissingOptionalFields) |
EntityDef |
setAllowExtraFieldsInMapping(boolean allowExtraFieldsInMapping) |
EntityDef |
setAllowExtraFieldsInValidation(boolean allowExtraFieldsInValidation) |
EntityDef |
setAttributes(Attributes attributes) |
EntityDef |
setDescription(String description) |
EntityDef |
setFields(List<FieldDef> fields) |
EntityDef |
setIndexes(List<IndexDef> indexes) |
EntityDef |
setName(String name) |
protected EntityDef |
setSchemaDef(SchemaDef schemaDef) |
EntityDef |
setSuperEntityName(String superEntityName)
Sets the name of the parent entity this entity inherits from (a superclass in object-oriented programming).
|
EntityDef |
setTags(Tags tags) |
EntityDef |
setValidations(List<Filter> validations) |
String |
toJson() |
Record |
toRecord() |
Element |
toXmlElement(Document document) |
ValidationResult |
validateRecord(Record record) |
ValidationResult |
validateRecord(Record record,
ValidationResult result) |
getSchemaName, getSchemaPartContainerName, getSchemaPartContainerType
addExceptionProperties, assertValid, assertValid, exception, exception, exception, getInternalId, getInternalName, resetInternalId
finalize, getClass, notify, notifyAll, wait, wait, wait
getSchemaProblems, getSchemaProblems
fromArrayValue, fromArrayValue, fromArrayValue, fromJson, newInstanceFromRecord, newInstanceFromRecord, toArrayValue, toJson, toJson, toRecord
newInstanceFromJson
forEachGrandChildElement, fromXml, fromXml, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getChildElement, getChildElements, newInstanceFromXml, newInstanceFromXml, setAttribute, toXml, toXml, toXml, toXml, toXml, writeXml, writeXml
public EntityDef()
public EntityDef(String name)
public void getSchemaProblems(List<SchemaProblem> problems, boolean includeChildren)
getSchemaProblems
in interface SchemaProblemsSupplier
public EntityDef clone()
clone
in class FoundationObject
public final ValidationResult mapAndValidateRecord(Record record)
public final ValidationResult mapAndValidateRecord(Record record, ValidationResult result)
public final ValidationResult mapRecord(Record record)
public final ValidationResult mapRecord(Record record, ValidationResult result)
public final ValidationResult validateRecord(Record record)
public final ValidationResult validateRecord(Record record, ValidationResult result)
public void generateJavaCode(JavaCodeBuilder code)
generateJavaCode
in interface JavaCodeGenerator
public SchemaDef getSchemaDef()
getSchemaDef
in class SchemaPart
public SchemaPart getSchemaPartContainer()
getSchemaPartContainer
in class SchemaPart
public SchemaPartType getSchemaPartType()
getSchemaPartType
in class SchemaPart
public String getSchemaPartName()
getSchemaPartName
in class SchemaPart
public String getName()
public String getQualifiedName()
public String getDescription()
public String getSuperEntityName()
public EntityDef setSuperEntityName(String superEntityName)
public EntityDef getSuperEntity()
public int getInheritedFieldCount()
public int getFieldCount()
public List<FieldDef> getInheritedFields()
public List<FieldDef> getInheritedFields(boolean excludeOverriddenFields)
public List<FieldDef> getInheritedFields(List<FieldDef> result, boolean excludeOverriddenFields)
public int indexOfField(String fieldName)
public int indexOfField(String fieldName, boolean throwExceptionOnFailure)
public int indexOfIndex(String indexName)
IndexDef
with the specified name or -1 if it is not found.public int indexOfIndex(String indexName, boolean throwExceptionOnFailure)
IndexDef
with the specified name or -1 if it is not found and throwExceptionOnFailure
is false, otherwise a DataException
is thrown.public boolean containsInheritedField(String name)
FieldDef
with the specified name
.public boolean containsField(String name)
FieldDef
with the specified name
.public boolean containsInheritedIndex(String name)
IndexDef
with the specified name
.public boolean containsIndex(String name)
IndexDef
with the specified name
.public boolean hasCompositePrimaryKeys()
public FieldDef getField(String name)
FieldDef
that matches the specified name.public List<Filter> getValidations()
public List<String> getValidationsSource()
toString()
results from all filters.public boolean isAllowExtraFieldsInValidation()
public EntityDef setAllowExtraFieldsInValidation(boolean allowExtraFieldsInValidation)
public boolean isAllowExtraFieldsInMapping()
public EntityDef setAllowExtraFieldsInMapping(boolean allowExtraFieldsInMapping)
public boolean isAddMissingOptionalFields()
public EntityDef setAddMissingOptionalFields(boolean addMissingOptionalFields)
public Attributes getAttributes()
public EntityDef setAttributes(Attributes attributes)
public Tags getTags()
public int getInheritedIndexCount()
public int getIndexCount()
public Record createEmptyRecord()
public Element toXmlElement(Document document)
toXmlElement
in interface XmlSerializable
public EntityDef fromXmlElement(Element entityDefElement)
fromXmlElement
in interface XmlSerializable
public String toJson()
toJson
in interface JsonSerializable
toJson
in interface RecordSerializable
public Record toRecord()
toRecord
in interface RecordSerializable
toRecord
in class Bean
public EntityDef fromRecord(Record source)
RecordSerializable
this
(for fluid API call chaining).
For fluid API call chaining, the overridden method should change the declared return type to its class.fromRecord
in interface RecordSerializable
fromRecord
in class Bean
public EntityDef fromJson(String jsonString)
fromJson
in interface JsonSerializable
fromJson
in interface RecordSerializable
public void moveField(int oldIndex, int newIndex)
oldIndex
to the newIndex
, shifting any existing elements at or after newIndex
to the right.public void moveField(String fieldName, int newIndex)
newIndex
, shifting any existing elements at or after newIndex
to the right.public void moveFieldBefore(String fieldName, String beforeFieldName)
fieldName
before to the field with the specified beforeFieldName
, shifting elements at or after beforeFieldName
to the right.public void moveFieldAfter(String fieldName, String afterFieldName)
fieldName
after to the field with the specified afterFieldName
, shifting any existing elements after afterFieldName
to the right.public void moveIndex(int oldIndex, int newIndex)
oldIndex
to the newIndex
, shifting any existing elements at or after newIndex
to the right.public void moveIndex(String indexName, int newIndex)
newIndex
, shifting any existing elements at or after newIndex
to the right.public void moveIndexBefore(String indexName, String beforeIndexName)
indexName
before to the index with the specified beforeIndexName
, shifting elements at or after beforeIndexName
to the right.Copyright (c) 2006-2023 North Concepts Inc. All Rights Reserved.