Class SchemaDef
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.SchemaDef
- All Implemented Interfaces:
DataExceptionContributor,JsonSerializable,RecordSerializable,XmlSerializable,SchemaProblemsSupplier,JavaCodeGenerator,Serializable,Cloneable
The metadata model containing a set of related entities.
- 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 TypeMethodDescriptionAppends the entity and makes this schema its parent.addEntityRelationship(EntityRelationshipDef entityRelationship) Appends the entity relationship and makes this schema its parent.clone()booleancontainsEntity(String name) Returns true if this schema contains anEntityDefwith the specifiedname.booleanReturns true if this schema contains anEntityRelationshipDefwith the specifiedname.booleanfromJson(InputStream inputStream) Loads this object's state from the UTF-8 encoded JSON in the stream.Loads this object's state from the given JSON text.fromRecord(Record source) Loads this instance's state from a record and returnsthis(for fluid API call chaining).fromXml(InputStream inputStream) Parses the XML in the stream and loads this object's state from its root element.fromXmlElement(Element schemaElement) voidAppends Java source code representing this object to the given builder.User-defined key-value pairs to attached arbitrary metadata to this schema.The human-readable summary of this schema.Returns the entities in this schema or null if none were added.getEntities(boolean create) Returns the entities, creating the list if it is null andcreateis true.getEntities(String name) Returns all entities whose name matches the given name, ignoring case; empty if none match or the name is empty.Returns theEntityDefthat matches the specified name.intgetEntityRelationship(String name) Returns theEntityRelationshipDefthat matches the specified name.getEntityRelationshipByForeignKeyName(String foreignKeyName) Returns a relationship whose name matches the given foreign key name, ignoring case, or null if there is none.intReturns the number of entity relationships in this schema.Returns the names of all entity relationships in this schema.Returns the entity relationships in this schema or null if none were added.getEntityRelationships(boolean create) Returns the entity relationships, creating the list if it is null andcreateis true.getEntityRelationshipsByForeignKeyName(String foreignKeyName) getForeignEntityRelationships(EntityDef foreignEntity) Returns the relationships whose foreign entity is the given entity, which must belong to this schema.getName()The human-readable text identifier for this schema.getPrimaryEntityRelationships(EntityDef primaryEntity) Returns the relationships whose primary entity is the given entity, which must belong to this schema.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 schema.inthashCode()intindexOfEntity(String name) Returns the zero-based position of theEntityDefwith the specified name or -1 if it is not found.intReturns the zero-based position of theEntityRelationshipDefwith the specified name or -1 if it is not found.setAttributes(Attributes attributes) Sets the user-defined key-value pairs attached to this schema (null is treated as empty).setDescription(String description) setEntities(List<EntityDef> entities) Replaces the entities with the given list (not copied) and makes this schema their parent.setEntityRelationships(List<EntityRelationshipDef> entityRelationships) Replaces the entity relationships with the given list (not copied) and makes this schema their parent.Sets the labels used to organize, filter, and classify this schema (null is treated as empty).toJson()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
toJson, toJsonMethods inherited from interface com.northconcepts.datapipeline.foundations.schema.SchemaProblemsSupplier
getSchemaProblems, getSchemaProblems
-
Constructor Details
-
SchemaDef
public SchemaDef() -
SchemaDef
-
-
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
-
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
The human-readable text identifier for this schema. -
setName
-
getDescription
The human-readable summary of this schema. -
setDescription
-
getEntityCount
public int getEntityCount() -
getEntityNames
-
getEntities
Returns the entities, creating the list if it is null andcreateis true. -
getEntities
Returns the entities in this schema or null if none were added. -
setEntities
Replaces the entities with the given list (not copied) and makes this schema their parent. -
addEntity
Appends the entity and makes this schema its parent. -
indexOfEntity
Returns the zero-based position of theEntityDefwith the specified name or -1 if it is not found. -
containsEntity
Returns true if this schema contains anEntityDefwith the specifiedname. -
getEntity
Returns theEntityDefthat matches the specified name. -
getEntities
Returns all entities whose name matches the given name, ignoring case; empty if none match or the name is empty. -
indexOfEntityRelationship
Returns the zero-based position of theEntityRelationshipDefwith the specified name or -1 if it is not found. -
containsEntityRelationship
Returns true if this schema contains anEntityRelationshipDefwith the specifiedname. -
getEntityRelationshipCount
public int getEntityRelationshipCount()Returns the number of entity relationships in this schema. -
getEntityRelationshipNames
Returns the names of all entity relationships in this schema. -
getEntityRelationships
Returns the entity relationships, creating the list if it is null andcreateis true. -
getEntityRelationship
Returns theEntityRelationshipDefthat matches the specified name. -
getEntityRelationships
Returns the entity relationships in this schema or null if none were added. -
getEntityRelationshipByForeignKeyName
Returns a relationship whose name matches the given foreign key name, ignoring case, or null if there is none. -
getEntityRelationshipsByForeignKeyName
-
setEntityRelationships
Replaces the entity relationships with the given list (not copied) and makes this schema their parent. -
addEntityRelationship
Appends the entity relationship and makes this schema its parent. -
getPrimaryEntityRelationships
Returns the relationships whose primary entity is the given entity, which must belong to this schema. -
getForeignEntityRelationships
Returns the relationships whose foreign entity is the given entity, which must belong to this schema. -
getAttributes
User-defined key-value pairs to attached arbitrary metadata to this schema. -
setAttributes
Sets the user-defined key-value pairs attached to this schema (null is treated as empty). -
getTags
The set of labels used to organize, filter, and classify this schema. -
setTags
Sets the labels used to organize, filter, and classify this schema (null is treated as empty). -
toJson
- Specified by:
toJsonin interfaceJsonSerializable- Specified by:
toJsonin interfaceRecordSerializable
-
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.
-
fromJson
Description copied from interface:JsonSerializableLoads this object's state from the given JSON text.- Specified by:
fromJsonin interfaceJsonSerializable- Specified by:
fromJsonin interfaceRecordSerializable
-
fromJson
Description copied from interface:JsonSerializableLoads this object's state from the UTF-8 encoded JSON in the stream.- Specified by:
fromJsonin interfaceJsonSerializable- Specified by:
fromJsonin interfaceRecordSerializable
-
fromXml
Description copied from interface:XmlSerializableParses the XML in the stream and loads this object's state from its root element.- Specified by:
fromXmlin interfaceXmlSerializable
-
fromXml
- Specified by:
fromXmlin interfaceXmlSerializable
-
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
-
hashCode
public int hashCode() -
equals
-