Class EntityRelationshipDef
java.lang.Object
com.northconcepts.datapipeline.foundations.core.Bean
com.northconcepts.datapipeline.foundations.core.FoundationObject
com.northconcepts.datapipeline.foundations.schema.SchemaObject
com.northconcepts.datapipeline.foundations.schema.SchemaPart
com.northconcepts.datapipeline.foundations.schema.EntityRelationshipDef
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,SchemaProblemsSupplier,JavaCodeGenerator,Serializable,Cloneable
The metadata model for relating two entities in a schema.
- See Also:
-
Field Summary
Fields inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
internalId, internalName, log, TIMESTAMP_FORMATFields inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
SERIALIZED_CLASS_NAME, TYPEFields inherited from interface com.northconcepts.datapipeline.core.XmlSerializable
XML_SERIALIZED_CLASS_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddForeignKeyFieldNames(String foreignKeyFieldName) Appends one foreign key field name; null is rejected.clone()booleanReturns true if the foreign key field names include the given name, ignoring case.booleanfromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).fromXmlElement(Element entityRelationShipDefElement) voidAppends Java source code representing this object to the given builder.User-defined key-value pairs to attached arbitrary metadata to this entityRelationShip.Returns the foreign entity from the parent schema or null if this relationship has no schema or the entity is not found.Returns the name of the entity that holds the foreign key fields.Returns the names of the foreign entity's fields that reference the primary entity's key, in key order, or null if none were added.getForeignKeyFieldNames(boolean create) Returns the foreign key field names, creating the list if it is null andcreateis true.Returns the foreign entity's fields named ingetForeignKeyFieldNames(), skipping names it does not define; empty if the foreign entity cannot be found.getName()Returns the primary entity from the parent schema or null if this relationship has no schema or the entity is not found.Returns the name of the entity whose primary key the foreign key fields reference.Returns the primary entity's primary key fields in key order or null if the primary entity cannot be found.Returns the fully qualified name that includes the name of this entity relationship and all names in its hierarchy separated by period.Returns the schema containing this part (itself for aSchemaDef) or null if the part is not in a schema.Returns the schema part containing this one or null if there is none.Returns the name identifying this part, such as an entity's name or an index field's field name.Returns the kind of part this is, such asSchemaPartType.ENTITY.voidgetSchemaProblems(List<SchemaProblem> problems, boolean includeChildren) Adds this element's problems to the list, plus those of its children whenincludeChildrenis true; the default adds none.getTags()The set of labels used to organize, filter, and classify this entityRelationShip.inthashCode()intReturns the zero-based position of the given foreign key field name, ignoring case, or -1 if it is not found.setAttributes(Attributes attributes) Sets the user-defined key-value pairs attached to this relationship (null is treated as empty).setCardinality(RelationshipCardinality cardinality) setDescription(String description) setForeignEntityName(String foreignEntityName) Sets the name of the entity that holds the foreign key fields.setForeignKeyFieldNames(String... foreignKeyFieldNames) Sets the foreign key field names, in key order, copying them into a new list.setForeignKeyFieldNames(List<String> foreignKeyFieldNames) Sets the names of the foreign entity's fields that reference the primary entity's key, in key order.setOnDeleteAction(ForeignKeyAction onDeleteAction) setOnUpdateAction(ForeignKeyAction onUpdateAction) setPrimaryEntityName(String primaryEntityName) Sets the name of the entity whose primary key the foreign key fields reference.protected EntityRelationshipDefsetSchemaDef(SchemaDef schemaDef) Sets the parent schema; called bySchemaDefwhen this relationship is added to it.Sets the labels used to organize, filter, and classify this relationship (null is treated as empty).toRecord()Converts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.toXmlElement(Document document) Returns an element, created withdocument, describing this object; the default implementation throws aDataException.Methods inherited from class com.northconcepts.datapipeline.foundations.schema.SchemaPart
getSchemaName, getSchemaPartContainerName, getSchemaPartContainerTypeMethods inherited from class com.northconcepts.datapipeline.foundations.core.FoundationObject
addExceptionProperties, assertValid, assertValid, exception, exception, exception, getInternalId, getInternalName, resetInternalIdMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.northconcepts.datapipeline.core.DataExceptionContributor
addExceptionPropertiesMethods inherited from interface com.northconcepts.datapipeline.core.RecordSerializable
fromJson, fromJson, toJson, toJson, toJsonMethods inherited from interface com.northconcepts.datapipeline.foundations.schema.SchemaProblemsSupplier
getSchemaProblems, getSchemaProblems
-
Constructor Details
-
EntityRelationshipDef
public EntityRelationshipDef() -
EntityRelationshipDef
-
-
Method Details
-
getSchemaProblems
Description copied from interface:SchemaProblemsSupplierAdds this element's problems to the list, plus those of its children whenincludeChildrenis true; the default adds none.- Specified by:
getSchemaProblemsin interfaceSchemaProblemsSupplier
-
clone
- Overrides:
clonein classFoundationObject
-
generateJavaCode
Description copied from interface:JavaCodeGeneratorAppends Java source code representing this object to the given builder.- Specified by:
generateJavaCodein interfaceJavaCodeGenerator
-
getSchemaDef
Description copied from class:SchemaPartReturns the schema containing this part (itself for aSchemaDef) or null if the part is not in a schema.- Specified by:
getSchemaDefin classSchemaPart
-
setSchemaDef
Sets the parent schema; called bySchemaDefwhen this relationship is added to it. -
getSchemaPartContainer
Description copied from class:SchemaPartReturns the schema part containing this one or null if there is none.- Specified by:
getSchemaPartContainerin classSchemaPart
-
getSchemaPartType
Description copied from class:SchemaPartReturns the kind of part this is, such asSchemaPartType.ENTITY.- Specified by:
getSchemaPartTypein classSchemaPart
-
getSchemaPartName
Description copied from class:SchemaPartReturns the name identifying this part, such as an entity's name or an index field's field name.- Specified by:
getSchemaPartNamein classSchemaPart
-
getName
-
setName
-
getQualifiedName
Returns the fully qualified name that includes the name of this entity relationship and all names in its hierarchy separated by period. -
getDescription
-
setDescription
-
getCardinality
-
setCardinality
-
getPrimaryEntityName
Returns the name of the entity whose primary key the foreign key fields reference. -
setPrimaryEntityName
Sets the name of the entity whose primary key the foreign key fields reference. -
getPrimaryEntity
Returns the primary entity from the parent schema or null if this relationship has no schema or the entity is not found. -
getForeignEntityName
Returns the name of the entity that holds the foreign key fields. -
setForeignEntityName
Sets the name of the entity that holds the foreign key fields. -
getForeignEntity
Returns the foreign entity from the parent schema or null if this relationship has no schema or the entity is not found. -
containsForeignKeyFieldName
Returns true if the foreign key field names include the given name, ignoring case. -
getForeignKeyFieldNames
Returns the foreign key field names, creating the list if it is null andcreateis true. -
getForeignKeyFieldNames
Returns the names of the foreign entity's fields that reference the primary entity's key, in key order, or null if none were added. -
getForeignKeyFields
Returns the foreign entity's fields named ingetForeignKeyFieldNames(), skipping names it does not define; empty if the foreign entity cannot be found. -
setForeignKeyFieldNames
Sets the names of the foreign entity's fields that reference the primary entity's key, in key order. -
setForeignKeyFieldNames
Sets the foreign key field names, in key order, copying them into a new list. -
addForeignKeyFieldNames
Appends one foreign key field name; null is rejected. -
getPrimaryKeyFields
Returns the primary entity's primary key fields in key order or null if the primary entity cannot be found. -
getOnUpdateAction
-
setOnUpdateAction
-
getOnDeleteAction
-
setOnDeleteAction
-
indexOfForeignKeyFieldName
Returns the zero-based position of the given foreign key field name, ignoring case, or -1 if it is not found. -
getAttributes
User-defined key-value pairs to attached arbitrary metadata to this entityRelationShip. -
setAttributes
Sets the user-defined key-value pairs attached to this relationship (null is treated as empty). -
getTags
The set of labels used to organize, filter, and classify this entityRelationShip. -
setTags
Sets the labels used to organize, filter, and classify this relationship (null is treated as empty). -
toXmlElement
Description copied from interface:XmlSerializableReturns an element, created withdocument, describing this object; the default implementation throws aDataException.- Specified by:
toXmlElementin interfaceXmlSerializable
-
fromXmlElement
- Specified by:
fromXmlElementin interfaceXmlSerializable
-
toRecord
Description copied from interface:RecordSerializableConverts this object's state to a record thatRecordSerializable.fromRecord(Record)can load.- Specified by:
toRecordin interfaceRecordSerializable- Overrides:
toRecordin classBean
-
fromRecord
Description copied from interface:RecordSerializableLoads this instance's state from a record and returnsthis(for fluid API call chaining). For fluid API call chaining, the overridden method should change the declared return type to its class.- Specified by:
fromRecordin interfaceRecordSerializable- Overrides:
fromRecordin classBean- Parameters:
source-- Returns:
- this instance.
-
hashCode
public int hashCode() -
equals
-