Class OMRSRepositoryContentValidator
java.lang.Object
org.odpi.openmetadata.repositoryservices.localrepository.repositorycontentmanager.OMRSRepositoryContentValidator
- All Implemented Interfaces:
OMRSRepositoryValidator
OMRSRepositoryContentValidator provides methods to validate TypeDefs and Instances returned from
an open metadata repository. It is typically used by OMRS repository connectors and
repository event mappers.
-
Constructor Summary
ConstructorDescriptionOMRSRepositoryContentValidator
(OMRSRepositoryContentManager repositoryContentManager) Typical constructor used by the OMRS to create a repository validator for a repository connector. -
Method Summary
Modifier and TypeMethodDescriptionint
countMatchingHeaderPropertyValues
(InstanceProperties matchProperties, InstanceAuditHeader instanceHeader, InstanceProperties instanceProperties) Count the number of matching property values that an instance has.int
countMatchingPropertyValues
(InstanceProperties matchProperties, InstanceProperties instanceProperties) Count the number of matching property values that an instance has.Retrieve a numeric representation of the provided value, or null if it cannot be converted to a number.getStringFromPropertyValue
(InstancePropertyValue instancePropertyValue) Return the string form of a property value.getStringValuesFromInstancePropertiesAsArray
(InstanceProperties instanceProperties) Return the string form of the instance properties.getStringValuesFromInstancePropertiesAsMap
(InstanceProperties instanceProperties) Return the string form of the instance properties.getStringValuesFromInstancePropertiesAsStruct
(InstanceProperties instanceProperties) Return the string form of the instance properties.getValidAttributeTypeDefFromIds
(String sourceName, String guidParameterName, String nameParameterName, String guid, String name, String methodName) Validate that an AttributeTypeDef's identifiers are not null and are recognized.getValidTypeDefFromIds
(String sourceName, String guidParameterName, String nameParameterName, String guid, String name, String methodName) Validate that a TypeDef's identifiers are not null and return the type.boolean
isActiveType
(String sourceName, String typeGUID, String typeName) Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.boolean
isActiveTypeId
(String sourceName, String typeGUID) Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.boolean
isATypeOf
(String sourceName, InstanceAuditHeader instance, String typeName, String localMethodName) Returns a boolean indicating that the instance is of the supplied type.boolean
isKnownType
(String sourceName, String typeGUID, String typeName) Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.boolean
isKnownTypeId
(String sourceName, String typeGUID) Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.boolean
isOpenType
(String sourceName, String typeGUID, String typeName) Return boolean indicating whether the TypeDef is one of the open metadata types.boolean
isOpenTypeId
(String sourceName, String typeGUID) Return boolean indicating whether the TypeDef is one of the open metadata types.void
validateActiveType
(String sourceName, String typeParameterName, TypeDefSummary typeDefSummary, TypeDefCategory category, String methodName) Validate that the supplied type is a valid active type.void
validateAsOfTime
(String sourceName, String parameterName, Date asOfTime, String methodName) Validate that the asOfTime parameter is not for the future.void
validateAsOfTimeNotNull
(String sourceName, String parameterName, Date asOfTime, String methodName) Validate that the asOfTime parameter is not null or for the future.void
validateAtMostOneEntityResult
(List<EntityDetail> findResults, String typeName, String serviceName, String methodName) Validate that either zero or one entity were returned from a find request.void
validateAtMostOneRelationshipResult
(List<Relationship> findResults, String typeName, String serviceName, String methodName) Validate that either zero or one relationship were returned from a find request.void
validateAttributeTypeDef
(String sourceName, String parameterName, AttributeTypeDef attributeTypeDef, String methodName) Validate the content of a new AttributeTypeDef.void
validateAttributeTypeDefCategory
(String sourceName, String nameParameterName, AttributeTypeDefCategory category, String methodName) Validate that a AttributeTypeDef's category is not null.void
validateAttributeTypeDefIds
(String sourceName, String guidParameterName, String nameParameterName, String guid, String name, String methodName) Validate that an AttributeTypeDef's identifiers are not null and are recognized.void
validateClassification
(String sourceName, String classificationParameterName, String classificationName, String entityTypeName, String methodName) Validate that a classification is valid for the entity.void
validateClassificationList
(String sourceName, String parameterName, List<Classification> classifications, String entityTypeName, String methodName) Validate that a classification is valid for the entity.validateClassificationName
(String sourceName, String parameterName, String classificationName, String methodName) Validate that a classification name is not null.void
validateClassificationProperties
(String sourceName, String classificationName, String propertiesParameterName, InstanceProperties classificationProperties, String methodName) Validate that a classification is valid for the entity.void
validateDateRange
(String sourceName, String parameterName, Date fromTime, Date toTime, String methodName) Validate that the time parameters are not inverted ('from' later than 'to').void
validateEnterpriseAttributeTypeDefs
(String sourceName, List<AttributeTypeDef> attributeTypeDefs, String methodName) Return a boolean flag indicating whether the list of TypeDefs passed are compatible with the all known typedefs.void
validateEnterpriseTypeDefs
(String sourceName, List<TypeDef> typeDefs, String methodName) Return a boolean flag indicating whether the list of TypeDefs passed are compatible with the all known typedefs.void
validateEntityCanBeRehomed
(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) Verify that an entity instance can be rehomed by the metadataCollection.void
validateEntityCanBeUpdated
(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) Verify that an entity instance can be updated by the metadataCollection.void
validateEntityFromStore
(String sourceName, String guid, EntityDetail entity, String methodName) Verify that an entity has been successfully retrieved from the repository and has valid contents.void
validateEntityFromStore
(String sourceName, String guid, EntitySummary entity, String methodName) Verify that an entity has been successfully retrieved from the repository and has valid contents.void
validateEntityIsDeleted
(String sourceName, InstanceHeader instance, String methodName) Verify the status of an entity to check it has been deleted.void
validateEntityIsNotDeleted
(String sourceName, InstanceHeader instance, String methodName) Verify the status of an entity to check if it has been deleted.void
validateEntityProxy
(String sourceName, String localMetadataCollectionId, String proxyParameterName, EntityProxy entityProxy, String methodName) Validates an entity proxy.void
validateExternalId
(String sourceName, String standard, String organization, String identifier, String methodName) Validate that the type's name is not null.void
validateGUID
(String sourceName, String guidParameterName, String guid, String methodName) Validate that an entity's identifier is not null.void
validateHomeMetadataGUID
(String sourceName, String guidParameterName, String guid, String methodName) Validate that a home metadata collection identifier is not null.void
validateHomeMetadataGUID
(String sourceName, Classification classification, String methodName) Validate that a home metadata collection identifier in a classification is not null.void
validateHomeMetadataGUID
(String sourceName, InstanceHeader instance, String methodName) Validate that a home metadata collection identifier in an instance is not null.void
validateInstanceStatus
(String sourceName, String instanceStatusParameterName, InstanceStatus instanceStatus, TypeDef typeDef, String methodName) Validates an instance status where null is permissible.void
validateInstanceStatusForDelete
(String sourceName, InstanceHeader instance, String methodName) Verify that an instance is not already deleted since the repository is processing a delete request, and it does not want to look stupid.void
validateInstanceType
(String sourceName, InstanceHeader instance) Verify that the instance retrieved from the repository has a valid instance type.void
validateInstanceType
(String sourceName, InstanceHeader instance, String typeGUIDParameterName, String typeNameParameterName, String expectedTypeGUID, String expectedTypeName) Verify that the instance retrieved from the repository has a valid instance type that matches the expected type.void
validateInstanceTypeGUID
(String sourceName, String guidParameterName, String guid, String methodName) Validate that if a type's identifier is passed then it is valid.void
validateKnownTypeDef
(String sourceName, String parameterName, TypeDef typeDef, String methodName) Validate the content of a new TypeDef is known.void
validateMatchCriteria
(String sourceName, String matchCriteriaParameterName, String matchPropertiesParameterName, MatchCriteria matchCriteria, InstanceProperties matchProperties, String methodName) Validate that a metadata instance match criteria and set of properties are either both null or both not null.void
validateMatchCriteria
(String sourceName, String parameterName, TypeDefProperties matchCriteria, String methodName) Validate that a TypeDef match criteria set of properties is not null.void
validateNewPropertiesForType
(String sourceName, String parameterName, TypeDef typeDef, InstanceProperties properties, String methodName) Validate that the properties for a metadata instance match its TypeDefvoid
validateNewStatus
(String sourceName, String instanceStatusParameterName, InstanceStatus instanceStatus, TypeDef typeDef, String methodName) Validates an instance status where null is not allowed.void
validateOptionalTypeGUID
(String sourceName, String guidParameterName, String guid, String methodName) Validate that type's identifier is not null.void
validateOptionalTypeGUIDs
(String sourceName, String guidParameterName, String guid, String subtypeParameterName, List<String> subtypeGuids, String methodName) Validate that the types and subtypes (if specified) fit each other.void
validatePageSize
(String sourceName, String parameterName, int pageSize, String methodName) Validate that a page size parameter is not negative.void
validatePropertiesForType
(String sourceName, String parameterName, TypeDef typeDef, InstanceProperties properties, String methodName) Validate that the properties for a metadata instance match its TypeDef.void
validatePropertiesForType
(String sourceName, String parameterName, TypeDefSummary typeDefSummary, InstanceProperties properties, String methodName) Validate that the properties for a metadata instance match its TypeDefvoid
validateReferenceInstanceHeader
(String sourceName, String localMetadataCollectionId, String instanceParameterName, InstanceHeader instance, String methodName) Validates that an instance has the correct header for it to be a reference copy.void
validateReferenceInstanceHeader
(String sourceName, String localMetadataCollectionId, String instanceParameterName, InstanceHeader instance, AuditLog auditLog, String methodName) Validates that an instance has the correct header for it to be a reference copy.void
validateRelationshipCanBeRehomed
(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) Verify that a relationship instance can be rehomed by the metadataCollection.void
validateRelationshipCanBeUpdated
(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) Verify that a relationship instance can be updated by the metadataCollection.void
validateRelationshipEnds
(String sourceName, EntityProxy entityOneProxy, EntityProxy entityTwoProxy, TypeDef typeDef, String methodName) Validate that the types of the two ends of a relationship match the relationship's TypeDef.void
validateRelationshipFromStore
(String sourceName, String guid, Relationship relationship, String methodName) Verify that a relationship has been successfully retrieved from the repository and has valid contents.void
validateRelationshipIsDeleted
(String sourceName, InstanceHeader instance, String methodName) Verify the status of a relationship to check it has been deleted.void
validateRelationshipIsNotDeleted
(String sourceName, InstanceHeader instance, String methodName) Verify the status of a relationship to check it has been deleted.void
validateSearchClassifications
(String sourceName, String parameterName, SearchClassifications matchClassifications, String methodName) Validate the classification-based search conditions.void
validateSearchCriteria
(String sourceName, String parameterName, String searchCriteria, String methodName) Validate that a search criteria is not null.void
validateSearchProperties
(String sourceName, String parameterName, SearchProperties matchProperties, String methodName) Validate the property-based search conditions.void
validateTypeDef
(String sourceName, String parameterName, TypeDef typeDef, String methodName) Validate the content of a new TypeDef is valid.void
validateTypeDefCategory
(String sourceName, String nameParameterName, TypeDefCategory category, String methodName) Validate that a TypeDef's category is not null.void
validateTypeDefForInstance
(String sourceName, String parameterName, TypeDef typeDef, String methodName) Validate the content of a TypeDef associated with a metadata instance.void
validateTypeDefGallery
(String sourceName, String parameterName, TypeDefGallery gallery, String methodName) Validate that type's name is not null.void
validateTypeDefIds
(String sourceName, String guidParameterName, String nameParameterName, String guid, String name, String methodName) Validate that a TypeDef's identifiers are not null.validateTypeDefPatch
(String sourceName, TypeDefPatch patch, String methodName) Verify that a TypeDefPatch is not null and is for a recognized type.void
validateTypeForInstanceDelete
(String sourceName, String typeDefGUID, String typeDefName, InstanceHeader instance, String methodName) Validate that the supplied TypeDef GUID and name matches the type associated with a metadata instance.void
validateTypeGUID
(String sourceName, String guidParameterName, String guid, String methodName) Validate that type's identifier is not null.void
validateTypeName
(String sourceName, String nameParameterName, String name, String methodName) Validate that type's name is not null.void
validateUnknownAttributeTypeDef
(String sourceName, String parameterName, AttributeTypeDef attributeTypeDef, String methodName) Validate the content of a new TypeDef is known.void
validateUnknownTypeDef
(String sourceName, String parameterName, TypeDef typeDef, String methodName) Validate the content of a new TypeDef is known.void
validateUserId
(String sourceName, String userId, String methodName) Validate that the supplied user id is not null.boolean
validAttributeTypeDef
(String sourceName, AttributeTypeDef attributeTypeDef) Return boolean indicating whether the supplied AttributeTypeDef is valid or not.boolean
validAttributeTypeDefId
(String sourceName, String attributeTypeDefGUID, String attributeTypeDefName, String attributeTypeDefVersion, AttributeTypeDefCategory category) Return boolean indicating whether the TypeDef identifiers are from a single known type or not.boolean
validAttributeTypeDefId
(String sourceName, String attributeTypeDefGUID, String attributeTypeDefName, AttributeTypeDefCategory category) Return boolean indicating whether the AttributeTypeDef identifiers are from a single known type or not.boolean
validEntity
(String sourceName, EntityDetail entity) Test that the supplied entity is valid.boolean
validEntity
(String sourceName, EntityProxy entity) Test that the supplied entity is valid.boolean
validEntity
(String sourceName, EntitySummary entity) Test that the supplied entity is valid.boolean
validInstanceId
(String sourceName, String typeDefGUID, String typeDefName, TypeDefCategory category, String instanceGUID) Verify that the identifiers for an instance are correct.boolean
validRelationship
(String sourceName, Relationship relationship) Test that the supplied relationship is valid.boolean
validTypeDef
(String sourceName, TypeDef typeDef) Return boolean indicating whether the supplied TypeDef is valid or not.boolean
validTypeDefId
(String sourceName, String typeDefGUID, String typeDefName, String typeDefVersion, TypeDefCategory category) Return boolean indicating whether the TypeDef identifiers are from a single known type or not.boolean
validTypeDefId
(String sourceName, String typeDefGUID, String typeDefName, TypeDefCategory category) Return boolean indicating whether the TypeDef identifiers are from a single known type or not.boolean
validTypeDefSummary
(String sourceName, TypeDefSummary typeDefSummary) Return boolean indicating whether the supplied TypeDefSummary is valid or not.boolean
validTypeId
(String sourceName, String typeGUID, String typeName) Return boolean indicating whether the TypeDef identifiers are from a single known type or not.boolean
verifyEntityIsClassified
(List<String> requiredClassifications, EntitySummary entity) Return a boolean indicating whether the supplied entity is classified with one or more of the supplied classifications.boolean
verifyInstanceHasRightStatus
(List<InstanceStatus> validStatuses, InstanceHeader instance) Verify that the supplied instance is in one of the supplied statuses.boolean
verifyInstancePropertiesMatchPropertyValue
(String sourceName, InstanceProperties properties, String searchPropertyValue, String methodName) Search for property values matching the supplied property valueboolean
verifyInstancePropertiesMatchSearchCriteria
(String sourceName, InstanceProperties properties, String searchCriteria, String methodName) Search for property values matching the search criteria (a regular expression)boolean
verifyInstanceType
(String sourceName, String instanceTypeGUID, List<String> subtypeGUIDs, InstanceHeader instance) Verify whether the instance passed to this method is of the type indicated by the type guid and restricted by the list of subtype guids.boolean
verifyInstanceType
(String sourceName, String instanceTypeGUID, InstanceHeader instance) Verify whether the instance passed to this method is of the type indicated by the type guid.boolean
verifyMatchingClassifications
(SearchClassifications matchClassifications, EntitySummary entity) Determine if the instance properties match the classification-based conditions.boolean
verifyMatchingInstancePropertyValues
(InstanceProperties matchProperties, InstanceAuditHeader instanceHeader, InstanceProperties instanceProperties, MatchCriteria matchCriteria) Determine if the instance properties match the match criteria.boolean
verifyMatchingInstancePropertyValues
(SearchProperties matchProperties, InstanceAuditHeader instanceHeader, InstanceProperties instanceProperties) Determine if the instance properties match the property-based conditions.
-
Constructor Details
-
OMRSRepositoryContentValidator
Typical constructor used by the OMRS to create a repository validator for a repository connector.- Parameters:
repositoryContentManager
- holds details of valid types and provides the implementation of the repository validator methods
-
-
Method Details
-
validateEnterpriseTypeDefs
public void validateEnterpriseTypeDefs(String sourceName, List<TypeDef> typeDefs, String methodName) throws RepositoryErrorException Return a boolean flag indicating whether the list of TypeDefs passed are compatible with the all known typedefs. A valid TypeDef is one that matches name, GUID and version to the full list of TypeDefs. If a new TypeDef is present, it is added to the enterprise list.- Specified by:
validateEnterpriseTypeDefs
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeDefs
- list of TypeDefs.methodName
- calling method- Throws:
RepositoryErrorException
- a conflicting or invalid TypeDef has been returned
-
validateEnterpriseAttributeTypeDefs
public void validateEnterpriseAttributeTypeDefs(String sourceName, List<AttributeTypeDef> attributeTypeDefs, String methodName) throws RepositoryErrorException Return a boolean flag indicating whether the list of TypeDefs passed are compatible with the all known typedefs. A valid TypeDef is one that matches name, GUID and version to the full list of TypeDefs. If a new TypeDef is present, it is added to the enterprise list.- Specified by:
validateEnterpriseAttributeTypeDefs
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)attributeTypeDefs
- list of AttributeTypeDefs.methodName
- calling method- Throws:
RepositoryErrorException
- a conflicting or invalid AttributeTypeDef has been returned
-
isActiveType
Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.- Specified by:
isActiveType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeGUID
- unique identifier of the typetypeName
- unique name of the type- Returns:
- boolean flag
-
isActiveTypeId
Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.- Specified by:
isActiveTypeId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeGUID
- unique identifier of the type- Returns:
- boolean flag
-
isOpenType
Return boolean indicating whether the TypeDef is one of the open metadata types.- Specified by:
isOpenType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeGUID
- unique identifier of the typetypeName
- unique name of the type- Returns:
- boolean flag
-
isOpenTypeId
Return boolean indicating whether the TypeDef is one of the open metadata types.- Specified by:
isOpenTypeId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeGUID
- unique identifier of the type- Returns:
- boolean flag
-
isKnownType
Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.- Specified by:
isKnownType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeGUID
- unique identifier of the typetypeName
- unique name of the type- Returns:
- boolean flag
-
isKnownTypeId
Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.- Specified by:
isKnownTypeId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeGUID
- unique identifier of the type- Returns:
- boolean flag
-
validTypeId
Return boolean indicating whether the TypeDef identifiers are from a single known type or not.- Specified by:
validTypeId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeGUID
- unique identifier of the TypeDeftypeName
- unique name of the TypeDef- Returns:
- boolean result
-
validTypeDefId
public boolean validTypeDefId(String sourceName, String typeDefGUID, String typeDefName, TypeDefCategory category) Return boolean indicating whether the TypeDef identifiers are from a single known type or not.- Specified by:
validTypeDefId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeDefGUID
- unique identifier of the TypeDeftypeDefName
- unique name of the TypeDefcategory
- category for the TypeDef- Returns:
- boolean result
-
validAttributeTypeDefId
public boolean validAttributeTypeDefId(String sourceName, String attributeTypeDefGUID, String attributeTypeDefName, AttributeTypeDefCategory category) Return boolean indicating whether the AttributeTypeDef identifiers are from a single known type or not.- Specified by:
validAttributeTypeDefId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)attributeTypeDefGUID
- unique identifier of the AttributeTypeDefattributeTypeDefName
- unique name of the AttributeTypeDefcategory
- category for the AttributeTypeDef- Returns:
- boolean result
-
validTypeDefId
public boolean validTypeDefId(String sourceName, String typeDefGUID, String typeDefName, String typeDefVersion, TypeDefCategory category) Return boolean indicating whether the TypeDef identifiers are from a single known type or not.- Specified by:
validTypeDefId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeDefGUID
- unique identifier of the TypeDeftypeDefName
- unique name of the TypeDeftypeDefVersion
- version of the typecategory
- category for the TypeDef- Returns:
- boolean result
-
validAttributeTypeDefId
public boolean validAttributeTypeDefId(String sourceName, String attributeTypeDefGUID, String attributeTypeDefName, String attributeTypeDefVersion, AttributeTypeDefCategory category) Return boolean indicating whether the TypeDef identifiers are from a single known type or not.- Specified by:
validAttributeTypeDefId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)attributeTypeDefGUID
- unique identifier of the TypeDefattributeTypeDefName
- unique name of the TypeDefattributeTypeDefVersion
- version of the typecategory
- category for the TypeDef- Returns:
- boolean result
-
validateActiveType
public void validateActiveType(String sourceName, String typeParameterName, TypeDefSummary typeDefSummary, TypeDefCategory category, String methodName) throws TypeErrorException, InvalidParameterException Validate that the supplied type is a valid active type.- Specified by:
validateActiveType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeParameterName
- the name of the parameter that passed the typetypeDefSummary
- the type to testcategory
- the expected category of the typemethodName
- the name of the method that supplied the type- Throws:
InvalidParameterException
- the type is null or contains invalid valuesTypeErrorException
- the type is not active
-
validTypeDef
Return boolean indicating whether the supplied TypeDef is valid or not.- Specified by:
validTypeDef
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the TypeDef (used for logging)typeDef
- TypeDef to test- Returns:
- boolean result
-
validAttributeTypeDef
Return boolean indicating whether the supplied AttributeTypeDef is valid or not.- Specified by:
validAttributeTypeDef
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)attributeTypeDef
- TypeDef to test- Returns:
- boolean result
-
validTypeDefSummary
Return boolean indicating whether the supplied TypeDefSummary is valid or not.- Specified by:
validTypeDefSummary
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeDefSummary
- TypeDefSummary to test.- Returns:
- boolean result.
-
validEntity
Test that the supplied entity is valid.- Specified by:
validEntity
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to test- Returns:
- boolean result
-
validEntity
Test that the supplied entity is valid.- Specified by:
validEntity
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to test- Returns:
- boolean result
-
validEntity
Test that the supplied entity is valid.- Specified by:
validEntity
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)entity
- entity to test- Returns:
- boolean result
-
validRelationship
Test that the supplied relationship is valid.- Specified by:
validRelationship
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)relationship
- relationship to test- Returns:
- boolean result
-
validInstanceId
public boolean validInstanceId(String sourceName, String typeDefGUID, String typeDefName, TypeDefCategory category, String instanceGUID) Verify that the identifiers for an instance are correct.- Specified by:
validInstanceId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeDefGUID
- unique identifier for the type.typeDefName
- unique name for the type.category
- expected category of the instance.instanceGUID
- unique identifier for the instance.- Returns:
- boolean indicating whether the identifiers are ok.
-
validateUserId
public void validateUserId(String sourceName, String userId, String methodName) throws InvalidParameterException Validate that the supplied user id is not null.- Specified by:
validateUserId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- name of source of request.userId
- userId passed on call to this metadata collection.methodName
- name of method requesting the validation.- Throws:
InvalidParameterException
- the userId is invalid
-
validateTypeDefIds
public void validateTypeDefIds(String sourceName, String guidParameterName, String nameParameterName, String guid, String name, String methodName) throws InvalidParameterException Validate that a TypeDef's identifiers are not null.- Specified by:
validateTypeDefIds
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of the parameter that passed the guid.nameParameterName
- name of the parameter that passed the name.guid
- unique identifier for a type or an instance passed on the requestname
- name of TypeDef.methodName
- method receiving the call- Throws:
InvalidParameterException
- no guid provided
-
getValidTypeDefFromIds
public TypeDef getValidTypeDefFromIds(String sourceName, String guidParameterName, String nameParameterName, String guid, String name, String methodName) throws InvalidParameterException Validate that a TypeDef's identifiers are not null and return the type.- Specified by:
getValidTypeDefFromIds
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of the parameter that passed the guid.nameParameterName
- name of the parameter that passed the name.guid
- unique identifier for a type or an instance passed on the requestname
- name of TypeDef.methodName
- method receiving the call- Returns:
- typeDef
- Throws:
InvalidParameterException
- no guid provided
-
validateAttributeTypeDefIds
public void validateAttributeTypeDefIds(String sourceName, String guidParameterName, String nameParameterName, String guid, String name, String methodName) throws InvalidParameterException Validate that an AttributeTypeDef's identifiers are not null and are recognized.- Specified by:
validateAttributeTypeDefIds
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of the parameter that passed the guid.nameParameterName
- name of the parameter that passed the name.guid
- unique identifier for a type or an instance passed on the requestname
- name of TypeDef.methodName
- method receiving the call- Throws:
InvalidParameterException
- no guid, or name provided
-
getValidAttributeTypeDefFromIds
public AttributeTypeDef getValidAttributeTypeDefFromIds(String sourceName, String guidParameterName, String nameParameterName, String guid, String name, String methodName) throws InvalidParameterException Validate that an AttributeTypeDef's identifiers are not null and are recognized.- Specified by:
getValidAttributeTypeDefFromIds
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of the parameter that passed the guid.nameParameterName
- name of the parameter that passed the name.guid
- unique identifier for a type or an instance passed on the requestname
- name of TypeDef.methodName
- method receiving the call- Returns:
- retrieved type definition
- Throws:
InvalidParameterException
- no guid, or name provided
-
validateTypeGUID
public void validateTypeGUID(String sourceName, String guidParameterName, String guid, String methodName) throws InvalidParameterException, TypeErrorException Validate that type's identifier is not null.- Specified by:
validateTypeGUID
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of the parameter that passed the guid.guid
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
InvalidParameterException
- no guid providedTypeErrorException
- guid is not for a recognized type
-
validateOptionalTypeGUID
public void validateOptionalTypeGUID(String sourceName, String guidParameterName, String guid, String methodName) throws TypeErrorException Validate that type's identifier is not null.- Specified by:
validateOptionalTypeGUID
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of the parameter that passed the guid.guid
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
TypeErrorException
- unknown type guid
-
validateOptionalTypeGUIDs
public void validateOptionalTypeGUIDs(String sourceName, String guidParameterName, String guid, String subtypeParameterName, List<String> subtypeGuids, String methodName) throws TypeErrorException Validate that the types and subtypes (if specified) fit each other.- Specified by:
validateOptionalTypeGUIDs
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of the parameter that passed the guidguid
- unique identifier for a type passed on the requestsubtypeParameterName
- name of the parameter that passed a list of subtype guidssubtypeGuids
- list of unique identifiers for the subtypes passed on the requestmethodName
- method receiving the call- Throws:
TypeErrorException
- unknown type guid, or subtype guids that are not subtypes of the provided guid
-
validateTypeDefPatch
public TypeDef validateTypeDefPatch(String sourceName, TypeDefPatch patch, String methodName) throws InvalidParameterException, TypeDefNotKnownException, PatchErrorException Verify that a TypeDefPatch is not null and is for a recognized type.- Specified by:
validateTypeDefPatch
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)patch
- patch to testmethodName
- calling method- Returns:
- current value of the type
- Throws:
InvalidParameterException
- the patch is nullTypeDefNotKnownException
- the type is not knownPatchErrorException
- the patch is invalid
-
validateInstanceTypeGUID
public void validateInstanceTypeGUID(String sourceName, String guidParameterName, String guid, String methodName) throws TypeErrorException Validate that if a type's identifier is passed then it is valid.- Specified by:
validateInstanceTypeGUID
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of the parameter that passed the guid.guid
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
TypeErrorException
- invalid provided
-
validateTypeName
public void validateTypeName(String sourceName, String nameParameterName, String name, String methodName) throws InvalidParameterException Validate that type's name is not null.- Specified by:
validateTypeName
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)nameParameterName
- name of the parameter that passed the name.name
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
InvalidParameterException
- no name provided
-
validateTypeDefCategory
public void validateTypeDefCategory(String sourceName, String nameParameterName, TypeDefCategory category, String methodName) throws InvalidParameterException Validate that a TypeDef's category is not null.- Specified by:
validateTypeDefCategory
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)nameParameterName
- name of the parameter that passed the name.category
- category of TypeDefmethodName
- method receiving the call- Throws:
InvalidParameterException
- no name provided
-
validateAttributeTypeDefCategory
public void validateAttributeTypeDefCategory(String sourceName, String nameParameterName, AttributeTypeDefCategory category, String methodName) throws InvalidParameterException Validate that a AttributeTypeDef's category is not null.- Specified by:
validateAttributeTypeDefCategory
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)nameParameterName
- name of the parameter that passed the name.category
- category of TypeDefmethodName
- method receiving the call- Throws:
InvalidParameterException
- no name provided
-
validateTypeDef
public void validateTypeDef(String sourceName, String parameterName, TypeDef typeDef, String methodName) throws InvalidParameterException, InvalidTypeDefException Validate the content of a new TypeDef is valid.- Specified by:
validateTypeDef
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the typeDef.typeDef
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
InvalidParameterException
- no typeDef providedInvalidTypeDefException
- invalid typeDef provided
-
validateKnownTypeDef
public void validateKnownTypeDef(String sourceName, String parameterName, TypeDef typeDef, String methodName) throws TypeDefNotKnownException Validate the content of a new TypeDef is known.- Specified by:
validateKnownTypeDef
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the typeDef.typeDef
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
TypeDefNotKnownException
- typeDef provided not recognized
-
validateUnknownTypeDef
public void validateUnknownTypeDef(String sourceName, String parameterName, TypeDef typeDef, String methodName) throws TypeDefKnownException, TypeDefConflictException Validate the content of a new TypeDef is known.- Specified by:
validateUnknownTypeDef
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the typeDef.typeDef
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
TypeDefKnownException
- the TypeDef is already definedTypeDefConflictException
- the TypeDef is already defined but differently
-
validateUnknownAttributeTypeDef
public void validateUnknownAttributeTypeDef(String sourceName, String parameterName, AttributeTypeDef attributeTypeDef, String methodName) throws TypeDefKnownException, TypeDefConflictException Validate the content of a new TypeDef is known.- Specified by:
validateUnknownAttributeTypeDef
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the typeDef.attributeTypeDef
- unique identifier for an attribute type or an instance passed on the requestmethodName
- method receiving the call- Throws:
TypeDefKnownException
- the TypeDef is already definedTypeDefConflictException
- the TypeDef is already defined but differently
-
validateTypeDefForInstance
public void validateTypeDefForInstance(String sourceName, String parameterName, TypeDef typeDef, String methodName) throws TypeErrorException, RepositoryErrorException Validate the content of a TypeDef associated with a metadata instance.- Specified by:
validateTypeDefForInstance
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the typeDef.typeDef
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
TypeErrorException
- no typeDef providedRepositoryErrorException
- the TypeDef from the repository is in error.
-
validateTypeForInstanceDelete
public void validateTypeForInstanceDelete(String sourceName, String typeDefGUID, String typeDefName, InstanceHeader instance, String methodName) throws InvalidParameterException, RepositoryErrorException Validate that the supplied TypeDef GUID and name matches the type associated with a metadata instance.- Specified by:
validateTypeForInstanceDelete
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)typeDefGUID
- the supplied typeDef GUID.typeDefName
- the supplied typeDef name.instance
- instance retrieved from the store with the supplied instance guidmethodName
- method making this call- Throws:
InvalidParameterException
- incompatibility detected between the TypeDef and the instance's typeRepositoryErrorException
- the instance from the repository is in error.
-
validateAttributeTypeDef
public void validateAttributeTypeDef(String sourceName, String parameterName, AttributeTypeDef attributeTypeDef, String methodName) throws InvalidParameterException, InvalidTypeDefException Validate the content of a new AttributeTypeDef.- Specified by:
validateAttributeTypeDef
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the attributeTypeDef.attributeTypeDef
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
InvalidParameterException
- no attributeTypeDef providedInvalidTypeDefException
- bad attributeTypeDef provided
-
validateTypeDefGallery
public void validateTypeDefGallery(String sourceName, String parameterName, TypeDefGallery gallery, String methodName) throws InvalidParameterException Validate that type's name is not null.- Specified by:
validateTypeDefGallery
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the name.gallery
- typeDef gallerymethodName
- method receiving the call- Throws:
InvalidParameterException
- no name provided
-
validateExternalId
public void validateExternalId(String sourceName, String standard, String organization, String identifier, String methodName) throws InvalidParameterException Validate that the type's name is not null.- Specified by:
validateExternalId
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)standard
- name of the standard, null means any.organization
- name of the organization, null means any.identifier
- identifier of the element in the standard, null means any.methodName
- method receiving the call- Throws:
InvalidParameterException
- no name provided
-
validateGUID
public void validateGUID(String sourceName, String guidParameterName, String guid, String methodName) throws InvalidParameterException Validate that an entity's identifier is not null.- Specified by:
validateGUID
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of the parameter that passed the guid.guid
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
InvalidParameterException
- no guid provided
-
validateHomeMetadataGUID
public void validateHomeMetadataGUID(String sourceName, String guidParameterName, String guid, String methodName) throws InvalidParameterException Validate that a home metadata collection identifier is not null.- Specified by:
validateHomeMetadataGUID
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guidParameterName
- name of the parameter that passed the guid.guid
- unique identifier for a type or an instance passed on the requestmethodName
- method receiving the call- Throws:
InvalidParameterException
- no guid provided
-
validateHomeMetadataGUID
public void validateHomeMetadataGUID(String sourceName, Classification classification, String methodName) throws RepositoryErrorException Validate that a home metadata collection identifier in a classification is not null.- Specified by:
validateHomeMetadataGUID
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)classification
- classification to test.methodName
- method receiving the call- Throws:
RepositoryErrorException
- no guid provided
-
validateHomeMetadataGUID
public void validateHomeMetadataGUID(String sourceName, InstanceHeader instance, String methodName) throws RepositoryErrorException Validate that a home metadata collection identifier in an instance is not null.- Specified by:
validateHomeMetadataGUID
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instance
- instance to test.methodName
- method receiving the call- Throws:
RepositoryErrorException
- no guid provided
-
validateAsOfTime
public void validateAsOfTime(String sourceName, String parameterName, Date asOfTime, String methodName) throws InvalidParameterException Validate that the asOfTime parameter is not for the future.- Specified by:
validateAsOfTime
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the guid.asOfTime
- unique name for a classification typemethodName
- method receiving the call- Throws:
InvalidParameterException
- asOfTime is for the future
-
validateAsOfTimeNotNull
public void validateAsOfTimeNotNull(String sourceName, String parameterName, Date asOfTime, String methodName) throws InvalidParameterException Validate that the asOfTime parameter is not null or for the future.- Specified by:
validateAsOfTimeNotNull
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the guid.asOfTime
- unique name for a classification typemethodName
- method receiving the call- Throws:
InvalidParameterException
- asOfTime is for the future
-
validateDateRange
public void validateDateRange(String sourceName, String parameterName, Date fromTime, Date toTime, String methodName) throws InvalidParameterException Validate that the time parameters are not inverted ('from' later than 'to').- Specified by:
validateDateRange
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the guid.fromTime
- the earliest point in time from which to retrieve historical versions of the instance (inclusive)toTime
- the latest point in time from which to retrieve historical versions of the instance (exclusive)methodName
- method receiving the call- Throws:
InvalidParameterException
- 'fromTime' is later than 'toTime', or either is some point in the future
-
validatePageSize
public void validatePageSize(String sourceName, String parameterName, int pageSize, String methodName) throws PagingErrorException Validate that a page size parameter is not negative.- Specified by:
validatePageSize
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the guid.pageSize
- number of elements to return on a requestmethodName
- method receiving the call- Throws:
PagingErrorException
- pageSize is negative
-
validateClassificationName
public TypeDef validateClassificationName(String sourceName, String parameterName, String classificationName, String methodName) throws InvalidParameterException Validate that a classification name is not null.- Specified by:
validateClassificationName
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the guid.classificationName
- unique name for a classification typemethodName
- method receiving the call- Returns:
- type definition for the classification
- Throws:
InvalidParameterException
- classification name is null or invalid
-
validateClassificationProperties
public void validateClassificationProperties(String sourceName, String classificationName, String propertiesParameterName, InstanceProperties classificationProperties, String methodName) throws PropertyErrorException Validate that a classification is valid for the entity.- Specified by:
validateClassificationProperties
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)classificationName
- unique name for a classification typepropertiesParameterName
- name of the parameter that passed the properties.classificationProperties
- properties to testmethodName
- method receiving the call- Throws:
PropertyErrorException
- classification name is null
-
validateClassification
public void validateClassification(String sourceName, String classificationParameterName, String classificationName, String entityTypeName, String methodName) throws InvalidParameterException, ClassificationErrorException Validate that a classification is valid for the entity.- Specified by:
validateClassification
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)classificationParameterName
- name of the parameter that passed the guid.classificationName
- unique name for a classification typeentityTypeName
- name of entity typemethodName
- method receiving the call- Throws:
InvalidParameterException
- classification name is nullClassificationErrorException
- the classification is invalid for this entity
-
validateClassificationList
public void validateClassificationList(String sourceName, String parameterName, List<Classification> classifications, String entityTypeName, String methodName) throws InvalidParameterException, ClassificationErrorException, PropertyErrorException, TypeErrorException Validate that a classification is valid for the entity.- Specified by:
validateClassificationList
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the guid.classifications
- list of classificationsentityTypeName
- name of entity typemethodName
- method receiving the call- Throws:
InvalidParameterException
- classification name is nullClassificationErrorException
- the classification is invalid for this entityPropertyErrorException
- the classification's properties are invalid for its typeTypeErrorException
- the classification's type is invalid
-
validateMatchCriteria
public void validateMatchCriteria(String sourceName, String parameterName, TypeDefProperties matchCriteria, String methodName) throws InvalidParameterException Validate that a TypeDef match criteria set of properties is not null.- Specified by:
validateMatchCriteria
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the match criteria.matchCriteria
- match criteria propertiesmethodName
- method receiving the call- Throws:
InvalidParameterException
- no guid provided
-
validateMatchCriteria
public void validateMatchCriteria(String sourceName, String matchCriteriaParameterName, String matchPropertiesParameterName, MatchCriteria matchCriteria, InstanceProperties matchProperties, String methodName) throws InvalidParameterException Validate that a metadata instance match criteria and set of properties are either both null or both not null.- Specified by:
validateMatchCriteria
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)matchCriteriaParameterName
- name of the parameter that passed the match criteria.matchPropertiesParameterName
- name of the parameter that passed the match criteria.matchCriteria
- match criteria enummatchProperties
- match propertiesmethodName
- method receiving the call- Throws:
InvalidParameterException
- no guid provided
-
validateSearchCriteria
public void validateSearchCriteria(String sourceName, String parameterName, String searchCriteria, String methodName) throws InvalidParameterException Validate that a search criteria is not null.- Specified by:
validateSearchCriteria
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the search criteria.searchCriteria
- match criteria propertiesmethodName
- method receiving the call- Throws:
InvalidParameterException
- no guid provided
-
validateSearchProperties
public void validateSearchProperties(String sourceName, String parameterName, SearchProperties matchProperties, String methodName) throws InvalidParameterException Validate the property-based search conditions.- Specified by:
validateSearchProperties
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the property-based conditionsmatchProperties
- property-based conditionsmethodName
- method receiving the call- Throws:
InvalidParameterException
- property-based conditions are invalid
-
validateSearchClassifications
public void validateSearchClassifications(String sourceName, String parameterName, SearchClassifications matchClassifications, String methodName) throws InvalidParameterException Validate the classification-based search conditions.- Specified by:
validateSearchClassifications
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the parameter that passed the classification-based conditionsmatchClassifications
- classification-based conditionsmethodName
- method receiving the call- Throws:
InvalidParameterException
- classification-based conditions are invalid
-
validatePropertiesForType
public void validatePropertiesForType(String sourceName, String parameterName, TypeDef typeDef, InstanceProperties properties, String methodName) throws PropertyErrorException Validate that the properties for a metadata instance match its TypeDef.- Specified by:
validatePropertiesForType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the "properties" parameter.typeDef
- type information to validate against.properties
- proposed properties for instance.methodName
- method receiving the call.- Throws:
PropertyErrorException
- invalid property
-
validatePropertiesForType
public void validatePropertiesForType(String sourceName, String parameterName, TypeDefSummary typeDefSummary, InstanceProperties properties, String methodName) throws PropertyErrorException, TypeErrorException Validate that the properties for a metadata instance match its TypeDef- Specified by:
validatePropertiesForType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the "properties" parameter.typeDefSummary
- type information to validate against.properties
- proposed propertiesmethodName
- method receiving the call- Throws:
TypeErrorException
- no typeDef providedPropertyErrorException
- invalid property
-
validateNewPropertiesForType
public void validateNewPropertiesForType(String sourceName, String parameterName, TypeDef typeDef, InstanceProperties properties, String methodName) throws PropertyErrorException Validate that the properties for a metadata instance match its TypeDef- Specified by:
validateNewPropertiesForType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)parameterName
- name of the "properties" parameter.typeDef
- type information to validate against.properties
- proposed propertiesmethodName
- method receiving the call- Throws:
PropertyErrorException
- invalid property
-
verifyInstanceType
public boolean verifyInstanceType(String sourceName, String instanceTypeGUID, InstanceHeader instance) Verify whether the instance passed to this method is of the type indicated by the type guid. A null type guid matches all instances (ie result is true). A null instance returns false.- Specified by:
verifyInstanceType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- name of the caller.instanceTypeGUID
- unique identifier of the type (or null).instance
- instance to test.- Returns:
- boolean
-
verifyInstanceType
public boolean verifyInstanceType(String sourceName, String instanceTypeGUID, List<String> subtypeGUIDs, InstanceHeader instance) Verify whether the instance passed to this method is of the type indicated by the type guid and restricted by the list of subtype guids. A null type guid matches all instances (ie result is true). A null instance returns false.- Specified by:
verifyInstanceType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- name of caller.instanceTypeGUID
- unique identifier of the type (or null).subtypeGUIDs
- list of unique identifiers of the subtypes to include (or null).instance
- instance to test.- Returns:
- boolean
-
validateEntityFromStore
public void validateEntityFromStore(String sourceName, String guid, EntitySummary entity, String methodName) throws RepositoryErrorException, EntityNotKnownException Verify that an entity has been successfully retrieved from the repository and has valid contents.- Specified by:
validateEntityFromStore
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guid
- unique identifier used to retrieve the entityentity
- the retrieved entity (or null)methodName
- method receiving the call- Throws:
EntityNotKnownException
- No entity foundRepositoryErrorException
- logic error in the repository corrupted instance
-
validateEntityFromStore
public void validateEntityFromStore(String sourceName, String guid, EntityDetail entity, String methodName) throws RepositoryErrorException, EntityNotKnownException Verify that an entity has been successfully retrieved from the repository and has valid contents.- Specified by:
validateEntityFromStore
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guid
- unique identifier used to retrieve the entityentity
- the retrieved entity (or null)methodName
- method receiving the call- Throws:
EntityNotKnownException
- No entity foundRepositoryErrorException
- logic error in the repository corrupted instance
-
validateRelationshipFromStore
public void validateRelationshipFromStore(String sourceName, String guid, Relationship relationship, String methodName) throws RepositoryErrorException, RelationshipNotKnownException Verify that a relationship has been successfully retrieved from the repository and has valid contents.- Specified by:
validateRelationshipFromStore
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)guid
- unique identifier used to retrieve the entityrelationship
- the retrieved relationship (or null)methodName
- method receiving the call- Throws:
RelationshipNotKnownException
- No relationship foundRepositoryErrorException
- logic error in the repository corrupted instance
-
validateInstanceType
public void validateInstanceType(String sourceName, InstanceHeader instance) throws RepositoryErrorException Verify that the instance retrieved from the repository has a valid instance type.- Specified by:
validateInstanceType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instance
- the retrieved instance- Throws:
RepositoryErrorException
- logic error in the repository corrupted instance
-
validateInstanceType
public void validateInstanceType(String sourceName, InstanceHeader instance, String typeGUIDParameterName, String typeNameParameterName, String expectedTypeGUID, String expectedTypeName) throws RepositoryErrorException, TypeErrorException, InvalidParameterException Verify that the instance retrieved from the repository has a valid instance type that matches the expected type.- Specified by:
validateInstanceType
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instance
- the retrieved instancetypeGUIDParameterName
- name of parameter for TypeDefGUIDtypeNameParameterName
- name of parameter for TypeDefNameexpectedTypeGUID
- expected GUID of InstanceTypeexpectedTypeName
- expected name of InstanceType- Throws:
RepositoryErrorException
- logic error in the repository corrupted instanceTypeErrorException
- problem with typeInvalidParameterException
- invalid parameter
-
verifyInstanceHasRightStatus
public boolean verifyInstanceHasRightStatus(List<InstanceStatus> validStatuses, InstanceHeader instance) Verify that the supplied instance is in one of the supplied statuses. Note that if the supplied statuses are null, then only statuses that are not DELETE are considered valid.- Specified by:
verifyInstanceHasRightStatus
in interfaceOMRSRepositoryValidator
- Parameters:
validStatuses
- list of statuses the instance should be in any one of theminstance
- instance to test- Returns:
- boolean result
-
validateInstanceStatus
public void validateInstanceStatus(String sourceName, String instanceStatusParameterName, InstanceStatus instanceStatus, TypeDef typeDef, String methodName) throws StatusNotSupportedException Validates an instance status where null is permissible.- Specified by:
validateInstanceStatus
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instanceStatusParameterName
- name of the initial status parameterinstanceStatus
- initial status valuetypeDef
- type of the instancemethodName
- method called- Throws:
StatusNotSupportedException
- the initial status is invalid for this type
-
validateNewStatus
public void validateNewStatus(String sourceName, String instanceStatusParameterName, InstanceStatus instanceStatus, TypeDef typeDef, String methodName) throws StatusNotSupportedException, InvalidParameterException Validates an instance status where null is not allowed.- Specified by:
validateNewStatus
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instanceStatusParameterName
- name of the initial status parameterinstanceStatus
- initial status valuetypeDef
- type of the instancemethodName
- method called- Throws:
StatusNotSupportedException
- the initial status is invalid for this typeInvalidParameterException
- invalid parameter
-
validateInstanceStatusForDelete
public void validateInstanceStatusForDelete(String sourceName, InstanceHeader instance, String methodName) throws InvalidParameterException Verify that an instance is not already deleted since the repository is processing a delete request, and it does not want to look stupid.- Specified by:
validateInstanceStatusForDelete
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instance
- instance about to be deletedmethodName
- name of method called- Throws:
InvalidParameterException
- the instance is already deleted
-
validateEntityIsNotDeleted
public void validateEntityIsNotDeleted(String sourceName, InstanceHeader instance, String methodName) throws EntityNotKnownException Verify the status of an entity to check if it has been deleted.- Specified by:
validateEntityIsNotDeleted
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instance
- instance to validatemethodName
- name of calling method- Throws:
EntityNotKnownException
- the entity is in deleted status
-
validateEntityIsDeleted
public void validateEntityIsDeleted(String sourceName, InstanceHeader instance, String methodName) throws EntityNotDeletedException Verify the status of an entity to check it has been deleted. This method is used during a purge operation to ensure delete() has been called before purge.- Specified by:
validateEntityIsDeleted
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instance
- instance to validatemethodName
- name of calling method- Throws:
EntityNotDeletedException
- the entity is not in deleted status
-
validateEntityCanBeUpdated
public void validateEntityCanBeUpdated(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) throws InvalidParameterException Verify that an entity instance can be updated by the metadataCollection. This method is used when the metadataCollection is called to update the status properties or classification of an entity instance.- Specified by:
validateEntityCanBeUpdated
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the metadata collectioninstance
- instance to validatemethodName
- name of calling method- Throws:
InvalidParameterException
- the entity is in deleted status
-
validateEntityCanBeRehomed
public void validateEntityCanBeRehomed(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) throws InvalidParameterException Verify that an entity instance can be rehomed by the metadataCollection. This method is used when the metadataCollection is called to rehome an entity instance.- Specified by:
validateEntityCanBeRehomed
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the metadata collectioninstance
- instance to validatemethodName
- name of calling method- Throws:
InvalidParameterException
- the entity is in deleted status
-
validateRelationshipIsNotDeleted
public void validateRelationshipIsNotDeleted(String sourceName, InstanceHeader instance, String methodName) throws RelationshipNotKnownException Verify the status of a relationship to check it has been deleted.- Specified by:
validateRelationshipIsNotDeleted
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instance
- instance to testmethodName
- name of calling method- Throws:
RelationshipNotKnownException
- the relationship is in deleted status
-
validateRelationshipIsDeleted
public void validateRelationshipIsDeleted(String sourceName, InstanceHeader instance, String methodName) throws RelationshipNotDeletedException Verify the status of a relationship to check it has been deleted.- Specified by:
validateRelationshipIsDeleted
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instance
- instance to testmethodName
- name of calling method- Throws:
RelationshipNotDeletedException
- the relationship is not in deleted status
-
validateRelationshipCanBeUpdated
public void validateRelationshipCanBeUpdated(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) throws InvalidParameterException Verify that a relationship instance can be updated by the metadataCollection. This method is used when the metadataCollection is called to update the status or properties of a relationship instance.- Specified by:
validateRelationshipCanBeUpdated
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the metadata collectioninstance
- instance to validatemethodName
- name of calling method- Throws:
InvalidParameterException
- the entity is in deleted status
-
validateRelationshipCanBeRehomed
public void validateRelationshipCanBeRehomed(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) throws InvalidParameterException Verify that a relationship instance can be rehomed by the metadataCollection. This method is used when the metadataCollection is called to rehome a relationship instance.- Specified by:
validateRelationshipCanBeRehomed
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)metadataCollectionId
- unique identifier for the metadata collectioninstance
- instance to validatemethodName
- name of calling method- Throws:
InvalidParameterException
- the entity is in deleted status
-
validateRelationshipEnds
public void validateRelationshipEnds(String sourceName, EntityProxy entityOneProxy, EntityProxy entityTwoProxy, TypeDef typeDef, String methodName) throws InvalidParameterException Validate that the types of the two ends of a relationship match the relationship's TypeDef.- Specified by:
validateRelationshipEnds
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)entityOneProxy
- content of end oneentityTwoProxy
- content of end twotypeDef
- typeDef for the relationshipmethodName
- name of the method making the request- Throws:
InvalidParameterException
- types do not align
-
verifyEntityIsClassified
Return a boolean indicating whether the supplied entity is classified with one or more of the supplied classifications.- Specified by:
verifyEntityIsClassified
in interfaceOMRSRepositoryValidator
- Parameters:
requiredClassifications
- list of required classification null means that there are no specific classification requirements and so results in a true response.entity
- entity to test.- Returns:
- boolean result
-
getStringValuesFromInstancePropertiesAsArray
Return the string form of the instance properties. Can be used as propertyValue on find property value calls.- Specified by:
getStringValuesFromInstancePropertiesAsArray
in interfaceOMRSRepositoryValidator
- Parameters:
instanceProperties
- value to extract the string from- Returns:
- extracted string value.
-
getStringValuesFromInstancePropertiesAsMap
Return the string form of the instance properties. Can be used as propertyValue on find property value calls.- Specified by:
getStringValuesFromInstancePropertiesAsMap
in interfaceOMRSRepositoryValidator
- Parameters:
instanceProperties
- value to extract the string from- Returns:
- extracted string value.
-
getStringValuesFromInstancePropertiesAsStruct
Return the string form of the instance properties. Can be used as propertyValue on find property value calls.- Specified by:
getStringValuesFromInstancePropertiesAsStruct
in interfaceOMRSRepositoryValidator
- Parameters:
instanceProperties
- value to extract the string from- Returns:
- extracted string value.
-
getStringFromPropertyValue
Return the string form of a property value. Can be used as propertyValue on find property value calls.- Specified by:
getStringFromPropertyValue
in interfaceOMRSRepositoryValidator
- Parameters:
instancePropertyValue
- value to extract the string from- Returns:
- extracted string value.
-
countMatchingPropertyValues
public int countMatchingPropertyValues(InstanceProperties matchProperties, InstanceProperties instanceProperties) throws InvalidParameterException Count the number of matching property values that an instance has. They may come from an entity, classification or relationship.- Specified by:
countMatchingPropertyValues
in interfaceOMRSRepositoryValidator
- Parameters:
matchProperties
- the properties to match.instanceProperties
- the properties from the instance.- Returns:
- integer count of the matching properties.
- Throws:
InvalidParameterException
- invalid search criteria
-
countMatchingHeaderPropertyValues
public int countMatchingHeaderPropertyValues(InstanceProperties matchProperties, InstanceAuditHeader instanceHeader, InstanceProperties instanceProperties) Count the number of matching property values that an instance has. They may come from an entity, or relationship.- Specified by:
countMatchingHeaderPropertyValues
in interfaceOMRSRepositoryValidator
- Parameters:
matchProperties
- the properties to match.instanceHeader
- the header properties from the instance.instanceProperties
- the effectivity dates.- Returns:
- integer count of the matching properties.
-
verifyMatchingInstancePropertyValues
public boolean verifyMatchingInstancePropertyValues(InstanceProperties matchProperties, InstanceAuditHeader instanceHeader, InstanceProperties instanceProperties, MatchCriteria matchCriteria) throws InvalidParameterException Determine if the instance properties match the match criteria.- Specified by:
verifyMatchingInstancePropertyValues
in interfaceOMRSRepositoryValidator
- Parameters:
matchProperties
- the properties to match.instanceHeader
- the header of the instance.instanceProperties
- the properties from the instance.matchCriteria
- rule on how the match should occur.- Returns:
- boolean flag indicating whether the two sets of properties match
- Throws:
InvalidParameterException
- invalid search criteria
-
getNumericRepresentation
Retrieve a numeric representation of the provided value, or null if it cannot be converted to a number.- Specified by:
getNumericRepresentation
in interfaceOMRSRepositoryValidator
- Parameters:
value
- to convert- Returns:
- BigDecimal
-
verifyMatchingInstancePropertyValues
public boolean verifyMatchingInstancePropertyValues(SearchProperties matchProperties, InstanceAuditHeader instanceHeader, InstanceProperties instanceProperties) throws InvalidParameterException Determine if the instance properties match the property-based conditions.- Specified by:
verifyMatchingInstancePropertyValues
in interfaceOMRSRepositoryValidator
- Parameters:
matchProperties
- the property-based conditions to match.instanceHeader
- the header of the instance.instanceProperties
- the properties from the instance.- Returns:
- boolean flag indicating whether the two sets of properties match
- Throws:
InvalidParameterException
- invalid search criteria
-
verifyMatchingClassifications
public boolean verifyMatchingClassifications(SearchClassifications matchClassifications, EntitySummary entity) throws InvalidParameterException Determine if the instance properties match the classification-based conditions.- Specified by:
verifyMatchingClassifications
in interfaceOMRSRepositoryValidator
- Parameters:
matchClassifications
- the classification-based conditions to match.entity
- the entity instance.- Returns:
- boolean flag indicating whether the classifications match
- Throws:
InvalidParameterException
- invalid search criteria
-
validateReferenceInstanceHeader
public void validateReferenceInstanceHeader(String sourceName, String localMetadataCollectionId, String instanceParameterName, InstanceHeader instance, String methodName) throws InvalidParameterException, RepositoryErrorException Validates that an instance has the correct header for it to be a reference copy.- Specified by:
validateReferenceInstanceHeader
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)localMetadataCollectionId
- the unique identifier for the local repository' metadata collection.instanceParameterName
- the name of the parameter that provided the instance.instance
- the instance to testmethodName
- the name of the method that supplied the instance.- Throws:
RepositoryErrorException
- problem with repositoryInvalidParameterException
- the instance is null or linked to local metadata repository
-
validateReferenceInstanceHeader
public void validateReferenceInstanceHeader(String sourceName, String localMetadataCollectionId, String instanceParameterName, InstanceHeader instance, AuditLog auditLog, String methodName) throws InvalidParameterException, RepositoryErrorException Validates that an instance has the correct header for it to be a reference copy.- Specified by:
validateReferenceInstanceHeader
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)localMetadataCollectionId
- the unique identifier for the local repository' metadata collection.instanceParameterName
- the name of the parameter that provided the instance.instance
- the instance to testauditLog
- optional logging destinationmethodName
- the name of the method that supplied the instance.- Throws:
RepositoryErrorException
- problem with repositoryInvalidParameterException
- the instance is null or linked to local metadata repository
-
validateEntityProxy
public void validateEntityProxy(String sourceName, String localMetadataCollectionId, String proxyParameterName, EntityProxy entityProxy, String methodName) throws InvalidParameterException Validates an entity proxy. It must be a reference copy (ie owned by a different repository).- Specified by:
validateEntityProxy
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)localMetadataCollectionId
- unique identifier for this repository's metadata collectionproxyParameterName
- name of the parameter used to provide the parameterentityProxy
- proxy to addmethodName
- name of the method that adds the proxy- Throws:
InvalidParameterException
- the entity proxy is null or for an entity homed in this repository
-
verifyInstancePropertiesMatchSearchCriteria
public boolean verifyInstancePropertiesMatchSearchCriteria(String sourceName, InstanceProperties properties, String searchCriteria, String methodName) throws RepositoryErrorException Search for property values matching the search criteria (a regular expression)- Specified by:
verifyInstancePropertiesMatchSearchCriteria
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)properties
- list of properties associated with the in instancesearchCriteria
- regular expression for testing the property valuesmethodName
- name of the method requiring the search.- Returns:
- boolean indicating whether the search criteria is located in any of the string parameter values.
- Throws:
RepositoryErrorException
- the properties are not properly set up in the instance
-
verifyInstancePropertiesMatchPropertyValue
public boolean verifyInstancePropertiesMatchPropertyValue(String sourceName, InstanceProperties properties, String searchPropertyValue, String methodName) throws RepositoryErrorException Search for property values matching the supplied property value- Specified by:
verifyInstancePropertiesMatchPropertyValue
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)properties
- list of properties associated with the in instancesearchPropertyValue
- property value as a stringmethodName
- name of the method requiring the search.- Returns:
- boolean indicating whether the search criteria is located in any of the string parameter values.
- Throws:
RepositoryErrorException
- the properties are not properly set up in the instance
-
isATypeOf
public boolean isATypeOf(String sourceName, InstanceAuditHeader instance, String typeName, String localMethodName) Returns a boolean indicating that the instance is of the supplied type. It tests the base type and all the super types.- Specified by:
isATypeOf
in interfaceOMRSRepositoryValidator
- Parameters:
sourceName
- source of the request (used for logging)instance
- instance to testtypeName
- name of the typelocalMethodName
- local method that is calling isATypeOf- Returns:
- true if typeName is instance type or a supertype of it, otherwise false
-
validateAtMostOneEntityResult
public void validateAtMostOneEntityResult(List<EntityDetail> findResults, String typeName, String serviceName, String methodName) throws RepositoryErrorException Validate that either zero or one entity were returned from a find request. This is typically when searching for entities of a specific type using one of its unique properties.- Specified by:
validateAtMostOneEntityResult
in interfaceOMRSRepositoryValidator
- Parameters:
findResults
- list of entities returned from the search.typeName
- name of the type of entities requested.serviceName
- service that requested the entities.methodName
- calling method.- Throws:
RepositoryErrorException
- results are not as expected
-
validateAtMostOneRelationshipResult
public void validateAtMostOneRelationshipResult(List<Relationship> findResults, String typeName, String serviceName, String methodName) throws RepositoryErrorException Validate that either zero or one relationship were returned from a find request. This is typically when searching for relationships of a specific type where the cardinality is set to AT_MOST_ONE in the RelationshipEndCardinality.- Specified by:
validateAtMostOneRelationshipResult
in interfaceOMRSRepositoryValidator
- Parameters:
findResults
- list of relationships returned from the search.typeName
- name of the type of relationships requested.serviceName
- service that requested the relationships.methodName
- calling method.- Throws:
RepositoryErrorException
- results are not as expected
-