Class OMRSRepositoryContentHelper
java.lang.Object
org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.utilities.OMRSRepositoryPropertiesUtilities
org.odpi.openmetadata.repositoryservices.localrepository.repositorycontentmanager.OMRSRepositoryContentHelper
- All Implemented Interfaces:
OMRSRepositoryHelper
,OMRSRepositoryPropertiesHelper
public class OMRSRepositoryContentHelper
extends OMRSRepositoryPropertiesUtilities
implements OMRSRepositoryHelper
OMRSRepositoryContentHelper provides methods to repository connectors and repository event mappers to help
them build valid type definitions (TypeDefs), entities and relationships. It is a facade to the
repository content manager which holds an in memory cache of all the active TypeDefs in the local server.
OMRSRepositoryContentHelper's purpose is to create an object that the repository connectors and event mappers can
create, use and discard without needing to know how to connect to the repository content manager.
-
Field Summary
Fields inherited from class org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.utilities.OMRSRepositoryPropertiesUtilities
METADATA_COLLECTION_ID_PROPERTY_NAME, METADATA_COLLECTION_NAME_PROPERTY_NAME
-
Constructor Summary
ConstructorDescriptionOMRSRepositoryContentHelper
(OMRSRepositoryContentManager repositoryContentManager) Creates a repository helper linked to the supplied repository content manager. -
Method Summary
Modifier and TypeMethodDescriptionaddClassificationToEntity
(String sourceName, EntityDetail entity, Classification newClassification, String methodName) Add a classification to an existing entity.addClassificationToEntity
(String sourceName, EntityProxy entity, Classification newClassification, String methodName) Add a classification to an existing entity proxyaddClassificationToList
(String sourceName, List<Classification> classificationList, Classification newClassification, String methodName) Add a classification to an existing entity.addEnumPropertyToInstance
(String sourceName, InstanceProperties properties, String propertyName, String enumTypeGUID, String enumTypeName, int ordinal, String methodName) Add the supplied property to an instance properties object.applyPatch
(String sourceName, TypeDef originalTypeDef, TypeDefPatch typeDefPatch) Returns an updated TypeDef that has had the supplied patch applied.void
checkEntityNotClassifiedEntity
(String sourceName, EntitySummary entity, String classificationName, String methodName) Deprecated.checkEntityNotClassifiedEntity
(String sourceName, EntitySummary entity, String classificationName, InstanceProperties classificationProperties, AuditLog auditLog, String methodName) Throws an exception if an entity is classified with the supplied classification name.int
compareProperties
(InstanceProperties instance1Properties, InstanceProperties instance2Properties, String propertyName, SequencingOrder sequencingOrder) Compare the properties of two instances and determine the sort order based on the nominated property value and sort order.deleteClassificationFromEntity
(String sourceName, EntityDetail entity, String oldClassificationName, String methodName) Remove a classification from an entitydeleteClassificationFromEntity
(String sourceName, EntityProxy entity, String oldClassificationName, String methodName) Remove a classification from an entityformatEntityResults
(List<EntityDetail> fullResults, int fromElement, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize) Use the paging and sequencing parameters to format the results for a repository call that returns a list of entity instances.formatRelationshipResults
(List<Relationship> fullResults, int fromElement, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize) Use the paging and sequencing parameters to format the results for a repository call that returns a list of relationship instances.Return the list of attributeTypeDefs active in the local repository.Return the list of typedefs active in the local repository.Return the list of typeDefs active in the local repository.getAllPropertiesForTypeDef
(String sourceName, TypeDef typeDef, String methodName) Return the names of all the properties in the supplied TypeDef and all of its super-types.getAllTypeDefsForProperty
(String sourceName, String propertyName, String methodName) Return the names of all the type definitions that define the supplied property name.getAttributeTypeDef
(String sourceName, String attributeTypeDefGUID, String methodName) Return the AttributeTypeDef identified by the guid and name supplied by the caller.getAttributeTypeDef
(String sourceName, String attributeTypeDefGUID, String attributeTypeDefName, String methodName) Return the AttributeTypeDef identified by the guid and name supplied by the caller.getAttributeTypeDefByName
(String sourceName, String attributeTypeDefName) Return the AttributeTypeDef identified by the name supplied by the caller.getClassificationFromEntity
(String sourceName, EntitySummary entity, String classificationName, String methodName) Return the named classification from an existing entity.getClassificationProperties
(String sourceName, List<Classification> classifications, String classificationName, String methodName) Return the properties from a named classification or null if classification not present or without properties.getContainsRegex
(String searchString) Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with a "contains" semantic.getContainsRegex
(String searchString, boolean insensitive) Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with a "contains" semantic.getEnd1EntityGUID
(Relationship relationship) Return the guid of an entity linked to end 1 of the relationship.getEnd2EntityGUID
(Relationship relationship) Return the guid of an entity linked to end 2 of the relationship.getEndsWithRegex
(String searchString) Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with an "endswith" semantic.getEndsWithRegex
(String searchString, boolean insensitive) Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with an "endswith" semantic.getEntityDetailDifferences
(EntityDetail left, EntityDetail right, boolean ignoreModificationStamps) Calculate the differences between the two provided EntityDetail objects.getEntityProxyDifferences
(EntityProxy left, EntityProxy right, boolean ignoreModificationStamps) Calculate the differences between the two provided EntityProxy objects.getEntitySummaryDifferences
(EntitySummary left, EntitySummary right, boolean ignoreModificationStamps) Calculate the differences between the two provided EntitySummary objects.getExactMatchRegex
(String searchString) Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, without being interpreted as a regular expression (i.e.getExactMatchRegex
(String searchString, boolean insensitive) Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, without being interpreted as a regular expression (i.e.getHomeClassificationsFromEntity
(String sourceName, EntityDetail entity, String metadataCollectionId, String methodName) Return the classifications from the requested metadata collection.Return the list of attributeTypeDefs active in the local repository.Return the list of typedefs known by the local repository.Return the list of typeDefs known in the cohort.getMetadataCollectionName
(String metadataCollectionId) Return the metadata collection name (or null) for a metadata collection id.getNewClassification
(String sourceName, String userName, String typeName, String entityTypeName, ClassificationOrigin classificationOrigin, String classificationOriginGUID, InstanceProperties properties) Deprecated.getNewClassification
(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String typeName, String entityTypeName, ClassificationOrigin classificationOrigin, String classificationOriginGUID, InstanceProperties properties) Return a classification with the header and type information filled out.getNewClassification
(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName, String entityTypeName, ClassificationOrigin classificationOrigin, String classificationOriginGUID, InstanceProperties properties) Return a classification with the header and type information filled out.getNewEntity
(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String replicatedBy, String userName, String typeName, InstanceProperties properties, List<Classification> classifications) Return a filled out entity.getNewEntity
(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String replicatedBy, String userName, String typeName, InstanceProperties properties, List<Classification> classifications) Return a filled out entity.getNewEntityProxy
(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName, InstanceProperties properties, List<Classification> classifications) Return a filled out entity.getNewEntityProxy
(String sourceName, EntityDetail entity) Generate an entity proxy from an entity and its TypeDef.getNewInstanceType
(String sourceName, TypeDefSummary typeDefSummary) Return a relationship with the header and type information filled out.getNewRelationship
(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String typeName, InstanceProperties properties) Return a filled out relationship which just needs the entity proxies added.getNewRelationship
(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName, InstanceProperties properties) Return a filled out relationship, caller just needs the entity proxies added.getOtherEnd
(String sourceName, String anchorEntityGUID, Relationship relationship) Return the entity proxy for the related entity.getOtherEndName
(String sourceName, String anchorEntityGUID, Relationship relationship) Return the attribute name for the related entity.getRelationshipDifferences
(Relationship left, Relationship right, boolean ignoreModificationStamps) Calculate the differences between the two provided Relationship objects.getSearchClassificationsFromList
(List<String> classificationNames) Convert the provided list of classification names into an equivalent SearchClassifications object.getSkeletonClassification
(String sourceName, String userName, String classificationTypeName, String entityTypeName) Return a classification with the header and type information filled out.getSkeletonClassification
(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String classificationTypeName, String entityTypeName) Return a classification with the header and type information filled out.getSkeletonClassification
(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String classificationTypeName, String entityTypeName) Return a classification with the header and type information filled out.getSkeletonEntity
(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String typeName) Return an entity with the header and type information filled out.getSkeletonEntity
(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName) Deprecated.getSkeletonEntitySummary
(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String typeName) Return an entity with the header and type information filled out.getSkeletonEntitySummary
(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName) Deprecated.getSkeletonRelationship
(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String typeName) Return a relationship with the header and type information filled out.getSkeletonRelationship
(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName) Return a relationship with the header and type information filled out.getStartsWithRegex
(String searchString) Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with a "startswith" semantic.getStartsWithRegex
(String searchString, boolean insensitive) Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with a "startswith" semantic.getSubTypesOf
(String sourceName, String superTypeName) Return the list of type names for all the subtypes of an entity type.getSuperTypes
(String sourceName, String typeDefName) Gets super types for given type name.getTypeDef
(String sourceName, String parameterName, String typeDefGUID, String methodName) Return the TypeDef identified by the guid supplied by the caller.getTypeDef
(String sourceName, String guidParameterName, String nameParameterName, String typeDefGUID, String typeDefName, String methodName) Return the TypeDef identified by the guid and name supplied by the caller.getTypeDefByName
(String sourceName, String typeDefName) Return the TypeDef identified by the name supplied by the caller.getTypeName
(InstanceAuditHeader instance) Returns the type name from an instance (entity, relationship or classification).getUniqueAttributesList
(String sourceName, String typeName) Determine the list of attribute names that contain a unique value.getUniqueProperties
(String sourceName, String typeName, InstanceProperties allProperties) Return an instance properties that only contains the properties that uniquely identify the entity.getUnqualifiedLiteralString
(String searchString) Retrieve an unescaped version of the provided string that can be treated as a literal (not a regular expression).incrementVersion
(String userId, InstanceAuditHeader originalInstance, Classification updatedInstance) Changes the control information to reflect an update in an instance.incrementVersion
(String userId, InstanceAuditHeader originalInstance, EntityDetail updatedInstance) Changes the control information to reflect an update in an instance.incrementVersion
(String userId, InstanceAuditHeader originalInstance, Relationship updatedInstance) Changes the control information to reflect an update in an instance.boolean
isCaseInsensitiveRegex
(String searchString) Indicates whether the provided string should be treated as a case-insensitive regular expression (true) or as a case-sensitive regular expression (false).boolean
isContainsRegex
(String searchString) Indicates whether the provided string should be treated as a simple "contains" regular expression (true) or any other regular expression (false).boolean
isContainsRegex
(String searchString, boolean insensitive) Indicates whether the provided string should be treated as a simple "contains" regular expression (true) or any other regular expression (false).boolean
isEndsWithRegex
(String searchString) Indicates whether the provided string should be treated as a simple "endswith" regular expression (true) or any other regular expression (false).boolean
isEndsWithRegex
(String searchString, boolean insensitive) Indicates whether the provided string should be treated as a simple "endswith" regular expression (true) or any other regular expression (false).boolean
isExactMatchRegex
(String searchString) Indicates whether the provided string should be treated as an exact match (true) or any other regular expression (false).boolean
isExactMatchRegex
(String searchString, boolean insensitive) Indicates whether the provided string should be treated as an exact match (true) or any other regular expression (false).boolean
isStartsWithRegex
(String searchString) Indicates whether the provided string should be treated as a simple "startswith" regular expression (true) or any other regular expression (false).boolean
isStartsWithRegex
(String searchString, boolean insensitive) Indicates whether the provided string should be treated as a simple "startswith" regular expression (true) or any other regular expression (false).boolean
Validate that the instance's type is of the expected/desired value.mergeInstanceProperties
(String sourceName, InstanceProperties existingProperties, InstanceProperties newProperties) Merge two sets of instance properties.void
registerMetadataCollection
(String metadataCollectionId, String metadataCollectionName) Remember the metadata collection name for this metadata collection id.boolean
relatedEntity
(String sourceName, String entityGUID, Relationship relationship) Return boolean true if entity is linked by this relationship.updateClassificationInEntity
(String sourceName, String userName, EntityDetail entity, Classification newClassification, String methodName) Replace an existing classification with a new oneupdateClassificationInEntity
(String sourceName, String userName, EntityProxy entity, Classification newClassification, String methodName) Replace an existing classification with a new oneMethods inherited from class org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.utilities.OMRSRepositoryPropertiesUtilities
addBooleanMapPropertyToInstance, addBooleanPropertyMapToInstance, addBooleanPropertyToInstance, addDateMapPropertyToInstance, addDatePropertyMapToInstance, addDatePropertyToInstance, addDoubleMapPropertyToInstance, addDoublePropertyMapToInstance, addDoublePropertyToInstance, addEnumPropertyToInstance, addFloatPropertyToInstance, addIntMapPropertyToInstance, addIntPropertyMapToInstance, addIntPropertyToInstance, addLongMapPropertyToInstance, addLongPropertyMapToInstance, addLongPropertyToInstance, addMapPropertyToInstance, addObjectPropertyToInstance, addPropertyMapToInstance, addStringArrayPropertyToInstance, addStringArrayStringMapPropertyToInstance, addStringMapPropertyToInstance, addStringPropertyMapToInstance, addStringPropertyToInstance, applyPatch, getBooleanMapFromProperty, getBooleanProperty, getDateMapFromProperty, getDateProperty, getDoubleMapFromProperty, getEnumPropertyOrdinal, getInstancePropertiesAsMap, getIntegerMapFromProperty, getIntProperty, getLongMapFromProperty, getLongProperty, getMapFromProperty, getMapProperty, getSearchPropertiesFromInstanceProperties, getStringArrayProperty, getStringArrayStringMapFromProperty, getStringMapFromProperty, getStringProperty, getUniquePropertiesList, removeBooleanMapFromProperty, removeBooleanProperty, removeDateMapFromProperty, removeDateProperty, removeDoubleMapFromProperty, removeEnumPropertyOrdinal, removeIntegerMapFromProperty, removeIntProperty, removeLongMapFromProperty, removeLongProperty, removeMapFromProperty, removeProperty, removeStringArrayProperty, removeStringArrayStringMapFromProperty, removeStringMapFromProperty, removeStringProperty, validateTypeDefPatch
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.utilities.OMRSRepositoryPropertiesHelper
addBooleanMapPropertyToInstance, addBooleanPropertyMapToInstance, addBooleanPropertyToInstance, addDateMapPropertyToInstance, addDatePropertyMapToInstance, addDatePropertyToInstance, addDoubleMapPropertyToInstance, addDoublePropertyMapToInstance, addDoublePropertyToInstance, addEnumPropertyToInstance, addFloatPropertyToInstance, addIntMapPropertyToInstance, addIntPropertyMapToInstance, addIntPropertyToInstance, addLongMapPropertyToInstance, addLongPropertyMapToInstance, addLongPropertyToInstance, addMapPropertyToInstance, addObjectPropertyToInstance, addPropertyMapToInstance, addStringArrayPropertyToInstance, addStringArrayStringMapPropertyToInstance, addStringMapPropertyToInstance, addStringPropertyMapToInstance, addStringPropertyToInstance, getBooleanMapFromProperty, getBooleanProperty, getDateMapFromProperty, getDateProperty, getDoubleMapFromProperty, getEnumPropertyOrdinal, getInstancePropertiesAsMap, getIntegerMapFromProperty, getIntProperty, getLongMapFromProperty, getLongProperty, getMapFromProperty, getMapProperty, getSearchPropertiesFromInstanceProperties, getStringArrayProperty, getStringArrayStringMapFromProperty, getStringMapFromProperty, getStringProperty, removeBooleanMapFromProperty, removeBooleanProperty, removeDateMapFromProperty, removeDateProperty, removeDoubleMapFromProperty, removeEnumPropertyOrdinal, removeIntegerMapFromProperty, removeIntProperty, removeLongMapFromProperty, removeLongProperty, removeMapFromProperty, removeStringArrayProperty, removeStringArrayStringMapFromProperty, removeStringMapFromProperty, removeStringProperty
-
Constructor Details
-
OMRSRepositoryContentHelper
Creates a repository helper linked to the supplied repository content manager.- Parameters:
repositoryContentManager
- object associated with the local repository.
-
-
Method Details
-
getActiveTypeDefGallery
Return the list of typedefs active in the local repository.- Specified by:
getActiveTypeDefGallery
in interfaceOMRSRepositoryHelper
- Returns:
- TypeDef gallery
-
getActiveTypeDefs
Return the list of typeDefs active in the local repository.- Specified by:
getActiveTypeDefs
in interfaceOMRSRepositoryHelper
- Returns:
- TypeDef list
-
getKnownTypeDefs
Return the list of typeDefs known in the cohort.- Specified by:
getKnownTypeDefs
in interfaceOMRSRepositoryHelper
- Returns:
- TypeDef list
-
getActiveAttributeTypeDefs
Return the list of attributeTypeDefs active in the local repository.- Specified by:
getActiveAttributeTypeDefs
in interfaceOMRSRepositoryHelper
- Returns:
- AttributeTypeDef list
-
getKnownAttributeTypeDefs
Return the list of attributeTypeDefs active in the local repository.- Specified by:
getKnownAttributeTypeDefs
in interfaceOMRSRepositoryHelper
- Returns:
- AttributeTypeDef list
-
getKnownTypeDefGallery
Return the list of typedefs known by the local repository.- Specified by:
getKnownTypeDefGallery
in interfaceOMRSRepositoryHelper
- Returns:
- TypeDef gallery
-
getUniqueAttributesList
Determine the list of attribute names that contain a unique value. An empty list is returned if none have.- Specified by:
getUniqueAttributesList
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- callertypeName
- name of instance's type- Returns:
- list of attribute names
-
getUniqueProperties
public InstanceProperties getUniqueProperties(String sourceName, String typeName, InstanceProperties allProperties) Return an instance properties that only contains the properties that uniquely identify the entity. This is used when creating entity proxies.- Specified by:
getUniqueProperties
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- callertypeName
- name of instance's typeallProperties
- all the instance's properties- Returns:
- just the unique properties
-
getTypeDefByName
Return the TypeDef identified by the name supplied by the caller. This is used in the connectors when validating the actual types of the repository with the known open metadata types. It is looking specifically for types of the same name but with different content.- Specified by:
getTypeDefByName
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)typeDefName
- unique name for the TypeDef- Returns:
- TypeDef object or null if TypeDef is not known.
-
getSuperTypes
Gets super types for given type name.- Specified by:
getSuperTypes
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- the source of the request (used for logging)typeDefName
- unique name for the TypeDef- Returns:
- the super types
-
getOtherEndName
public String getOtherEndName(String sourceName, String anchorEntityGUID, Relationship relationship) Return the attribute name for the related entity.- Specified by:
getOtherEndName
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)anchorEntityGUID
- unique identifier of the anchor entityrelationship
- relationship to another entity- Returns:
- name of proxy to the other entity.
-
getOtherEnd
public EntityProxy getOtherEnd(String sourceName, String anchorEntityGUID, Relationship relationship) Return the entity proxy for the related entity.- Specified by:
getOtherEnd
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)anchorEntityGUID
- unique identifier of the anchor entityrelationship
- relationship to another entity- Returns:
- proxy to the other entity.
-
getAttributeTypeDefByName
Return the AttributeTypeDef identified by the name supplied by the caller. This is used in the connectors when validating the actual types of the repository with the known open metadata types. It is looking specifically for types of the same name but with different content.- Specified by:
getAttributeTypeDefByName
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)attributeTypeDefName
- unique name for the TypeDef- Returns:
- AttributeTypeDef object or null if AttributeTypeDef is not known.
-
getTypeDef
public TypeDef getTypeDef(String sourceName, String parameterName, String typeDefGUID, String methodName) throws TypeErrorException Return the TypeDef identified by the guid supplied by the caller. This call is used when retrieving a type that only the guid is known.- Specified by:
getTypeDef
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of guid parametertypeDefGUID
- unique identifier for the TypeDefmethodName
- calling method- Returns:
- TypeDef object
- Throws:
TypeErrorException
- unknown or invalid type
-
getAttributeTypeDef
public AttributeTypeDef getAttributeTypeDef(String sourceName, String attributeTypeDefGUID, String methodName) throws TypeErrorException Return the AttributeTypeDef identified by the guid and name supplied by the caller. This call is used when retrieving a type that only the guid is known.- Specified by:
getAttributeTypeDef
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)attributeTypeDefGUID
- unique identifier for the AttributeTypeDefmethodName
- calling method- Returns:
- TypeDef object
- Throws:
TypeErrorException
- unknown or invalid type
-
getTypeDef
public TypeDef getTypeDef(String sourceName, String guidParameterName, String nameParameterName, String typeDefGUID, String typeDefName, String methodName) throws TypeErrorException Return the TypeDef identified by the guid and name supplied by the caller. This call is used when retrieving a type that should exist. For example, retrieving the metadata instance's type.- Specified by:
getTypeDef
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of guid parameternameParameterName
- name of type name parametertypeDefGUID
- unique identifier for the TypeDeftypeDefName
- unique name for the TypeDefmethodName
- calling method- Returns:
- TypeDef object
- Throws:
TypeErrorException
- unknown or invalid type
-
getAttributeTypeDef
public AttributeTypeDef getAttributeTypeDef(String sourceName, String attributeTypeDefGUID, String attributeTypeDefName, String methodName) throws TypeErrorException Return the AttributeTypeDef identified by the guid and name supplied by the caller. This call is used when retrieving a type that should exist. For example, retrieving the type definition of a metadata instance's property.- Specified by:
getAttributeTypeDef
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)attributeTypeDefGUID
- unique identifier for the AttributeTypeDefattributeTypeDefName
- unique name for the AttributeTypeDefmethodName
- calling method- Returns:
- TypeDef object
- Throws:
TypeErrorException
- unknown or invalid type
-
addEnumPropertyToInstance
public InstanceProperties addEnumPropertyToInstance(String sourceName, InstanceProperties properties, String propertyName, String enumTypeGUID, String enumTypeName, int ordinal, String methodName) throws TypeErrorException Add the supplied property to an instance properties object. If the instance property object supplied is null, a new instance properties object is created.- Specified by:
addEnumPropertyToInstance
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- name of callerproperties
- properties object to add property to, may be null.propertyName
- name of propertyenumTypeGUID
- unique Id of Enum requestedenumTypeName
- unique name of enum requestedordinal
- numeric value of propertymethodName
- calling method name- Returns:
- instance properties object.
- Throws:
TypeErrorException
- the enum type is not recognized
-
applyPatch
public TypeDef applyPatch(String sourceName, TypeDef originalTypeDef, TypeDefPatch typeDefPatch) throws InvalidParameterException, PatchErrorException Returns an updated TypeDef that has had the supplied patch applied. It throws an exception if any part of the patch is incompatible with the original TypeDef. For example, if there is a mismatch between the type or version that either represents.- Specified by:
applyPatch
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the TypeDef (used for logging)originalTypeDef
- typeDef to updatetypeDefPatch
- patch to apply- Returns:
- updated TypeDef
- Throws:
InvalidParameterException
- the original typeDef or typeDefPatch is nullPatchErrorException
- the patch is either badly formatted, or does not apply to the supplied TypeDef
-
getSubTypesOf
Return the list of type names for all the subtypes of an entity type.- Specified by:
getSubTypesOf
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)superTypeName
- name of the super type - this value is not included in the result.- Returns:
- list of type names (a null means the type is not known, or it has no subtypes)
-
getAllPropertiesForTypeDef
public List<TypeDefAttribute> getAllPropertiesForTypeDef(String sourceName, TypeDef typeDef, String methodName) Return the names of all the properties in the supplied TypeDef and all of its super-types.- Specified by:
getAllPropertiesForTypeDef
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- name of caller.typeDef
- TypeDef to query.methodName
- calling method.- Returns:
- list of property names.
-
getAllTypeDefsForProperty
public Set<String> getAllTypeDefsForProperty(String sourceName, String propertyName, String methodName) Return the names of all the type definitions that define the supplied property name.- Specified by:
getAllTypeDefsForProperty
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- name of the caller.propertyName
- property name to query.methodName
- calling method.- Returns:
- set of names of the TypeDefs that define a property with this name
-
isTypeOf
Validate that the instance's type is of the expected/desired value. The actual instance may be a subtype of the expected type of course.- Specified by:
isTypeOf
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)actualTypeName
- name of the entity typeexpectedTypeName
- name of the expected type- Returns:
- boolean if they match (a null in actualTypeName results in false; a null in expectedType results in true)
-
registerMetadataCollection
Remember the metadata collection name for this metadata collection id. If the metadata collection id is null, it is ignored.- Specified by:
registerMetadataCollection
in interfaceOMRSRepositoryHelper
- Parameters:
metadataCollectionId
- unique identifier (guid) for the metadata collection.metadataCollectionName
- display name for the metadata collection (can be null).
-
getMetadataCollectionName
Return the metadata collection name (or null) for a metadata collection id.- Specified by:
getMetadataCollectionName
in interfaceOMRSRepositoryHelper
- Parameters:
metadataCollectionId
- unique identifier (guid) for the metadata collection.- Returns:
- display name
-
getSkeletonEntity
@Deprecated public EntityDetail getSkeletonEntity(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName) throws TypeErrorException Deprecated.Return an entity with the header and type information filled out. The caller only needs to add properties and classifications to complete the setup of the entity.- Specified by:
getSkeletonEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionprovenanceType
- origin of the entityuserName
- name of the creatortypeName
- name of the type- Returns:
- partially filled out entity needs classifications and properties
- Throws:
TypeErrorException
- the type name is not recognized.
-
getSkeletonEntity
public EntityDetail getSkeletonEntity(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String typeName) throws TypeErrorException Return an entity with the header and type information filled out. The caller only needs to add properties and classifications to complete the setup of the entity.- Specified by:
getSkeletonEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionprovenanceType
- origin of the entityuserName
- name of the creatortypeName
- name of the typemetadataCollectionName
- unique name for the home metadata collection- Returns:
- partially filled out entity needs classifications and properties
- Throws:
TypeErrorException
- the type name is not recognized.
-
getSkeletonEntitySummary
@Deprecated public EntitySummary getSkeletonEntitySummary(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName) throws TypeErrorException Deprecated.Return an entity with the header and type information filled out. The caller only needs to classifications to complete the setup of the entity.- Specified by:
getSkeletonEntitySummary
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionprovenanceType
- origin of the entityuserName
- name of the creatortypeName
- name of the type- Returns:
- partially filled out entity needs classifications
- Throws:
TypeErrorException
- the type name is not recognized.
-
getSkeletonEntitySummary
public EntitySummary getSkeletonEntitySummary(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String typeName) throws TypeErrorException Return an entity with the header and type information filled out. The caller only needs to classifications to complete the setup of the entity.- Specified by:
getSkeletonEntitySummary
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionmetadataCollectionName
- unique name for the home metadata collectionprovenanceType
- origin of the entityuserName
- name of the creatortypeName
- name of the type- Returns:
- partially filled out entity needs classifications
- Throws:
TypeErrorException
- the type name is not recognized.
-
getSkeletonClassification
public Classification getSkeletonClassification(String sourceName, String userName, String classificationTypeName, String entityTypeName) throws TypeErrorException Return a classification with the header and type information filled out. The caller only needs to add properties and possibility origin information if it is propagated to complete the setup of the classification.- Specified by:
getSkeletonClassification
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)userName
- name of the creatorclassificationTypeName
- name of the classification typeentityTypeName
- name of the type for the entity that this classification is to be attached to.- Returns:
- partially filled out classification needs properties and possibly origin information
- Throws:
TypeErrorException
- the type name is not recognized as a classification type.
-
getSkeletonClassification
public Classification getSkeletonClassification(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String classificationTypeName, String entityTypeName) throws TypeErrorException Return a classification with the header and type information filled out. The caller only needs to add properties and possibility origin information if it is propagated to complete the setup of the classification.- Specified by:
getSkeletonClassification
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionprovenanceType
- origin of the classificationuserName
- name of the creatorclassificationTypeName
- name of the classification typeentityTypeName
- name of the type for the entity that this classification is to be attached to.- Returns:
- partially filled out classification needs properties and possibly origin information
- Throws:
TypeErrorException
- the type name is not recognized as a classification type.
-
getSkeletonClassification
public Classification getSkeletonClassification(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String classificationTypeName, String entityTypeName) throws TypeErrorException Return a classification with the header and type information filled out. The caller only needs to add properties and possibility origin information if it is propagated to complete the setup of the classification.- Specified by:
getSkeletonClassification
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionmetadataCollectionName
- unique name for the home metadata collectionprovenanceType
- type of home for the new classificationuserName
- name of the creatorclassificationTypeName
- name of the classification typeentityTypeName
- name of the type for the entity that this classification is to be attached to.- Returns:
- partially filled out classification needs properties and possibly origin information
- Throws:
TypeErrorException
- the type name is not recognized as a classification type.
-
getSkeletonRelationship
public Relationship getSkeletonRelationship(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName) throws TypeErrorException Return a relationship with the header and type information filled out. The caller only needs to add properties to complete the setup of the relationship.- Specified by:
getSkeletonRelationship
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionprovenanceType
- origin type of the relationshipuserName
- name of the creatortypeName
- name of the relationship's type- Returns:
- partially filled out relationship needs properties
- Throws:
TypeErrorException
- the type name is not recognized as a relationship type.
-
getSkeletonRelationship
public Relationship getSkeletonRelationship(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String typeName) throws TypeErrorException Return a relationship with the header and type information filled out. The caller only needs to add properties to complete the setup of the relationship.- Specified by:
getSkeletonRelationship
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionmetadataCollectionName
- unique name for the home metadata collectionprovenanceType
- origin type of the relationshipuserName
- name of the creatortypeName
- name of the relationship's type- Returns:
- partially filled out relationship needs properties
- Throws:
TypeErrorException
- the type name is not recognized as a relationship type.
-
getNewInstanceType
public InstanceType getNewInstanceType(String sourceName, TypeDefSummary typeDefSummary) throws TypeErrorException Return a relationship with the header and type information filled out. The caller only needs to add properties to complete the setup of the relationship.- Specified by:
getNewInstanceType
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)typeDefSummary
- details of the new type- Returns:
- instance type
- Throws:
TypeErrorException
- the type name is not recognized as a relationship type.
-
getNewEntity
public EntityDetail getNewEntity(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String replicatedBy, String userName, String typeName, InstanceProperties properties, List<Classification> classifications) throws TypeErrorException Return a filled out entity. It just needs to add the classifications.- Specified by:
getNewEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionprovenanceType
- origin of the entityreplicatedBy
- for external entities only - null for local cohortuserName
- name of the creatortypeName
- name of the typeproperties
- properties for the entityclassifications
- list of classifications for the entity- Returns:
- an entity that is filled out
- Throws:
TypeErrorException
- the type name is not recognized as an entity type
-
getNewEntity
public EntityDetail getNewEntity(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String replicatedBy, String userName, String typeName, InstanceProperties properties, List<Classification> classifications) throws TypeErrorException Return a filled out entity. It just needs to add the classifications.- Specified by:
getNewEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionName
- unique name for the home metadata collectionmetadataCollectionId
- unique identifier for the home metadata collectionprovenanceType
- origin of the entityreplicatedBy
- for external entities only - null for local cohortuserName
- name of the creatortypeName
- name of the typeproperties
- properties for the entityclassifications
- list of classifications for the entity- Returns:
- an entity that is filled out
- Throws:
TypeErrorException
- the type name is not recognized as an entity type
-
getNewRelationship
public Relationship getNewRelationship(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName, InstanceProperties properties) throws TypeErrorException Return a filled out relationship, caller just needs the entity proxies added.- Specified by:
getNewRelationship
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionprovenanceType
- origin of the relationshipuserName
- name of the creatortypeName
- name of the typeproperties
- properties for the relationship- Returns:
- a relationship that is filled out
- Throws:
TypeErrorException
- the type name is not recognized as a relationship type
-
getNewRelationship
public Relationship getNewRelationship(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String typeName, InstanceProperties properties) throws TypeErrorException Return a filled out relationship which just needs the entity proxies added.- Specified by:
getNewRelationship
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionmetadataCollectionName
- unique name for the home metadata collectionprovenanceType
- origin of the relationshipuserName
- name of the creatortypeName
- name of the typeproperties
- properties for the relationship- Returns:
- a relationship that is filled out
- Throws:
TypeErrorException
- the type name is not recognized as a relationship type
-
getNewClassification
public Classification getNewClassification(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName, String entityTypeName, ClassificationOrigin classificationOrigin, String classificationOriginGUID, InstanceProperties properties) throws TypeErrorException Return a classification with the header and type information filled out. The caller only needs to add properties to complete the setup of the classification.- Specified by:
getNewClassification
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionprovenanceType
- origin of the classificationuserName
- name of the creatortypeName
- name of the typeentityTypeName
- name of the type for the entity that this classification is to be attached to.classificationOrigin
- source of the classificationclassificationOriginGUID
- if the classification is propagated, this is the unique identifier of the entity where the classification originated. Otherwise, it is nullproperties
- properties for the classification- Returns:
- partially filled out classification needs properties and possibly origin information
- Throws:
TypeErrorException
- the type name is not recognized as a classification type.
-
getNewClassification
@Deprecated public Classification getNewClassification(String sourceName, String userName, String typeName, String entityTypeName, ClassificationOrigin classificationOrigin, String classificationOriginGUID, InstanceProperties properties) throws TypeErrorException Deprecated.Return a classification with the header and type information filled out. The caller only needs to add properties to complete the setup of the classification. This method is deprecated because it does not take the provenance information. The implementation of this method sets the provenance information to "LOCAL_COHORT".- Specified by:
getNewClassification
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)userName
- name of the creatortypeName
- name of the typeentityTypeName
- name of the type for the entity that this classification is to be attached to.properties
- properties for the classificationclassificationOrigin
- source of the classification (assigned or propagated)classificationOriginGUID
- unique identifier of element that originated the classification if propagated- Returns:
- partially filled out classification needs properties and possibly origin information
- Throws:
TypeErrorException
- the type name is not recognized as a classification type.
-
getNewClassification
public Classification getNewClassification(String sourceName, String metadataCollectionId, String metadataCollectionName, InstanceProvenanceType provenanceType, String userName, String typeName, String entityTypeName, ClassificationOrigin classificationOrigin, String classificationOriginGUID, InstanceProperties properties) throws TypeErrorException Return a classification with the header and type information filled out. The caller only needs to add properties to complete the setup of the classification.- Specified by:
getNewClassification
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionmetadataCollectionName
- unique name for the home metadata collectionprovenanceType
- origin of the classificationuserName
- name of the creatortypeName
- name of the typeentityTypeName
- name of the type for the entity that this classification is to be attached to.classificationOrigin
- is this explicitly assigned or propagatedclassificationOriginGUID
- if propagated this the GUID of the originproperties
- properties for the classification- Returns:
- partially filled out classification needs properties and possibly origin information
- Throws:
TypeErrorException
- the type name is not recognized as a classification type.
-
checkEntityNotClassifiedEntity
@Deprecated public void checkEntityNotClassifiedEntity(String sourceName, EntitySummary entity, String classificationName, String methodName) throws ClassificationErrorException Deprecated.Throws an exception if an entity is classified with the supplied classification name. It is typically used when adding new classifications to entities.- Specified by:
checkEntityNotClassifiedEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to updateclassificationName
- classification to retrievemethodName
- calling method- Throws:
ClassificationErrorException
- the classification is not attached to the entity
-
checkEntityNotClassifiedEntity
public Classification checkEntityNotClassifiedEntity(String sourceName, EntitySummary entity, String classificationName, InstanceProperties classificationProperties, AuditLog auditLog, String methodName) throws ClassificationErrorException Throws an exception if an entity is classified with the supplied classification name. It is typically used when adding new classifications to entities.- Specified by:
checkEntityNotClassifiedEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to updateclassificationName
- classification to retrieveclassificationProperties
- list of properties to set in the classification.auditLog
- optional logging destinationmethodName
- calling method- Returns:
- duplicate classification
- Throws:
ClassificationErrorException
- the classification is not attached to the entity
-
addClassificationToList
public List<Classification> addClassificationToList(String sourceName, List<Classification> classificationList, Classification newClassification, String methodName) Add a classification to an existing entity.- Specified by:
addClassificationToList
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)classificationList
- entity classifications to updatenewClassification
- classification to addmethodName
- calling method- Returns:
- updated entity
-
addClassificationToEntity
public EntityDetail addClassificationToEntity(String sourceName, EntityDetail entity, Classification newClassification, String methodName) Add a classification to an existing entity.- Specified by:
addClassificationToEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to updatenewClassification
- classification to updatemethodName
- calling method- Returns:
- updated entity
-
addClassificationToEntity
public EntityProxy addClassificationToEntity(String sourceName, EntityProxy entity, Classification newClassification, String methodName) Add a classification to an existing entity proxy- Specified by:
addClassificationToEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to updatenewClassification
- classification to updatemethodName
- calling method- Returns:
- updated entity
-
getClassificationProperties
public InstanceProperties getClassificationProperties(String sourceName, List<Classification> classifications, String classificationName, String methodName) Return the properties from a named classification or null if classification not present or without properties.- Specified by:
getClassificationProperties
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)classifications
- list of classifications for an entityclassificationName
- classification to retrievemethodName
- calling method- Returns:
- located properties - or null if none
-
getClassificationFromEntity
public Classification getClassificationFromEntity(String sourceName, EntitySummary entity, String classificationName, String methodName) throws ClassificationErrorException Return the named classification from an existing entity.- Specified by:
getClassificationFromEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to updateclassificationName
- classification to retrievemethodName
- calling method- Returns:
- located classification
- Throws:
ClassificationErrorException
- the classification is not attached to the entity
-
getHomeClassificationsFromEntity
public List<Classification> getHomeClassificationsFromEntity(String sourceName, EntityDetail entity, String metadataCollectionId, String methodName) Return the classifications from the requested metadata collection. If the metadata collection is not set up in the header of the classification it is assumed that it is homed locally.- Specified by:
getHomeClassificationsFromEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to updatemetadataCollectionId
- metadata collection to retrievemethodName
- calling method- Returns:
- located classification
-
updateClassificationInEntity
public EntityDetail updateClassificationInEntity(String sourceName, String userName, EntityDetail entity, Classification newClassification, String methodName) Replace an existing classification with a new one- Specified by:
updateClassificationInEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)userName
- name of the editorentity
- entity to updatenewClassification
- classification to updatemethodName
- calling method- Returns:
- updated entity
-
updateClassificationInEntity
public EntityProxy updateClassificationInEntity(String sourceName, String userName, EntityProxy entity, Classification newClassification, String methodName) Replace an existing classification with a new one- Specified by:
updateClassificationInEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)userName
- name of the editorentity
- entity to updatenewClassification
- classification to updatemethodName
- calling method- Returns:
- updated entity
-
deleteClassificationFromEntity
public EntityDetail deleteClassificationFromEntity(String sourceName, EntityDetail entity, String oldClassificationName, String methodName) throws ClassificationErrorException Remove a classification from an entity- Specified by:
deleteClassificationFromEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to updateoldClassificationName
- classification to removemethodName
- calling method- Returns:
- updated entity
- Throws:
ClassificationErrorException
- the entity was not classified with this classification
-
deleteClassificationFromEntity
public EntityProxy deleteClassificationFromEntity(String sourceName, EntityProxy entity, String oldClassificationName, String methodName) throws ClassificationErrorException Remove a classification from an entity- Specified by:
deleteClassificationFromEntity
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to updateoldClassificationName
- classification to removemethodName
- calling method- Returns:
- updated entity
- Throws:
ClassificationErrorException
- the entity was not classified with this classification
-
mergeInstanceProperties
public InstanceProperties mergeInstanceProperties(String sourceName, InstanceProperties existingProperties, InstanceProperties newProperties) Merge two sets of instance properties.- Specified by:
mergeInstanceProperties
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)existingProperties
- current set of propertiesnewProperties
- properties to add/update- Returns:
- merged properties
-
incrementVersion
public Relationship incrementVersion(String userId, InstanceAuditHeader originalInstance, Relationship updatedInstance) Changes the control information to reflect an update in an instance.- Specified by:
incrementVersion
in interfaceOMRSRepositoryHelper
- Parameters:
userId
- user making the change.originalInstance
- original instance before the changeupdatedInstance
- new version of the instance that needs updating- Returns:
- updated instance
-
incrementVersion
public Classification incrementVersion(String userId, InstanceAuditHeader originalInstance, Classification updatedInstance) Changes the control information to reflect an update in an instance.- Specified by:
incrementVersion
in interfaceOMRSRepositoryHelper
- Parameters:
userId
- user making the change.originalInstance
- original instance before the changeupdatedInstance
- new version of the instance that needs updating- Returns:
- updated instance
-
incrementVersion
public EntityDetail incrementVersion(String userId, InstanceAuditHeader originalInstance, EntityDetail updatedInstance) Changes the control information to reflect an update in an instance.- Specified by:
incrementVersion
in interfaceOMRSRepositoryHelper
- Parameters:
userId
- user making the change.originalInstance
- original instance before the changeupdatedInstance
- new version of the instance that needs updating- Returns:
- updated instance
-
getNewEntityProxy
public EntityProxy getNewEntityProxy(String sourceName, EntityDetail entity) throws RepositoryErrorException Generate an entity proxy from an entity and its TypeDef.- Specified by:
getNewEntityProxy
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity instance- Returns:
- new entity proxy
- Throws:
RepositoryErrorException
- logic error in the repository corrupted entity
-
getNewEntityProxy
public EntityProxy getNewEntityProxy(String sourceName, String metadataCollectionId, InstanceProvenanceType provenanceType, String userName, String typeName, InstanceProperties properties, List<Classification> classifications) throws TypeErrorException Return a filled out entity.- Specified by:
getNewEntityProxy
in interfaceOMRSRepositoryHelper
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the home metadata collectionprovenanceType
- origin of the entityuserName
- name of the creatortypeName
- name of the typeproperties
- properties for the entity proxyclassifications
- list of classifications for the entity- Returns:
- an entity that is filled out
- Throws:
TypeErrorException
- the type name is not recognized as an entity type
-
getTypeName
public String getTypeName(InstanceAuditHeader instance) throws RepositoryErrorException, InvalidParameterException Returns the type name from an instance (entity, relationship or classification).- Specified by:
getTypeName
in interfaceOMRSRepositoryHelper
- Parameters:
instance
- instance to read- Returns:
- String type name
- Throws:
InvalidParameterException
- if the parameters are null or invalidRepositoryErrorException
- if the instance does not have a type name
-
getEnd1EntityGUID
Return the guid of an entity linked to end 1 of the relationship.- Specified by:
getEnd1EntityGUID
in interfaceOMRSRepositoryHelper
- Parameters:
relationship
- relationship to parse- Returns:
- String unique identifier
-
getEnd2EntityGUID
Return the guid of an entity linked to end 2 of the relationship.- Specified by:
getEnd2EntityGUID
in interfaceOMRSRepositoryHelper
- Parameters:
relationship
- relationship to parse- Returns:
- String unique identifier
-
formatEntityResults
public List<EntityDetail> formatEntityResults(List<EntityDetail> fullResults, int fromElement, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize) throws PagingErrorException, PropertyErrorException Use the paging and sequencing parameters to format the results for a repository call that returns a list of entity instances.- Specified by:
formatEntityResults
in interfaceOMRSRepositoryHelper
- Parameters:
fullResults
- - the full list of results in an arbitrary orderfromElement
- - the starting element number of the instances to return. This is used when retrieving elements beyond the first page of results. Zero means start from the first element.sequencingProperty
- - String name of the property that is to be used to sequence the results. Null means do not sequence on a property name (see SequencingOrder).sequencingOrder
- - Enum defining how the results should be ordered.pageSize
- - the maximum number of result entities that can be returned on this request. Zero means unrestricted return results size.- Returns:
- results array as requested
- Throws:
PropertyErrorException
- the sequencing property specified is not valid for any of the requested types of entity.PagingErrorException
- the paging/sequencing parameters are set up incorrectly.
-
formatRelationshipResults
public List<Relationship> formatRelationshipResults(List<Relationship> fullResults, int fromElement, String sequencingProperty, SequencingOrder sequencingOrder, int pageSize) throws PagingErrorException, PropertyErrorException Use the paging and sequencing parameters to format the results for a repository call that returns a list of relationship instances.- Specified by:
formatRelationshipResults
in interfaceOMRSRepositoryHelper
- Parameters:
fullResults
- - the full list of results in an arbitrary order. This is supplied not empty.fromElement
- - the starting element number of the instances to return. This is used when retrieving elements beyond the first page of results. Zero means start from the first element.sequencingProperty
- - String name of the property that is to be used to sequence the results. Null means do not sequence on a property name (see SequencingOrder).sequencingOrder
- - Enum defining how the results should be ordered.pageSize
- - the maximum number of result entities that can be returned on this request. Zero means unrestricted return results size.- Returns:
- results array as requested
- Throws:
PropertyErrorException
- the sequencing property specified is not valid for any of the requested types of relationship.PagingErrorException
- the paging/sequencing parameters are set up incorrectly.
-
compareProperties
public int compareProperties(InstanceProperties instance1Properties, InstanceProperties instance2Properties, String propertyName, SequencingOrder sequencingOrder) Compare the properties of two instances and determine the sort order based on the nominated property value and sort order.- Specified by:
compareProperties
in interfaceOMRSRepositoryHelper
- Parameters:
instance1Properties
- properties from first instanceinstance2Properties
- properties from second instancepropertyName
- name of property to comparesequencingOrder
- ascending or descending order- Returns:
- sort result
-
getExactMatchRegex
Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, without being interpreted as a regular expression (i.e. the returned string will be interpreted as a literal -- used to find an exact match of the string, irrespective of whether it contains characters that may have special meanings to regular expressions). Note that usage of the string by methods that cannot handle regular expressions should first un-escape the string using the getUnqualifiedLiteralString helper method. Finally, note that this enforces a case-sensitive search.- Specified by:
getExactMatchRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to escape to avoid being interpreted as a regular expression- Returns:
- string that is interpreted literally rather than as a regular expression
- See Also:
-
getExactMatchRegex
Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, without being interpreted as a regular expression (i.e. the returned string will be interpreted as a literal -- used to find an exact match of the string, irrespective of whether it contains characters that may have special meanings to regular expressions). Note that usage of the string by methods that cannot handle regular expressions should first un-escape the string using the getUnqualifiedLiteralString helper method.- Specified by:
getExactMatchRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to escape to avoid being interpreted as a regular expressioninsensitive
- set to true to have a case-insensitive exact match regular expression- Returns:
- string that is interpreted literally rather than as a regular expression
- See Also:
-
isExactMatchRegex
Indicates whether the provided string should be treated as an exact match (true) or any other regular expression (false). Note that this method relies on the use of the getExactMatchRegex helper method having been used to qualify a string when it should be treated as a literal. That is, this method relies on the presence of the escape sequences used by Java's Pattern.quote() method. The method is not intended to work on all strings in general to arbitrarily detect whether they might be a regular expression or not. Primarily a helper method for methods that do not directly handle regular expressions (for those it should be possible to just directly use the string as-is, and it will be correctly interpreted).- Specified by:
isExactMatchRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to check whether it should be interpreted literally or as a regular expression- Returns:
- true if the provided string should be interpreted literally, false if it should be interpreted as a regex
- See Also:
-
isExactMatchRegex
Indicates whether the provided string should be treated as an exact match (true) or any other regular expression (false). Note that this method relies on the use of the getExactMatchRegex helper method having been used to qualify a string when it should be treated as a literal. That is, this method relies on the presence of the escape sequences used by Java's Pattern.quote() method. The method is not intended to work on all strings in general to arbitrarily detect whether they might be a regular expression or not. Primarily a helper method for methods that do not directly handle regular expressions (for those it should be possible to just directly use the string as-is, and it will be correctly interpreted).- Specified by:
isExactMatchRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to check whether it should be interpreted literally or as a regular expressioninsensitive
- when true, only return true if the string is a case-insensitive exact match regex; when false, only return true if the string is a case-sensitive exact match regex- Returns:
- true if the provided string should be interpreted literally, false if it should be interpreted as a regex
- See Also:
-
getContainsRegex
Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with a "contains" semantic. The passed string will NOT be treated as a regular expression; if you intend to use both a "contains" semantic and a regular expression within the string, simply construct your own regular expression directly (not with this helper method). Note that usage of the returned string by methods that cannot handle regular expressions should first un-escape the returned string using the getUnqualifiedLiteralString helper method. Finally, note that this enforces a case-sensitive search.- Specified by:
getContainsRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to escape to avoid being interpreted as a regular expression, but also wrap to obtain a "contains" semantic- Returns:
- string that is interpreted literally, wrapped for a "contains" semantic
- See Also:
-
getContainsRegex
Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with a "contains" semantic. The passed string will NOT be treated as a regular expression; if you intend to use both a "contains" semantic and a regular expression within the string, simply construct your own regular expression directly (not with this helper method). Note that usage of the returned string by methods that cannot handle regular expressions should first un-escape the returned string using the getUnqualifiedLiteralString helper method.- Specified by:
getContainsRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to escape to avoid being interpreted as a regular expression, but also wrap to obtain a "contains" semanticinsensitive
- set to true to have a case-insensitive contains regular expression- Returns:
- string that is interpreted literally, wrapped for a "contains" semantic
- See Also:
-
isContainsRegex
Indicates whether the provided string should be treated as a simple "contains" regular expression (true) or any other regular expression (false). Note that this method relies on the use of the getContainsRegex helper method having been used to qualify a string when it should be treated primarily as a literal with only very basic "contains" wrapping. Primarily a helper method for methods that do not directly handle regular expressions (for those it should be possible to just directly use the string as-is and it will be correctly interpreted).- Specified by:
isContainsRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- - the string to check whether it should be interpreted as a simple "contains"- Returns:
- true if the provided string should be interpreted as a simple "contains", false if it should be interpreted as a full regex
- See Also:
-
isContainsRegex
Indicates whether the provided string should be treated as a simple "contains" regular expression (true) or any other regular expression (false). Note that this method relies on the use of the getContainsRegex helper method having been used to qualify a string when it should be treated primarily as a literal with only very basic "contains" wrapping. Primarily a helper method for methods that do not directly handle regular expressions (for those it should be possible to just directly use the string as-is and it will be correctly interpreted).- Specified by:
isContainsRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to check whether it should be interpreted as a simple "contains"insensitive
- when true, only return true if the string is a case-insensitive "contains" regex; when false, only return true if the string is a case-sensitive "contains" regex- Returns:
- true if the provided string should be interpreted as a simple "contains", false if it should be interpreted as a full regex
- See Also:
-
getStartsWithRegex
Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with a "startswith" semantic. The passed string will NOT be treated as a regular expression; if you intend to use both a "startswith" semantic and a regular expression within the string, simply construct your own regular expression directly (not with this helper method). Note that usage of the returned string by methods that cannot handle regular expressions should first un-escape the returned string using the getUnqualifiedLiteralString helper method. Finally, note that this enforces a case-sensitive search.- Specified by:
getStartsWithRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to escape to avoid being interpreted as a regular expression, but also wrap to obtain a "startswith" semantic- Returns:
- string that is interpreted literally, wrapped for a "startswith" semantic
- See Also:
-
getStartsWithRegex
Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with a "startswith" semantic. The passed string will NOT be treated as a regular expression; if you intend to use both a "startswith" semantic and a regular expression within the string, simply construct your own regular expression directly (not with this helper method). Note that usage of the returned string by methods that cannot handle regular expressions should first un-escape the returned string using the getUnqualifiedLiteralString helper method.- Specified by:
getStartsWithRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to escape to avoid being interpreted as a regular expression, but also wrap to obtain a "startswith" semanticinsensitive
- set to true to have a case-insensitive "startswith" regular expression- Returns:
- string that is interpreted literally, wrapped for a "startswith" semantic
- See Also:
-
isStartsWithRegex
Indicates whether the provided string should be treated as a simple "startswith" regular expression (true) or any other regular expression (false). Note that this method relies on the use of the getStartsWithRegex helper method having been used to qualify a string when it should be treated primarily as a literal with only very basic "startswith" wrapping. Primarily a helper method for methods that do not directly handle regular expressions (for those it should be possible to just directly use the string as-is and it will be correctly interpreted).- Specified by:
isStartsWithRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to check whether it should be interpreted as a simple "startswith"- Returns:
- true if the provided string should be interpreted as a simple "startswith", false if it should be interpreted as a full regex
- See Also:
-
isStartsWithRegex
Indicates whether the provided string should be treated as a simple "startswith" regular expression (true) or any other regular expression (false). Note that this method relies on the use of the getStartsWithRegex helper method having been used to qualify a string when it should be treated primarily as a literal with only very basic "startswith" wrapping. Primarily a helper method for methods that do not directly handle regular expressions (for those it should be possible to just directly use the string as-is and it will be correctly interpreted).- Specified by:
isStartsWithRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to check whether it should be interpreted as a simple "startswith"insensitive
- when true, only return true if the string is a case-insensitive "startswith" regex; when false, only return true if the string is a case-sensitive "startswith" regex- Returns:
- true if the provided string should be interpreted as a simple "startswith", false if it should be interpreted as a full regex
- See Also:
-
getEndsWithRegex
Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with an "endswith" semantic. The passed string will NOT be treated as a regular expression; if you intend to use both a "endswith" semantic and a regular expression within the string, simply construct your own regular expression directly (not with this helper method). Note that usage of the returned string by methods that cannot handle regular expressions should first un-escape the returned string using the getUnqualifiedLiteralString helper method. Finally, note that this enforces a case-sensitive search.- Specified by:
getEndsWithRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to escape to avoid being interpreted as a regular expression, but also wrap to obtain an "endswith" semantic- Returns:
- string that is interpreted literally, wrapped for an "endswith" semantic
- See Also:
-
getEndsWithRegex
Retrieve an escaped version of the provided string that can be passed to methods that expect regular expressions, to search for the string with an "endswith" semantic. The passed string will NOT be treated as a regular expression; if you intend to use both a "endswith" semantic and a regular expression within the string, simply construct your own regular expression directly (not with this helper method). Note that usage of the returned string by methods that cannot handle regular expressions should first un-escape the returned string using the getUnqualifiedLiteralString helper method.- Specified by:
getEndsWithRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to escape to avoid being interpreted as a regular expression, but also wrap to obtain an "endswith" semanticinsensitive
- set to true to have a case-insensitive "endswith" regular expression- Returns:
- string that is interpreted literally, wrapped for an "endswith" semantic
- See Also:
-
isEndsWithRegex
Indicates whether the provided string should be treated as a simple "endswith" regular expression (true) or any other regular expression (false). Note that this method relies on the use of the getEndsWithRegex helper method having been used to qualify a string when it should be treated primarily as a literal with only very basic "endswith" wrapping. Primarily a helper method for methods that do not directly handle regular expressions (for those it should be possible to just directly use the string as-is and it will be correctly interpreted).- Specified by:
isEndsWithRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to check whether it should be interpreted as a simple "endswith"- Returns:
- true if the provided string should be interpreted as a simple "endswith", false if it should be interpreted as a full regex
- See Also:
-
isEndsWithRegex
Indicates whether the provided string should be treated as a simple "endswith" regular expression (true) or any other regular expression (false). Note that this method relies on the use of the getEndsWithRegex helper method having been used to qualify a string when it should be treated primarily as a literal with only very basic "endswith" wrapping. Primarily a helper method for methods that do not directly handle regular expressions (for those it should be possible to just directly use the string as-is and it will be correctly interpreted).- Specified by:
isEndsWithRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to check whether it should be interpreted as a simple "endswith"insensitive
- when true, only return true if the string is a case-insensitive "endswith" regex; when false, only return true if the string is a case-sensitive "endswith" regex- Returns:
- true if the provided string should be interpreted as a simple "endswith", false if it should be interpreted as a full regex
- See Also:
-
getUnqualifiedLiteralString
Retrieve an unescaped version of the provided string that can be treated as a literal (not a regular expression). Primarily a helper method for methods that do not directly leverage regular expressions: so that they have a string they can treat as a literal without needing to un-escape the regex-meaningful characters injected by the various getXYZRegex helper methods. For example, this will translate the input of '.*\Qmy-search-string\E.*' into a return value of 'my-search-string'.- Specified by:
getUnqualifiedLiteralString
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- - the (potentially) wrapped and escaped string to un-escape and un-wrap- Returns:
- the un-escaped, un-wrapped literal string
- See Also:
-
isCaseInsensitiveRegex
Indicates whether the provided string should be treated as a case-insensitive regular expression (true) or as a case-sensitive regular expression (false). Note that this method relies on the use of the getXYZRegex helper methods having been used to qualify a string with case-insensitivity. Primarily this is a helper method for methods that do not directly handle regular expressions (for those it should be possible to just directly use the string as-is and it will be correctly interpreted).- Specified by:
isCaseInsensitiveRegex
in interfaceOMRSRepositoryHelper
- Parameters:
searchString
- the string to check whether it should be interpreted as case-insensitive- Returns:
- true if provided string should be interpreted as case-insensitive, false if it should be case-sensitive
- See Also:
-
getRelationshipDifferences
public RelationshipDifferences getRelationshipDifferences(Relationship left, Relationship right, boolean ignoreModificationStamps) Calculate the differences between the two provided Relationship objects.- Specified by:
getRelationshipDifferences
in interfaceOMRSRepositoryHelper
- Parameters:
left
- one of the Relationship objects to compareright
- the other Relationship object to compareignoreModificationStamps
- true if we should ignore modification details (Version, UpdateTime, UpdatedBy) as differences, or false if we should include differences on these- Returns:
- RelationshipDifferences
-
getEntityDetailDifferences
public EntityDetailDifferences getEntityDetailDifferences(EntityDetail left, EntityDetail right, boolean ignoreModificationStamps) Calculate the differences between the two provided EntityDetail objects.- Specified by:
getEntityDetailDifferences
in interfaceOMRSRepositoryHelper
- Parameters:
left
- one of the EntityDetail objects to compareright
- the other EntityDetail object to compareignoreModificationStamps
- true if we should ignore modification details (Version, UpdateTime, UpdatedBy) as differences, or false if we should include differences on these- Returns:
- EntityDetailDifferences
-
getEntityProxyDifferences
public EntityProxyDifferences getEntityProxyDifferences(EntityProxy left, EntityProxy right, boolean ignoreModificationStamps) Calculate the differences between the two provided EntityProxy objects.- Specified by:
getEntityProxyDifferences
in interfaceOMRSRepositoryHelper
- Parameters:
left
- one of the EntityProxy objects to compareright
- the other EntityProxy object to compareignoreModificationStamps
- true if we should ignore modification details (Version, UpdateTime, UpdatedBy) as differences, or false if we should include differences on these- Returns:
- EntityProxyDifferences
-
getEntitySummaryDifferences
public EntitySummaryDifferences getEntitySummaryDifferences(EntitySummary left, EntitySummary right, boolean ignoreModificationStamps) Calculate the differences between the two provided EntitySummary objects.- Specified by:
getEntitySummaryDifferences
in interfaceOMRSRepositoryHelper
- Parameters:
left
- one of the EntitySummary objects to compareright
- the other EntitySummary object to compareignoreModificationStamps
- true if we should ignore modification details (Version, UpdateTime, UpdatedBy) as differences, or false if we should include differences on these- Returns:
- EntitySummaryDifferences
-
getSearchClassificationsFromList
Convert the provided list of classification names into an equivalent SearchClassifications object.- Specified by:
getSearchClassificationsFromList
in interfaceOMRSRepositoryHelper
- Parameters:
classificationNames
- list of classification names- Returns:
- SearchClassifications
-