Class AbstractTransactionFunction
- java.lang.Object
-
- org.odpi.egeria.connectors.juxt.xtdb.txnfn.AbstractTransactionFunction
-
- Direct Known Subclasses:
AddEntity,AddEntityProxy,AddRelationship,ClassifyEntity,DeclassifyEntity,DeleteInstance,PurgeClassificationReferenceCopy,PurgeEntity,PurgeRelationship,ReHomeInstance,ReIdentifyInstance,ReLinkRelationship,RestoreInstance,ReTypeInstance,SaveClassificationReferenceCopy,SaveEntityReferenceCopy,SaveRelationshipReferenceCopy,UndoInstanceUpdate,UpdateInstanceProperties,UpdateInstanceStatus
public abstract class AbstractTransactionFunction extends Object
Base class that all transaction functions should implement.
-
-
Constructor Summary
Constructors Constructor Description AbstractTransactionFunction()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static voidcreateTransactionFunction(xtdb.api.tx.Transaction.Builder tx, clojure.lang.Keyword name, String fn)Create the transaction function within XTDB.static StringgetGUID(clojure.lang.IPersistentMap instance)Retrieve the instance GUID from the provided metadata instance.static IntegergetInstanceProvenanceType(clojure.lang.IPersistentMap instance)Retrieve the instanceProvenanceType from the provided metadata instance.static StringgetMetadataCollectionId(clojure.lang.IPersistentMap instance)Retrieve the metadataCollectionId from the provided metadata instance.protected static StringgetTxnTimeCalculation(String docVar)Create the let statements necessary to capture the valid time that should be used when submitting the transaction.static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefgetTypeDefForInstance(clojure.lang.IPersistentMap instance)Retrieve the type definition for the provided metadata instance.static StringgetTypeDefGUID(clojure.lang.IPersistentMap instance)Retrieve the type definition GUID from the provided metadata instance.protected static clojure.lang.IPersistentMapincrementVersion(String userId, clojure.lang.IPersistentMap instance)Changes the control information to reflect an update in an instance.protected static clojure.lang.IPersistentMapincrementVersion(String userId, clojure.lang.IPersistentMap instance, String classificationName)Changes the control information to reflect an update in an instance.
-
-
-
Method Detail
-
getTxnTimeCalculation
protected static String getTxnTimeCalculation(String docVar)
Create the let statements necessary to capture the valid time that should be used when submitting the transaction. Logic is as follows: Prefer the later of update time and last classification change, and if neither of those is available fall back to create time- Parameters:
docVar- the name of the variable containing the document map to check for valid time details- Returns:
- String snippet of Clojure that can be embedded within a 'let'
-
createTransactionFunction
protected static void createTransactionFunction(xtdb.api.tx.Transaction.Builder tx, clojure.lang.Keyword name, String fn)Create the transaction function within XTDB.- Parameters:
tx- transaction through which to create the functionname- of the transaction functionfn- the logic of the transaction function
-
incrementVersion
protected static clojure.lang.IPersistentMap incrementVersion(String userId, clojure.lang.IPersistentMap instance)
Changes the control information to reflect an update in an instance.- Parameters:
userId- user making the changeinstance- instance to update- Returns:
- IPersistentMap with the updates applied
-
incrementVersion
protected static clojure.lang.IPersistentMap incrementVersion(String userId, clojure.lang.IPersistentMap instance, String classificationName)
Changes the control information to reflect an update in an instance.- Parameters:
userId- user making the changeinstance- instance to updateclassificationName- of the classification being incremented (or null if incrementing the base instance)- Returns:
- IPersistentMap with the updates applied
-
getTypeDefGUID
public static String getTypeDefGUID(clojure.lang.IPersistentMap instance)
Retrieve the type definition GUID from the provided metadata instance.- Parameters:
instance- of metadata- Returns:
- String unique identifier of the type definition for the metadata instance
-
getTypeDefForInstance
public static org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef getTypeDefForInstance(clojure.lang.IPersistentMap instance)
Retrieve the type definition for the provided metadata instance.- Parameters:
instance- of metadata- Returns:
- TypeDef that defines the metadata instance
-
getGUID
public static String getGUID(clojure.lang.IPersistentMap instance)
Retrieve the instance GUID from the provided metadata instance.- Parameters:
instance- of metadata- Returns:
- String unique identifier of the metadata instance
-
getMetadataCollectionId
public static String getMetadataCollectionId(clojure.lang.IPersistentMap instance)
Retrieve the metadataCollectionId from the provided metadata instance.- Parameters:
instance- of metadata- Returns:
- String unique identifier of the metadata instance's metadataCollectionId
-
getInstanceProvenanceType
public static Integer getInstanceProvenanceType(clojure.lang.IPersistentMap instance)
Retrieve the instanceProvenanceType from the provided metadata instance.- Parameters:
instance- of metadata- Returns:
- Integer unique ordinal of the metadata instance's instanceProvenanceType
-
-