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
ConstructorsConstructorDescriptionOMRSRepositoryContentValidator(OMRSRepositoryContentManager repositoryContentManager) Typical constructor used by the OMRS to create a repository validator for a repository connector. -
Method Summary
Modifier and TypeMethodDescriptionintcountMatchingHeaderPropertyValues(InstanceProperties matchProperties, InstanceAuditHeader instanceHeader, InstanceProperties instanceProperties) Count the number of matching property values that an instance has.intcountMatchingPropertyValues(InstanceProperties matchProperties, InstanceProperties instanceProperties, MatchCriteria matchCriteria) 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.booleanisActiveType(String sourceName, String typeGUID, String typeName) Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.booleanisActiveTypeId(String sourceName, String typeGUID) Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.booleanisATypeOf(String sourceName, InstanceAuditHeader instance, String typeName, String localMethodName) Returns a boolean indicating that the instance is of the supplied type.booleanisKnownType(String sourceName, String typeGUID, String typeName) Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.booleanisKnownTypeId(String sourceName, String typeGUID) Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.booleanisOpenType(String sourceName, String typeGUID, String typeName) Return boolean indicating whether the TypeDef is one of the open metadata types.booleanisOpenTypeId(String sourceName, String typeGUID) Return boolean indicating whether the TypeDef is one of the open metadata types.voidvalidateActiveType(String sourceName, String typeParameterName, TypeDefSummary typeDefSummary, TypeDefCategory category, String methodName) Validate that the supplied type is a valid active type.voidvalidateAsOfTime(String sourceName, String parameterName, Date asOfTime, String methodName) Validate that the asOfTime parameter is not for the future.voidvalidateAsOfTimeNotNull(String sourceName, String parameterName, Date asOfTime, String methodName) Validate that the asOfTime parameter is not null or for the future.voidvalidateAtMostOneEntityResult(List<EntityDetail> findResults, String typeName, String serviceName, String methodName) Validate that either zero or one entity were returned from a find request.voidvalidateAtMostOneRelationshipResult(List<Relationship> findResults, String typeName, String serviceName, String methodName) Validate that either zero or one relationship were returned from a find request.voidvalidateAttributeTypeDef(String sourceName, String parameterName, AttributeTypeDef attributeTypeDef, String methodName) Validate the content of a new AttributeTypeDef.voidvalidateAttributeTypeDefCategory(String sourceName, String nameParameterName, AttributeTypeDefCategory category, String methodName) Validate that a AttributeTypeDef's category is not null.voidvalidateAttributeTypeDefIds(String sourceName, String guidParameterName, String nameParameterName, String guid, String name, String methodName) Validate that an AttributeTypeDef's identifiers are not null and are recognized.voidvalidateClassification(String sourceName, String classificationParameterName, String classificationName, String entityTypeName, String methodName) Validate that a classification is valid for the entity.voidvalidateClassificationList(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.voidvalidateClassificationProperties(String sourceName, String classificationName, String propertiesParameterName, InstanceProperties classificationProperties, String methodName) Validate that a classification is valid for the entity.voidvalidateDateRange(String sourceName, String parameterName, Date fromTime, Date toTime, String methodName) Validate that the time parameters are not inverted ('from' later than 'to').voidvalidateEnterpriseAttributeTypeDefs(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.voidvalidateEnterpriseTypeDefs(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.voidvalidateEntityCanBeRehomed(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) Verify that an entity instance can be rehomed by the metadataCollection.voidvalidateEntityCanBeUpdated(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) Verify that an entity instance can be updated by the metadataCollection.voidvalidateEntityFromStore(String sourceName, String guid, EntityDetail entity, String methodName) Verify that an entity has been successfully retrieved from the repository and has valid contents.voidvalidateEntityFromStore(String sourceName, String guid, EntitySummary entity, String methodName) Verify that an entity has been successfully retrieved from the repository and has valid contents.voidvalidateEntityIsDeleted(String sourceName, InstanceHeader instance, String methodName) Verify the status of an entity to check it has been deleted.voidvalidateEntityIsNotDeleted(String sourceName, InstanceHeader instance, String methodName) Verify the status of an entity to check if it has been deleted.voidvalidateEntityProxy(String sourceName, String localMetadataCollectionId, String proxyParameterName, EntityProxy entityProxy, String methodName) Validates an entity proxy.voidvalidateExternalId(String sourceName, String standard, String organization, String identifier, String methodName) Validate that the type's name is not null.voidvalidateGUID(String sourceName, String guidParameterName, String guid, String methodName) Validate that an entity's identifier is not null.voidvalidateHomeMetadataGUID(String sourceName, String guidParameterName, String guid, String methodName) Validate that a home metadata collection identifier is not null.voidvalidateHomeMetadataGUID(String sourceName, Classification classification, String methodName) Validate that a home metadata collection identifier in a classification is not null.voidvalidateHomeMetadataGUID(String sourceName, InstanceHeader instance, String methodName) Validate that a home metadata collection identifier in an instance is not null.voidvalidateInstanceStatus(String sourceName, String instanceStatusParameterName, InstanceStatus instanceStatus, TypeDef typeDef, String methodName) Validates an instance status where null is permissible.voidvalidateInstanceStatusForDelete(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.voidvalidateInstanceType(String sourceName, InstanceHeader instance) Verify that the instance retrieved from the repository has a valid instance type.voidvalidateInstanceType(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.voidvalidateInstanceTypeGUID(String sourceName, String guidParameterName, String guid, String methodName) Validate that if a type's identifier is passed then it is valid.voidvalidateKnownTypeDef(String sourceName, String parameterName, TypeDef typeDef, String methodName) Validate the content of a new TypeDef is known.voidvalidateMatchCriteria(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.voidvalidateMatchCriteria(String sourceName, String parameterName, TypeDefProperties matchCriteria, String methodName) Validate that a TypeDef match criteria set of properties is not null.voidvalidateNewPropertiesForType(String sourceName, String parameterName, TypeDef typeDef, InstanceProperties properties, String methodName) Validate that the properties for a metadata instance match its TypeDefvoidvalidateNewStatus(String sourceName, String instanceStatusParameterName, InstanceStatus instanceStatus, TypeDef typeDef, String methodName) Validates an instance status where null is not allowed.voidvalidateOptionalTypeGUID(String sourceName, String guidParameterName, String guid, String methodName) Validate that type's identifier is not null.voidvalidateOptionalTypeGUIDs(String sourceName, String guidParameterName, String guid, String subtypeParameterName, List<String> subtypeGuids, String methodName) Validate that the types and subtypes (if specified) fit each other.voidvalidatePageSize(String sourceName, String parameterName, int pageSize, String methodName) Validate that a page size parameter is not negative.voidvalidatePropertiesForType(String sourceName, String parameterName, TypeDef typeDef, InstanceProperties properties, String methodName) Validate that the properties for a metadata instance match its TypeDef.voidvalidatePropertiesForType(String sourceName, String parameterName, TypeDefSummary typeDefSummary, InstanceProperties properties, String methodName) Validate that the properties for a metadata instance match its TypeDefvoidvalidateReferenceInstanceHeader(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.voidvalidateReferenceInstanceHeader(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.voidvalidateRelationshipCanBeRehomed(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) Verify that a relationship instance can be rehomed by the metadataCollection.voidvalidateRelationshipCanBeUpdated(String sourceName, String metadataCollectionId, InstanceHeader instance, String methodName) Verify that a relationship instance can be updated by the metadataCollection.voidvalidateRelationshipEnds(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.voidvalidateRelationshipFromStore(String sourceName, String guid, Relationship relationship, String methodName) Verify that a relationship has been successfully retrieved from the repository and has valid contents.voidvalidateRelationshipIsDeleted(String sourceName, InstanceHeader instance, String methodName) Verify the status of a relationship to check it has been deleted.voidvalidateRelationshipIsNotDeleted(String sourceName, InstanceHeader instance, String methodName) Verify the status of a relationship to check it has been deleted.voidvalidateSearchClassifications(String sourceName, String parameterName, SearchClassifications matchClassifications, String methodName) Validate the classification-based search conditions.voidvalidateSearchCriteria(String sourceName, String parameterName, String searchCriteria, String methodName) Validate that a search criteria is not null.voidvalidateSearchProperties(String sourceName, String parameterName, SearchProperties matchProperties, String methodName) Validate the property-based search conditions.voidvalidateTypeDef(String sourceName, String parameterName, TypeDef typeDef, String methodName) Validate the content of a new TypeDef is valid.voidvalidateTypeDefCategory(String sourceName, String nameParameterName, TypeDefCategory category, String methodName) Validate that a TypeDef's category is not null.voidvalidateTypeDefForInstance(String sourceName, String parameterName, TypeDef typeDef, String methodName) Validate the content of a TypeDef associated with a metadata instance.voidvalidateTypeDefGallery(String sourceName, String parameterName, TypeDefGallery gallery, String methodName) Validate that type's name is not null.voidvalidateTypeDefIds(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.voidvalidateTypeForInstanceDelete(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.voidvalidateTypeGUID(String sourceName, String guidParameterName, String guid, String methodName) Validate that type's identifier is not null.voidvalidateTypeName(String sourceName, String nameParameterName, String name, String methodName) Validate that type's name is not null.voidvalidateUnknownAttributeTypeDef(String sourceName, String parameterName, AttributeTypeDef attributeTypeDef, String methodName) Validate the content of a new TypeDef is known.voidvalidateUnknownTypeDef(String sourceName, String parameterName, TypeDef typeDef, String methodName) Validate the content of a new TypeDef is known.voidvalidateUserId(String sourceName, String userId, String methodName) Validate that the supplied user id is not null.booleanvalidAttributeTypeDef(String sourceName, AttributeTypeDef attributeTypeDef) Return boolean indicating whether the supplied AttributeTypeDef is valid or not.booleanvalidAttributeTypeDefId(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.booleanvalidAttributeTypeDefId(String sourceName, String attributeTypeDefGUID, String attributeTypeDefName, AttributeTypeDefCategory category) Return boolean indicating whether the AttributeTypeDef identifiers are from a single known type or not.booleanvalidEntity(String sourceName, EntityDetail entity) Test that the supplied entity is valid.booleanvalidEntity(String sourceName, EntityProxy entity) Test that the supplied entity is valid.booleanvalidEntity(String sourceName, EntitySummary entity) Test that the supplied entity is valid.booleanvalidInstanceId(String sourceName, String typeDefGUID, String typeDefName, TypeDefCategory category, String instanceGUID) Verify that the identifiers for an instance are correct.booleanvalidRelationship(String sourceName, Relationship relationship) Test that the supplied relationship is valid.booleanvalidTypeDef(String sourceName, TypeDef typeDef) Return boolean indicating whether the supplied TypeDef is valid or not.booleanvalidTypeDefId(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.booleanvalidTypeDefId(String sourceName, String typeDefGUID, String typeDefName, TypeDefCategory category) Return boolean indicating whether the TypeDef identifiers are from a single known type or not.booleanvalidTypeDefSummary(String sourceName, TypeDefSummary typeDefSummary) Return boolean indicating whether the supplied TypeDefSummary is valid or not.booleanvalidTypeId(String sourceName, String typeGUID, String typeName) Return boolean indicating whether the TypeDef identifiers are from a single known type or not.booleanverifyEntityIsClassified(List<String> requiredClassifications, EntitySummary entity) Return a boolean indicating whether the supplied entity is classified with one or more of the supplied classifications.booleanverifyInstanceHasRightStatus(List<InstanceStatus> validStatuses, InstanceHeader instance) Verify that the supplied instance is in one of the supplied statuses.booleanverifyInstancePropertiesMatchPropertyValue(String sourceName, InstanceProperties properties, String searchPropertyValue, String methodName) Search for property values matching the supplied property valuebooleanverifyInstancePropertiesMatchSearchCriteria(String sourceName, InstanceProperties properties, String searchCriteria, String methodName) Search for property values matching the search criteria (a regular expression)booleanverifyInstanceType(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.booleanverifyInstanceType(String sourceName, String instanceTypeGUID, InstanceHeader instance) Verify whether the instance passed to this method is of the type indicated by the type guid.booleanverifyMatchingClassifications(SearchClassifications matchClassifications, EntitySummary entity) Determine if the instance properties match the classification-based conditions.booleanverifyMatchingInstancePropertyValues(InstanceProperties matchProperties, InstanceAuditHeader instanceHeader, InstanceProperties instanceProperties, MatchCriteria matchCriteria) Determine if the instance properties match the match criteria.booleanverifyMatchingInstancePropertyValues(SearchProperties matchProperties, String guid, 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:
validateEnterpriseTypeDefsin 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:
validateEnterpriseAttributeTypeDefsin 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:
isActiveTypein 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:
isActiveTypeIdin 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:
isOpenTypein 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:
isOpenTypeIdin 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:
isKnownTypein 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:
isKnownTypeIdin 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:
validTypeIdin 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:
validTypeDefIdin 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:
validAttributeTypeDefIdin 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:
validTypeDefIdin 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:
validAttributeTypeDefIdin 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:
validateActiveTypein 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:
validTypeDefin 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:
validAttributeTypeDefin 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:
validTypeDefSummaryin 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:
validEntityin 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:
validEntityin 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:
validEntityin 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:
validRelationshipin 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:
validInstanceIdin 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:
validateUserIdin 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:
validateTypeDefIdsin 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:
getValidTypeDefFromIdsin 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:
validateAttributeTypeDefIdsin 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:
getValidAttributeTypeDefFromIdsin 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:
validateTypeGUIDin 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:
validateOptionalTypeGUIDin 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:
validateOptionalTypeGUIDsin 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:
validateTypeDefPatchin 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:
validateInstanceTypeGUIDin 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:
validateTypeNamein 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:
validateTypeDefCategoryin 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:
validateAttributeTypeDefCategoryin 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:
validateTypeDefin 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:
validateKnownTypeDefin 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:
validateUnknownTypeDefin 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:
validateUnknownAttributeTypeDefin 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:
validateTypeDefForInstancein 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:
validateTypeForInstanceDeletein 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:
validateAttributeTypeDefin 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:
validateTypeDefGalleryin 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:
validateExternalIdin 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:
validateGUIDin 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:
validateHomeMetadataGUIDin 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:
validateHomeMetadataGUIDin 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:
validateHomeMetadataGUIDin 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:
validateAsOfTimein 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:
validateAsOfTimeNotNullin 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:
validateDateRangein 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:
validatePageSizein 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:
validateClassificationNamein 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:
validateClassificationPropertiesin 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:
validateClassificationin 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:
validateClassificationListin 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:
validateMatchCriteriain 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:
validateMatchCriteriain 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:
validateSearchCriteriain 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:
validateSearchPropertiesin 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:
validateSearchClassificationsin 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:
validatePropertiesForTypein 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:
validatePropertiesForTypein 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:
validateNewPropertiesForTypein 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:
verifyInstanceTypein 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:
verifyInstanceTypein 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:
validateEntityFromStorein 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:
validateEntityFromStorein 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:
validateRelationshipFromStorein 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:
validateInstanceTypein 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:
validateInstanceTypein 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:
verifyInstanceHasRightStatusin 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:
validateInstanceStatusin 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:
validateNewStatusin 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:
validateInstanceStatusForDeletein 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:
validateEntityIsNotDeletedin 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:
validateEntityIsDeletedin 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:
validateEntityCanBeUpdatedin 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:
validateEntityCanBeRehomedin 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:
validateRelationshipIsNotDeletedin 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:
validateRelationshipIsDeletedin 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:
validateRelationshipCanBeUpdatedin 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:
validateRelationshipCanBeRehomedin 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:
validateRelationshipEndsin 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:
verifyEntityIsClassifiedin 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:
getStringValuesFromInstancePropertiesAsArrayin 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:
getStringValuesFromInstancePropertiesAsMapin 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:
getStringValuesFromInstancePropertiesAsStructin 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:
getStringFromPropertyValuein interfaceOMRSRepositoryValidator- Parameters:
instancePropertyValue- value to extract the string from- Returns:
- extracted string value.
-
countMatchingPropertyValues
public int countMatchingPropertyValues(InstanceProperties matchProperties, InstanceProperties instanceProperties, MatchCriteria matchCriteria) throws InvalidParameterException Count the number of matching property values that an instance has. They may come from an entity, classification or relationship.- Specified by:
countMatchingPropertyValuesin interfaceOMRSRepositoryValidator- Parameters:
matchProperties- the properties to match.instanceProperties- the properties from the instance.matchCriteria- how close does the match need to be- 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:
countMatchingHeaderPropertyValuesin 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:
verifyMatchingInstancePropertyValuesin 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:
getNumericRepresentationin interfaceOMRSRepositoryValidator- Parameters:
value- to convert- Returns:
- BigDecimal
-
verifyMatchingInstancePropertyValues
public boolean verifyMatchingInstancePropertyValues(SearchProperties matchProperties, String guid, InstanceAuditHeader instanceHeader, InstanceProperties instanceProperties) throws InvalidParameterException Determine if the instance properties match the property-based conditions.- Specified by:
verifyMatchingInstancePropertyValuesin interfaceOMRSRepositoryValidator- Parameters:
matchProperties- the property-based conditions to match.guid- unique identifier of the element (may be null if call is for classification.)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:
verifyMatchingClassificationsin 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:
validateReferenceInstanceHeaderin 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:
validateReferenceInstanceHeaderin 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:
validateEntityProxyin 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:
verifyInstancePropertiesMatchSearchCriteriain 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:
verifyInstancePropertiesMatchPropertyValuein 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:
isATypeOfin 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:
validateAtMostOneEntityResultin 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:
validateAtMostOneRelationshipResultin 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
-