Class TxnValidations
- java.lang.Object
-
- org.odpi.egeria.connectors.juxt.xtdb.txnfn.TxnValidations
-
public class TxnValidations extends Object
Common validations to use within transaction functions.
-
-
Constructor Summary
Constructors Constructor Description TxnValidations()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclassification(String classificationName, String entityTypeName, String className, String methodName)Validate that a classification is valid for the entity.static voidclassificationList(clojure.lang.IPersistentMap instance, String entityTypeName, String className, String methodName)Validate that a classification is valid for the entity.static voidclassificationProperties(String classificationName, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties classificationProperties, String className, String methodName)Validate that a classification is valid for the entity.static voidentityFromStore(String guid, clojure.lang.IPersistentMap entity, String className, String methodName)Verify that an entity has been successfully retrieved from the repository and has valid contents.static voidinstanceCanBeUpdated(clojure.lang.IPersistentMap instance, String guid, String metadataCollectionId, String className, String methodName)Verify that a metadata instance can be updated by the metadataCollection.static voidinstanceCanBeUpdated(clojure.lang.IPersistentMap instance, String guid, String metadataCollectionId, String classificationName, String className, String methodName)Verify that a metadata instance can be updated by the metadataCollection.static voidinstanceIsDeleted(clojure.lang.IPersistentMap existing, String instanceGUID, String className, String methodName)Validates that the provided metadata instance is in a soft-deleted state.static voidinstanceIsNotDeleted(clojure.lang.IPersistentMap existing, String instanceGUID, String className, String methodName)Validates that the provided metadata instance is not in a deleted state.static voidinstanceStatus(Integer instanceStatus, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef typeDef, String className, String methodName)Validates an instance status where null is permissible.static voidinstanceType(clojure.lang.IPersistentMap instance, String className, String methodName)Verify that the instance retrieved from the repository has a valid instance type.static voidnonProxyEntity(clojure.lang.IPersistentMap existing, String entityGUID, String className, String methodName)Validates that the provided entity is not only an EntityProxy.static voidpropertiesForType(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef typeDef, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties properties, String className, String methodName)Validate that the properties for a metadata instance match its TypeDef.static voidrelationshipEnds(String entityOneGUID, String entityTwoGUID, clojure.lang.IPersistentMap entityOneProxy, clojure.lang.IPersistentMap entityTwoProxy, String typeDefGUID, String className, String methodName)Validate that the types of the two ends of a relationship match the relationship's TypeDef.static voidrelationshipFromStore(String guid, clojure.lang.IPersistentMap relationship, String className, String methodName)Verify that a relationship has been successfully retrieved from the repository and has valid contents.static voidrequiredProperty(String guid, String propertyName, Object propertyValue, String className, String methodName)Validates an instance status where null is not allowed.
-
-
-
Method Detail
-
entityFromStore
public static void entityFromStore(String guid, clojure.lang.IPersistentMap entity, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException, org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownException
Verify that an entity has been successfully retrieved from the repository and has valid contents.- Parameters:
guid- unique identifier used to retrieve the entityentity- the retrieved entity (or null)className- doing the validationmethodName- method receiving the call- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownException- No entity foundorg.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException- logic error in the repository corrupted instance
-
relationshipFromStore
public static void relationshipFromStore(String guid, clojure.lang.IPersistentMap relationship, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException, org.odpi.openmetadata.repositoryservices.ffdc.exception.RelationshipNotKnownException
Verify that a relationship has been successfully retrieved from the repository and has valid contents.- Parameters:
guid- unique identifier used to retrieve the entityrelationship- the retrieved relationship (or null)className- doing the validationmethodName- method receiving the call- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.RelationshipNotKnownException- No relationship foundorg.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException- logic error in the repository corrupted instance
-
classification
public static void classification(String classificationName, String entityTypeName, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, org.odpi.openmetadata.repositoryservices.ffdc.exception.ClassificationErrorException
Validate that a classification is valid for the entity.- Parameters:
classificationName- unique name for a classification typeentityTypeName- name of entity typeclassName- doing the validationmethodName- method receiving the call- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- classification name is nullorg.odpi.openmetadata.repositoryservices.ffdc.exception.ClassificationErrorException- the classification is invalid for this entity
-
instanceIsNotDeleted
public static void instanceIsNotDeleted(clojure.lang.IPersistentMap existing, String instanceGUID, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterExceptionValidates that the provided metadata instance is not in a deleted state.- Parameters:
existing- metadata instanceinstanceGUID- of the instanceclassName- doing the validationmethodName- doing the validation- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- if the provided metadata instance is already in a deleted state
-
instanceIsDeleted
public static void instanceIsDeleted(clojure.lang.IPersistentMap existing, String instanceGUID, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterExceptionValidates that the provided metadata instance is in a soft-deleted state.- Parameters:
existing- metadata instanceinstanceGUID- of the instanceclassName- doing the validationmethodName- doing the validation- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- if the provided metadata instance is not in a deleted state
-
nonProxyEntity
public static void nonProxyEntity(clojure.lang.IPersistentMap existing, String entityGUID, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownExceptionValidates that the provided entity is not only an EntityProxy.- Parameters:
existing- entity to checkentityGUID- of the entityclassName- doing the validationmethodName- doing the validation- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.EntityNotKnownException- if the provided entity is only an EntityProxy
-
instanceCanBeUpdated
public static void instanceCanBeUpdated(clojure.lang.IPersistentMap instance, String guid, String metadataCollectionId, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterExceptionVerify that a metadata instance can be updated by the metadataCollection. The caller can update a metadata instance provided: the instance is locally homed (matching metadataCollectionId) OR the instance has instanceProvenanceType set to external and replicatedBy is set to the local metadataCollectionId. Any other combination suggests that this is either a reference copy of an instance from the local cohort or a reference copy of an external entity (and something else is responsible for its replication): in these cases we are not permitted to update the metadata instance and will instead throw an InvalidParameterException.- Parameters:
instance- instance to validateguid- unique identifier for the metadata instance being updatedmetadataCollectionId- unique identifier for the metadata collectionclassName- name of the calling classmethodName- name of calling method- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- the instance cannot be updated due to its status or metadataCollectionId
-
instanceCanBeUpdated
public static void instanceCanBeUpdated(clojure.lang.IPersistentMap instance, String guid, String metadataCollectionId, String classificationName, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterExceptionVerify that a metadata instance can be updated by the metadataCollection. The caller can update a metadata instance provided: the instance is locally homed (matching metadataCollectionId) OR the instance has instanceProvenanceType set to external and replicatedBy is set to the local metadataCollectionId. Any other combination suggests that this is either a reference copy of an instance from the local cohort or a reference copy of an external entity (and something else is responsible for its replication): in these cases we are not permitted to update the metadata instance and will instead throw an InvalidParameterException.- Parameters:
instance- instance to validateguid- unique identifier for the metadata instance being updatedmetadataCollectionId- unique identifier for the metadata collectionclassificationName- of the classification to be updated (or null if only the base instance)className- name of the calling classmethodName- name of calling method- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- the instance cannot be updated due to its status or metadataCollectionId
-
requiredProperty
public static void requiredProperty(String guid, String propertyName, Object propertyValue, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException
Validates an instance status where null is not allowed.- Parameters:
guid- unique identifier for the metadata instance being updatedpropertyName- name of the required propertypropertyValue- value of the required propertyclassName- class calledmethodName- method called- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- invalid parameter
-
instanceType
public static void instanceType(clojure.lang.IPersistentMap instance, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException, IOExceptionVerify that the instance retrieved from the repository has a valid instance type.- Parameters:
instance- the retrieved instanceclassName- calling classmethodName- calling method- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException- logic error in the repository corrupted instanceIOException- on any error deserializing the type information
-
instanceStatus
public static void instanceStatus(Integer instanceStatus, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef typeDef, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.StatusNotSupportedException
Validates an instance status where null is permissible.- Parameters:
instanceStatus- initial status valuetypeDef- type of the instanceclassName- calling classmethodName- method called- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.StatusNotSupportedException- the initial status is invalid for this type
-
classificationProperties
public static void classificationProperties(String classificationName, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties classificationProperties, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException, org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException
Validate that a classification is valid for the entity.- Parameters:
classificationName- unique name for a classification typeclassificationProperties- properties to testclassName- calling classmethodName- method receiving the call- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException- classification name is nullorg.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException- on any other error
-
classificationList
public static void classificationList(clojure.lang.IPersistentMap instance, String entityTypeName, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, org.odpi.openmetadata.repositoryservices.ffdc.exception.ClassificationErrorException, org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException, org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException, IOExceptionValidate that a classification is valid for the entity.- Parameters:
instance- metadata instance with classificationsentityTypeName- name of entity typeclassName- calling classmethodName- method receiving the call- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- classification name is nullorg.odpi.openmetadata.repositoryservices.ffdc.exception.ClassificationErrorException- the classification is invalid for this entityorg.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException- the classification's properties are invalid for its typeIOException- on any error deserializing valuesorg.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException- on any other error
-
propertiesForType
public static void propertiesForType(org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef typeDef, org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties properties, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException, org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorExceptionValidate that the properties for a metadata instance match its TypeDef.- Parameters:
typeDef- type information to validate againstproperties- proposed properties for instanceclassName- calling classmethodName- method receiving the call- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.PropertyErrorException- invalid propertyorg.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException- on any other error
-
relationshipEnds
public static void relationshipEnds(String entityOneGUID, String entityTwoGUID, clojure.lang.IPersistentMap entityOneProxy, clojure.lang.IPersistentMap entityTwoProxy, String typeDefGUID, String className, String methodName) throws org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException, org.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException
Validate that the types of the two ends of a relationship match the relationship's TypeDef.- Parameters:
entityOneGUID- unique identifier of end oneentityTwoGUID- unique identifier of end twoentityOneProxy- content of end oneentityTwoProxy- content of end twotypeDefGUID- typeDefGUID for the relationshipclassName- of the calling classmethodName- of the calling method- Throws:
org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException- types do not alignorg.odpi.openmetadata.repositoryservices.ffdc.exception.RepositoryErrorException- on any other error
-
-