Class AbstractTransactionFunction
java.lang.Object
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.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
Base class that all transaction functions should implement.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected static void
createTransactionFunction
(xtdb.api.tx.Transaction.Builder tx, clojure.lang.Keyword name, String fn) Create the transaction function within XTDB.static String
getGUID
(clojure.lang.IPersistentMap instance) Retrieve the instance GUID from the provided metadata instance.static Integer
getInstanceProvenanceType
(clojure.lang.IPersistentMap instance) Retrieve the instanceProvenanceType from the provided metadata instance.static String
getMetadataCollectionId
(clojure.lang.IPersistentMap instance) Retrieve the metadataCollectionId from the provided metadata instance.protected static String
getTxnTimeCalculation
(String docVar) Create the let statements necessary to capture the valid time that should be used when submitting the transaction.static TypeDef
getTypeDefForInstance
(clojure.lang.IPersistentMap instance) Retrieve the type definition for the provided metadata instance.static String
getTypeDefGUID
(clojure.lang.IPersistentMap instance) Retrieve the type definition GUID from the provided metadata instance.protected static clojure.lang.IPersistentMap
incrementVersion
(String userId, clojure.lang.IPersistentMap instance) Changes the control information to reflect an update in an instance.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.
-
Constructor Details
-
AbstractTransactionFunction
public AbstractTransactionFunction()
-
-
Method Details
-
getTxnTimeCalculation
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
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
Retrieve the type definition for the provided metadata instance.- Parameters:
instance
- of metadata- Returns:
- TypeDef that defines the metadata instance
-
getGUID
Retrieve the instance GUID from the provided metadata instance.- Parameters:
instance
- of metadata- Returns:
- String unique identifier of the metadata instance
-
getMetadataCollectionId
Retrieve the metadataCollectionId from the provided metadata instance.- Parameters:
instance
- of metadata- Returns:
- String unique identifier of the metadata instance's metadataCollectionId
-
getInstanceProvenanceType
Retrieve the instanceProvenanceType from the provided metadata instance.- Parameters:
instance
- of metadata- Returns:
- Integer unique ordinal of the metadata instance's instanceProvenanceType
-