java.lang.Object
org.odpi.openmetadata.repositoryservices.localrepository.repositorycontentmanager.OMRSRepositoryContentValidator
All Implemented Interfaces:
OMRSRepositoryValidator

public class OMRSRepositoryContentValidator extends Object implements 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 Details

    • OMRSRepositoryContentValidator

      public OMRSRepositoryContentValidator(OMRSRepositoryContentManager repositoryContentManager)
      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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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

      public boolean isActiveType(String sourceName, String typeGUID, String typeName)
      Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.
      Specified by:
      isActiveType in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeGUID - unique identifier of the type
      typeName - unique name of the type
      Returns:
      boolean flag
    • isActiveTypeId

      public boolean isActiveTypeId(String sourceName, String typeGUID)
      Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.
      Specified by:
      isActiveTypeId in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeGUID - unique identifier of the type
      Returns:
      boolean flag
    • isOpenType

      public boolean isOpenType(String sourceName, String typeGUID, String typeName)
      Return boolean indicating whether the TypeDef is one of the open metadata types.
      Specified by:
      isOpenType in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeGUID - unique identifier of the type
      typeName - unique name of the type
      Returns:
      boolean flag
    • isOpenTypeId

      public boolean isOpenTypeId(String sourceName, String typeGUID)
      Return boolean indicating whether the TypeDef is one of the open metadata types.
      Specified by:
      isOpenTypeId in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeGUID - unique identifier of the type
      Returns:
      boolean flag
    • isKnownType

      public boolean isKnownType(String sourceName, String typeGUID, String typeName)
      Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.
      Specified by:
      isKnownType in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeGUID - unique identifier of the type
      typeName - unique name of the type
      Returns:
      boolean flag
    • isKnownTypeId

      public boolean isKnownTypeId(String sourceName, String typeGUID)
      Return boolean indicating whether the TypeDef/AttributeTypeDef is in use in the repository.
      Specified by:
      isKnownTypeId in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeGUID - unique identifier of the type
      Returns:
      boolean flag
    • validTypeId

      public boolean validTypeId(String sourceName, String typeGUID, String typeName)
      Return boolean indicating whether the TypeDef identifiers are from a single known type or not.
      Specified by:
      validTypeId in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeGUID - unique identifier of the TypeDef
      typeName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeDefGUID - unique identifier of the TypeDef
      typeDefName - unique name of the TypeDef
      category - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      attributeTypeDefGUID - unique identifier of the AttributeTypeDef
      attributeTypeDefName - unique name of the AttributeTypeDef
      category - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeDefGUID - unique identifier of the TypeDef
      typeDefName - unique name of the TypeDef
      typeDefVersion - version of the type
      category - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      attributeTypeDefGUID - unique identifier of the TypeDef
      attributeTypeDefName - unique name of the TypeDef
      attributeTypeDefVersion - version of the type
      category - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeParameterName - the name of the parameter that passed the type
      typeDefSummary - the type to test
      category - the expected category of the type
      methodName - the name of the method that supplied the type
      Throws:
      InvalidParameterException - the type is null or contains invalid values
      TypeErrorException - the type is not active
    • validTypeDef

      public boolean validTypeDef(String sourceName, TypeDef typeDef)
      Return boolean indicating whether the supplied TypeDef is valid or not.
      Specified by:
      validTypeDef in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the TypeDef (used for logging)
      typeDef - TypeDef to test
      Returns:
      boolean result
    • validAttributeTypeDef

      public boolean validAttributeTypeDef(String sourceName, AttributeTypeDef attributeTypeDef)
      Return boolean indicating whether the supplied AttributeTypeDef is valid or not.
      Specified by:
      validAttributeTypeDef in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      attributeTypeDef - TypeDef to test
      Returns:
      boolean result
    • validTypeDefSummary

      public boolean validTypeDefSummary(String sourceName, TypeDefSummary typeDefSummary)
      Return boolean indicating whether the supplied TypeDefSummary is valid or not.
      Specified by:
      validTypeDefSummary in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      typeDefSummary - TypeDefSummary to test.
      Returns:
      boolean result.
    • validEntity

      public boolean validEntity(String sourceName, EntitySummary entity)
      Test that the supplied entity is valid.
      Specified by:
      validEntity in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      entity - entity to test
      Returns:
      boolean result
    • validEntity

      public boolean validEntity(String sourceName, EntityProxy entity)
      Test that the supplied entity is valid.
      Specified by:
      validEntity in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      entity - entity to test
      Returns:
      boolean result
    • validEntity

      public boolean validEntity(String sourceName, EntityDetail entity)
      Test that the supplied entity is valid.
      Specified by:
      validEntity in interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      entity - entity to test
      Returns:
      boolean result
    • validRelationship

      public boolean validRelationship(String sourceName, Relationship relationship)
      Test that the supplied relationship is valid.
      Specified by:
      validRelationship in interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 request
      name - 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 interface OMRSRepositoryValidator
      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 request
      name - 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 interface OMRSRepositoryValidator
      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 request
      name - 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 interface OMRSRepositoryValidator
      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 request
      name - 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 interface OMRSRepositoryValidator
      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 request
      methodName - method receiving the call
      Throws:
      InvalidParameterException - no guid provided
      TypeErrorException - 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 interface OMRSRepositoryValidator
      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 request
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      guidParameterName - name of the parameter that passed the guid
      guid - unique identifier for a type passed on the request
      subtypeParameterName - name of the parameter that passed a list of subtype guids
      subtypeGuids - list of unique identifiers for the subtypes passed on the request
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      patch - patch to test
      methodName - calling method
      Returns:
      current value of the type
      Throws:
      InvalidParameterException - the patch is null
      TypeDefNotKnownException - the type is not known
      PatchErrorException - 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 interface OMRSRepositoryValidator
      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 request
      methodName - 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 interface OMRSRepositoryValidator
      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 request
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      nameParameterName - name of the parameter that passed the name.
      category - category of TypeDef
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      nameParameterName - name of the parameter that passed the name.
      category - category of TypeDef
      methodName - 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 interface OMRSRepositoryValidator
      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 request
      methodName - method receiving the call
      Throws:
      InvalidParameterException - no typeDef provided
      InvalidTypeDefException - 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 interface OMRSRepositoryValidator
      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 request
      methodName - 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 interface OMRSRepositoryValidator
      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 request
      methodName - method receiving the call
      Throws:
      TypeDefKnownException - the TypeDef is already defined
      TypeDefConflictException - 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 interface OMRSRepositoryValidator
      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 request
      methodName - method receiving the call
      Throws:
      TypeDefKnownException - the TypeDef is already defined
      TypeDefConflictException - 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 interface OMRSRepositoryValidator
      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 request
      methodName - method receiving the call
      Throws:
      TypeErrorException - no typeDef provided
      RepositoryErrorException - 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 interface OMRSRepositoryValidator
      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 guid
      methodName - method making this call
      Throws:
      InvalidParameterException - incompatibility detected between the TypeDef and the instance's type
      RepositoryErrorException - 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 interface OMRSRepositoryValidator
      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 request
      methodName - method receiving the call
      Throws:
      InvalidParameterException - no attributeTypeDef provided
      InvalidTypeDefException - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the parameter that passed the name.
      gallery - typeDef gallery
      methodName - 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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 request
      methodName - 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 interface OMRSRepositoryValidator
      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 request
      methodName - 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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the parameter that passed the guid.
      asOfTime - unique name for a classification type
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the parameter that passed the guid.
      asOfTime - unique name for a classification type
      methodName - 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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 request
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the parameter that passed the guid.
      classificationName - unique name for a classification type
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      classificationName - unique name for a classification type
      propertiesParameterName - name of the parameter that passed the properties.
      classificationProperties - properties to test
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      classificationParameterName - name of the parameter that passed the guid.
      classificationName - unique name for a classification type
      entityTypeName - name of entity type
      methodName - method receiving the call
      Throws:
      InvalidParameterException - classification name is null
      ClassificationErrorException - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the parameter that passed the guid.
      classifications - list of classifications
      entityTypeName - name of entity type
      methodName - method receiving the call
      Throws:
      InvalidParameterException - classification name is null
      ClassificationErrorException - the classification is invalid for this entity
      PropertyErrorException - the classification's properties are invalid for its type
      TypeErrorException - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the parameter that passed the match criteria.
      matchCriteria - match criteria properties
      methodName - 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 interface OMRSRepositoryValidator
      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 enum
      matchProperties - match properties
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the parameter that passed the search criteria.
      searchCriteria - match criteria properties
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the parameter that passed the property-based conditions
      matchProperties - property-based conditions
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the parameter that passed the classification-based conditions
      matchClassifications - classification-based conditions
      methodName - 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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the "properties" parameter.
      typeDefSummary - type information to validate against.
      properties - proposed properties
      methodName - method receiving the call
      Throws:
      TypeErrorException - no typeDef provided
      PropertyErrorException - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      parameterName - name of the "properties" parameter.
      typeDef - type information to validate against.
      properties - proposed properties
      methodName - 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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      guid - unique identifier used to retrieve the entity
      entity - the retrieved entity (or null)
      methodName - method receiving the call
      Throws:
      EntityNotKnownException - No entity found
      RepositoryErrorException - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      guid - unique identifier used to retrieve the entity
      entity - the retrieved entity (or null)
      methodName - method receiving the call
      Throws:
      EntityNotKnownException - No entity found
      RepositoryErrorException - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      guid - unique identifier used to retrieve the entity
      relationship - the retrieved relationship (or null)
      methodName - method receiving the call
      Throws:
      RelationshipNotKnownException - No relationship found
      RepositoryErrorException - 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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      instance - the retrieved instance
      typeGUIDParameterName - name of parameter for TypeDefGUID
      typeNameParameterName - name of parameter for TypeDefName
      expectedTypeGUID - expected GUID of InstanceType
      expectedTypeName - expected name of InstanceType
      Throws:
      RepositoryErrorException - logic error in the repository corrupted instance
      TypeErrorException - problem with type
      InvalidParameterException - 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 interface OMRSRepositoryValidator
      Parameters:
      validStatuses - list of statuses the instance should be in any one of them
      instance - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      instanceStatusParameterName - name of the initial status parameter
      instanceStatus - initial status value
      typeDef - type of the instance
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      instanceStatusParameterName - name of the initial status parameter
      instanceStatus - initial status value
      typeDef - type of the instance
      methodName - method called
      Throws:
      StatusNotSupportedException - the initial status is invalid for this type
      InvalidParameterException - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      instance - instance about to be deleted
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      instance - instance to validate
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      instance - instance to validate
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      metadataCollectionId - unique identifier for the metadata collection
      instance - instance to validate
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      metadataCollectionId - unique identifier for the metadata collection
      instance - instance to validate
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      instance - instance to test
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      instance - instance to test
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      metadataCollectionId - unique identifier for the metadata collection
      instance - instance to validate
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      metadataCollectionId - unique identifier for the metadata collection
      instance - instance to validate
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      entityOneProxy - content of end one
      entityTwoProxy - content of end two
      typeDef - typeDef for the relationship
      methodName - name of the method making the request
      Throws:
      InvalidParameterException - types do not align
    • verifyEntityIsClassified

      public 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.
      Specified by:
      verifyEntityIsClassified in interface OMRSRepositoryValidator
      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

      public String getStringValuesFromInstancePropertiesAsArray(InstanceProperties instanceProperties)
      Return the string form of the instance properties. Can be used as propertyValue on find property value calls.
      Specified by:
      getStringValuesFromInstancePropertiesAsArray in interface OMRSRepositoryValidator
      Parameters:
      instanceProperties - value to extract the string from
      Returns:
      extracted string value.
    • getStringValuesFromInstancePropertiesAsMap

      public String getStringValuesFromInstancePropertiesAsMap(InstanceProperties instanceProperties)
      Return the string form of the instance properties. Can be used as propertyValue on find property value calls.
      Specified by:
      getStringValuesFromInstancePropertiesAsMap in interface OMRSRepositoryValidator
      Parameters:
      instanceProperties - value to extract the string from
      Returns:
      extracted string value.
    • getStringValuesFromInstancePropertiesAsStruct

      public String getStringValuesFromInstancePropertiesAsStruct(InstanceProperties instanceProperties)
      Return the string form of the instance properties. Can be used as propertyValue on find property value calls.
      Specified by:
      getStringValuesFromInstancePropertiesAsStruct in interface OMRSRepositoryValidator
      Parameters:
      instanceProperties - value to extract the string from
      Returns:
      extracted string value.
    • getStringFromPropertyValue

      public String getStringFromPropertyValue(InstancePropertyValue instancePropertyValue)
      Return the string form of a property value. Can be used as propertyValue on find property value calls.
      Specified by:
      getStringFromPropertyValue in interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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

      public BigDecimal getNumericRepresentation(InstancePropertyValue value)
      Retrieve a numeric representation of the provided value, or null if it cannot be converted to a number.
      Specified by:
      getNumericRepresentation in interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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 test
      methodName - the name of the method that supplied the instance.
      Throws:
      RepositoryErrorException - problem with repository
      InvalidParameterException - 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 interface OMRSRepositoryValidator
      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 test
      auditLog - optional logging destination
      methodName - the name of the method that supplied the instance.
      Throws:
      RepositoryErrorException - problem with repository
      InvalidParameterException - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      localMetadataCollectionId - unique identifier for this repository's metadata collection
      proxyParameterName - name of the parameter used to provide the parameter
      entityProxy - proxy to add
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      properties - list of properties associated with the in instance
      searchCriteria - regular expression for testing the property values
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      properties - list of properties associated with the in instance
      searchPropertyValue - property value as a string
      methodName - 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 interface OMRSRepositoryValidator
      Parameters:
      sourceName - source of the request (used for logging)
      instance - instance to test
      typeName - name of the type
      localMethodName - 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 interface OMRSRepositoryValidator
      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 interface OMRSRepositoryValidator
      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