public class ReHomeEntity extends ReHomeInstance
Transaction function for updating an entity's home repository.
  • Field Details

    • FUNCTION_NAME

      public static final clojure.lang.Keyword FUNCTION_NAME
  • Constructor Details

    • ReHomeEntity

      public ReHomeEntity(Long txId, clojure.lang.PersistentHashMap existing, String userId, String entityGUID, String metadataCollectionId, String newMetadataCollectionId, String newMetadataCollectionName) throws Exception
      Constructor used to execute the transaction function.
      Parameters:
      txId - the transaction ID of this function invocation
      existing - XTDB document to re-home
      userId - doing the update
      entityGUID - of the entity to re-home
      metadataCollectionId - of the metadata collection in which the transaction is running
      newMetadataCollectionId - in which to re-home to the entity
      newMetadataCollectionName - in which to re-home the entity
      Throws:
      Exception - on any error
  • Method Details

    • transact

      public static EntityDetail transact(XTDBOMRSRepositoryConnector xtdb, String userId, String entityGUID, String newMetadataCollectionId, String newMetadataCollectionName) throws EntityNotKnownException, InvalidParameterException, RepositoryErrorException
      Change the home repository of the provided entity instance in the XTDB repository by pushing the transaction down into the repository itself.
      Parameters:
      xtdb - connectivity
      userId - doing the update
      entityGUID - of the entity on which to change the home repository
      newMetadataCollectionId - in which to re-home to the entity
      newMetadataCollectionName - in which to re-home the entity
      Returns:
      EntityDetail the entity with the new home repository applied
      Throws:
      EntityNotKnownException - if the entity cannot be found
      InvalidParameterException - if the entity exists but cannot be re-homed (i.e. not a reference copy)
      RepositoryErrorException - on any other error
    • doc

      public clojure.lang.IPersistentMap doc()
      Interface that returns the updated document to write-back from the transaction.
      Returns:
      IPersistentMap giving the updated document in its entirety
    • create

      public static void create(xtdb.api.tx.Transaction.Builder tx)
      Create the transaction function within XTDB.
      Parameters:
      tx - transaction through which to create the function