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

public abstract class AbstractTransactionFunction extends Object
Base class that all transaction functions should implement.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected 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
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractTransactionFunction

      public AbstractTransactionFunction()
  • Method Details

    • 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 function
      name - of the transaction function
      fn - 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 change
      instance - 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 change
      instance - instance to update
      classificationName - 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 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