All Implemented Interfaces:
OMRSRepositoryPropertiesHelper

public class OMRSArchiveHelper extends OMRSRepositoryPropertiesUtilities
OMRSArchiveHelper provides utility methods to help in the construction of open metadata archives.
  • Constructor Details

    • OMRSArchiveHelper

      public OMRSArchiveHelper(OpenMetadataArchiveBuilder archiveBuilder, String archiveGUID, String originatorName, Date creationDate, long versionNumber, String versionName)
      Constructor receives information about the archive being built. This constructor is suitable if only creating typeDefs.
      Parameters:
      archiveBuilder - archive builder with the archive contents in it.
      archiveGUID - unique identifier for the archive.
      originatorName - name of the person / process creating the archive.
      creationDate - date that the archive was first built.
      versionNumber - version number of the archive.
      versionName - version name for the archive.
    • OMRSArchiveHelper

      public OMRSArchiveHelper(OpenMetadataArchiveBuilder archiveBuilder, String archiveGUID, String archiveName, String originatorName, Date creationDate, long versionNumber, String versionName, InstanceProvenanceType instanceProvenanceType, String license)
      Constructor receives information about the archive being built. This constructor is suitable for creating TypeDefs and instances.
      Parameters:
      archiveBuilder - archive builder with the archive contents in it.
      archiveGUID - unique identifier for the archive.
      archiveName - unique name for the archive.
      originatorName - name of the person / process creating the archive.
      creationDate - date that the archive was first built.
      versionNumber - version number of the archive.
      versionName - version name for the archive.
      instanceProvenanceType - type of archive.
      license - license for the archive contents.
  • Method Details

    • getPrimitiveDef

      public PrimitiveDef getPrimitiveDef(PrimitiveDefCategory primitiveDefCategory)
      Set up an individual primitive definition
      Parameters:
      primitiveDefCategory - category of the primitive def defines the unique information about this primitive type.
      Returns:
      initialized PrimitiveDef object ready for the archive
    • getArrayCollectionDef

      public CollectionDef getArrayCollectionDef(String guid, String description, String descriptionGUID, PrimitiveDefCategory arrayType)
      Create a CollectionDef for an Array. A new CollectionDef is required for each combination of primitive types used to initialize the collection. Each CollectionDef has its own unique identifier (guid) and its name is a combination of the collection type and the primitives use to initialize it.
      Parameters:
      guid - unique identifier for the CollectionDef
      description - short default description of the enum type
      descriptionGUID - guid of the valid value describing this collection type
      arrayType - type of the array.
      Returns:
      Filled out CollectionDef
    • getMapCollectionDef

      public CollectionDef getMapCollectionDef(String guid, String description, String descriptionGUID, PrimitiveDefCategory propertyKeyType, PrimitiveDefCategory propertyValueType)
      Create a CollectionDef for a map. A new CollectionDef is required for each combination of primitive types used to initialize the collection. Each CollectionDef has its own unique identifier (guid) and its name is a combination of the collection type and the primitives use to initialize it.
      Parameters:
      guid - unique identifier for the CollectionDef
      description - short default description of the enum type
      descriptionGUID - guid of the valid value describing this collection type
      propertyKeyType - type of the key for the map.
      propertyValueType - type of map value.
      Returns:
      Filled out CollectionDef
    • getEmptyEnumDef

      public EnumDef getEmptyEnumDef(String guid, String name, String description, String descriptionGUID)
      Create an EnumDef that has no valid values defined. These are added by the caller.
      Parameters:
      guid - unique identifier for the CollectionDef
      name - unique name for the CollectionDef
      description - short default description of the enum type
      descriptionGUID - guid of the valid value describing this enum type
      Returns:
      basic EnumDef without valid values
    • getEmptyEnumDef

      public EnumDef getEmptyEnumDef(String guid, String name, String description, String descriptionGUID, String descriptionWiki)
      Create an EnumDef that has no valid values defined. These are added by the caller.
      Parameters:
      guid - unique identifier for the CollectionDef
      name - unique name for the CollectionDef
      description - short default description of the enum type
      descriptionGUID - guid of the valid value describing this enum type
      descriptionWiki - link to the url for documentation of this type
      Returns:
      basic EnumDef without valid values
    • getEnumElementDef

      public EnumElementDef getEnumElementDef(int ordinal, String value, String description, String descriptionGUID)
      Create an EnumElementDef that carries one of the valid values for an Enum.
      Parameters:
      ordinal - code number
      value - name
      description - short description
      descriptionGUID - guid of the valid value describing this enum element
      Returns:
      Fully filled out EnumElementDef
    • getDefaultEntityDef

      public EntityDef getDefaultEntityDef(String guid, String name, TypeDefLink superType, String description, String descriptionGUID)
      Sets up a default EntityDef. Calling methods can override the default values. This EntityDef has no attribute defined.
      Parameters:
      guid - unique identifier for the entity
      name - name of the entity
      superType - Super type for this entity (null for top-level)
      description - short description of the entity
      descriptionGUID - guid of the valid value describing this entity type
      Returns:
      Initialized EntityDef
    • getDefaultEntityDef

      public EntityDef getDefaultEntityDef(String guid, String name, TypeDefLink superType, String description, String descriptionGUID, String descriptionWiki)
      Sets up a default EntityDef. Calling methods can override the default values. This EntityDef has no attribute defined.
      Parameters:
      guid - unique identifier for the entity
      name - name of the entity
      superType - Super type for this entity (null for top-level)
      description - short description of the entity
      descriptionGUID - guid of the valid value definition describing this entity type
      descriptionWiki - url to wiki page describing this type
      Returns:
      Initialized EntityDef
    • getStringTypeDefAttribute

      public TypeDefAttribute getStringTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of type String. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getIntTypeDefAttribute

      public TypeDefAttribute getIntTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of type int. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getBooleanTypeDefAttribute

      public TypeDefAttribute getBooleanTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of type boolean. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getDateTypeDefAttribute

      public TypeDefAttribute getDateTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of type date. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getLongTypeDefAttribute

      public TypeDefAttribute getLongTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of type long. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getFloatTypeDefAttribute

      public TypeDefAttribute getFloatTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of type long. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getArrayStringTypeDefAttribute

      public TypeDefAttribute getArrayStringTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is an array of strings. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getArrayIntTypeDefAttribute

      public TypeDefAttribute getArrayIntTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is an array of strings. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getMapStringStringTypeDefAttribute

      public TypeDefAttribute getMapStringStringTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of a map from string to string. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getMapStringObjectTypeDefAttribute

      public TypeDefAttribute getMapStringObjectTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of a map from string to string. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getMapStringBooleanTypeDefAttribute

      public TypeDefAttribute getMapStringBooleanTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of a map from string to boolean. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getMapStringLongTypeDefAttribute

      public TypeDefAttribute getMapStringLongTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of a map from string to boolean. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getMapStringIntTypeDefAttribute

      public TypeDefAttribute getMapStringIntTypeDefAttribute(String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name and description that is of a map from string to boolean. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getEnumTypeDefAttribute

      public TypeDefAttribute getEnumTypeDefAttribute(String enumTypeName, String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name, type and description. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      enumTypeName - name of the enum type for this attribute
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getArrayEnumTypeDefAttribute

      public TypeDefAttribute getArrayEnumTypeDefAttribute(String enumArrayTypeName, String attributeName, String attributeDescription, String attributeDescriptionGUID)
      Return an attribute with the supplied name, type and description. It is set up to be optional, indexable (useful for searches) but the value does not need to be unique. These are the typical values used for most open metadata attribute. They can be changed by the caller once the TypeDefAttribute is returned.
      Parameters:
      enumArrayTypeName - name of the enum type for this attribute
      attributeName - name of the attribute
      attributeDescription - short description for the attribute
      attributeDescriptionGUID - guid of the glossary term that describes this attribute.
      Returns:
      TypeDefAttribute of type string
    • getBasicRelationshipDef

      public RelationshipDef getBasicRelationshipDef(String guid, String name, TypeDefLink superType, String description, String descriptionGUID, ClassificationPropagationRule propagationRule)
      Returns a basic RelationshipDef without any attributes or ends set up. The caller is responsible for adding the attributes and ends definition.
      Parameters:
      guid - unique identifier for the relationship
      name - name of the relationship
      superType - Super type for this relationship (null for top-level)
      description - short default description of the relationship
      descriptionGUID - guid of the valid value that describes this relationship
      propagationRule - should classifications propagate over this relationship?
      Returns:
      RelationshipDef with no ends defined.
    • getBasicRelationshipDef

      public RelationshipDef getBasicRelationshipDef(String guid, String name, TypeDefLink superType, String description, String descriptionGUID, String descriptionWiki, ClassificationPropagationRule propagationRule)
      Returns a basic RelationshipDef without any attributes or ends set up. The caller is responsible for adding the attributes and ends definition.
      Parameters:
      guid - unique identifier for the relationship
      name - name of the relationship
      superType - Super type for this relationship (null for top-level)
      description - short default description of the relationship
      descriptionGUID - guid of the valid value that describes this relationship
      propagationRule - should classifications propagate over this relationship?
      descriptionWiki - url to docs
      Returns:
      RelationshipDef with no ends defined.
    • getRelationshipEndDef

      public RelationshipEndDef getRelationshipEndDef(TypeDefLink entityType, String attributeName, String attributeDescription, String attributeDescriptionGUID, RelationshipEndCardinality attributeCardinality)
      Returns a RelationshipEndDef object that sets up details of an entity at one end of a relationship.
      Parameters:
      entityType - details of the type of entity connected to this end.
      attributeName - name of the attribute that the entity at the other end uses to refer to this entity.
      attributeDescription - description of this attribute
      attributeDescriptionGUID - unique identifier of the glossary term describing this attribute.
      attributeCardinality - cardinality of this end of the relationship.
      Returns:
      the definition of one end of a Relationship.
    • getClassificationDef

      public ClassificationDef getClassificationDef(String guid, String name, TypeDefLink superType, String description, String descriptionGUID, TypeDefLink validEntityDef, boolean propagatable)
      Returns a basic ClassificationDef without any attributes. The caller is responsible for adding the attribute definitions.
      Parameters:
      guid - unique identifier for the classification
      name - name of the classification
      superType - Super type for this classification (null for top-level)
      description - short description of the classification
      descriptionGUID - unique identifier of the valid value that describes this classification.
      validEntityDef - which entities can this classification be linked to.
      propagatable - can the classification propagate over relationships?
      Returns:
      ClassificationDef with no attributes defined.
    • getClassificationDef

      public ClassificationDef getClassificationDef(String guid, String name, TypeDefLink superType, String description, String descriptionGUID, String descriptionWiki, TypeDefLink validEntityDef, boolean propagatable)
      Returns a basic ClassificationDef without any attributes. The caller is responsible for adding the attribute definitions.
      Parameters:
      guid - unique identifier for the classification
      name - name of the classification
      superType - Super type for this classification (null for top-level)
      description - short description of the classification
      descriptionGUID - unique identifier of the valid value that describes this classification
      descriptionWiki - url to wiki
      validEntityDef - which entities can this classification be linked to.
      propagatable - can the classification propagate over relationships?
      Returns:
      ClassificationDef with no attributes defined.
    • getClassificationDef

      public ClassificationDef getClassificationDef(String guid, String name, TypeDefLink superType, String description, String descriptionGUID, List<TypeDefLink> validEntityDefs, boolean propagatable)
      Returns a basic ClassificationDef without any attributes. The caller is responsible for adding the attribute definitions.
      Parameters:
      guid - unique identifier for the classification
      name - name of the classification
      superType - Super type for this classification (null for top-level)
      description - short description of the classification
      descriptionGUID - unique identifier of the valid value that describes this classification.
      validEntityDefs - which entities can this classification be linked to.
      propagatable - can the classification propagate over relationships?
      Returns:
      ClassificationDef with no attributes defined.
    • getClassificationDef

      public ClassificationDef getClassificationDef(String guid, String name, TypeDefLink superType, String description, String descriptionGUID, String descriptionWiki, List<TypeDefLink> validEntityDefs, boolean propagatable)
      Returns a basic ClassificationDef without any attributes. The caller is responsible for adding the attribute definitions.
      Parameters:
      guid - unique identifier for the classification
      name - name of the classification
      superType - Super type for this classification (null for top-level)
      description - short description of the classification
      descriptionGUID - unique identifier of the valid value that describes this classification
      descriptionWiki - url to wiki
      validEntityDefs - which entities can this classification be linked to.
      propagatable - can the classification propagate over relationships?
      Returns:
      ClassificationDef with no attributes defined.
    • getEntityDetail

      public EntityDetail getEntityDetail(String typeName, String guid, InstanceProperties properties, InstanceStatus status, List<Classification> classifications)
      Return a specific entity detail instance.
      Parameters:
      typeName - type name of the entity
      guid - unique identifier of the entity
      properties - properties (attributes) for the entity
      status - instance status
      classifications - list of classifications
      Returns:
      assembled entity
    • getRelationship

      public Relationship getRelationship(String typeName, String guid, InstanceProperties properties, InstanceStatus status, EntityProxy end1, EntityProxy end2)
      Return a specific relationship instance.
      Parameters:
      typeName - type name of the relationship
      guid - unique identifier of the relationship
      properties - properties (attributes) for the relationship
      status - instance status
      end1 - relationship end 1
      end2 - relationship end 2
      Returns:
      relationship instance
    • getClassification

      public Classification getClassification(String typeName, InstanceProperties properties, InstanceStatus status)
      Return a specific classification instance.
      Parameters:
      typeName - type name of the classification
      properties - properties (attributes) for the classification
      status - instance status
      Returns:
      classification instance
    • getEntityProxy

      public EntityProxy getEntityProxy(String typeName, String guid, InstanceProperties properties, InstanceStatus status, List<Classification> classifications)
      Return a specific entity proxy instance.
      Parameters:
      typeName - type name of the entity
      guid - unique identifier of the entity
      properties - unique properties (attributes) for the entity
      status - instance status
      classifications - list of classifications
      Returns:
      classification instance
    • getEntityProxy

      public EntityProxy getEntityProxy(EntityDetail entity)
      Build an entity proxy from an entity.
      Parameters:
      entity - entity to use as a template
      Returns:
      new entity proxy.
    • getClassificationEntityExtension

      public ClassificationEntityExtension getClassificationEntityExtension(EntityProxy entity, Classification classification)
      Build a classification entity extension that is used to pass a classification in an archive.
      Parameters:
      entity - entity proxy to shoe where the classification should be attached
      classification - classification to attach
      Returns:
      new object
    • getEnumElement

      public EnumElementDef getEnumElement(String enumTypeName, int ordinal)
      Extract the enum value definition based on the ordinal.
      Parameters:
      enumTypeName - name of the enum type
      ordinal - ordinal number for the enum value
      Returns:
      enum element def or its default value