Class SystemAccess

java.lang.Object
org.ehrbase.dao.access.support.DataAccess
org.ehrbase.dao.access.jooq.SystemAccess
All Implemented Interfaces:
I_DomainAccess, I_SimpleCRUD, I_SystemAccess

public class SystemAccess extends DataAccess implements I_SystemAccess
Created by Christian Chevalley on 4/20/2015.
  • Constructor Details

  • Method Details

    • createOrRetrieveLocalSystem

      public static UUID createOrRetrieveLocalSystem(I_DomainAccess domainAccess)
      Description copied from interface: I_SystemAccess
      Helper to retrieve or storeComposition a local host identifier
      the local settings is a combination of MAC address and hostname:
      for example: 44-87-FC-A9-B4-B2|TEST-PC
      if the system is not yet in the DB it is created, it is retrieved otherwise
      Returns:
      UUID of local system from DB
    • createOrRetrieveInstanceId

      public static UUID createOrRetrieveInstanceId(I_DomainAccess domainAccess, String description, String settings)
      Description copied from interface: I_SystemAccess
      Try to retrieve system with given input. If not available create instance.
      Parameters:
      domainAccess - Data Access Object
      description - Optional description, can be NULL to use default
      settings - a string describing the system (arbitrary convention)
      Returns:
      UUID of system entry
    • retrieveInstanceId

      public static UUID retrieveInstanceId(I_DomainAccess domainAccess, String settings)
      Description copied from interface: I_SystemAccess
      retrieve the Id of a system by name (or settings)
      Parameters:
      domainAccess - SQL access
      settings - a string describing the system (arbitrary convention)
      Returns:
      UUID or null if not found
      Throws:
      IllegalArgumentException - if couldn't retrieve instance with given settings
    • commit

      public UUID commit(Timestamp transactionTime)
      Description copied from interface: I_SimpleCRUD
      storeComposition a new entry in the DB
      Specified by:
      commit in interface I_SimpleCRUD
      Returns:
      the UUID of the newly created record
    • commit

      public UUID commit()
      Description copied from interface: I_SimpleCRUD
      storeComposition a new entry in the DB, using a default transaction time
      only implemented with "root" tables: ehr, contribution and composition!
      Specified by:
      commit in interface I_SimpleCRUD
      Returns:
      the UUID of the newly created record
    • update

      public Boolean update(Timestamp transactionTime)
      Description copied from interface: I_SimpleCRUD
      updateComposition the current entry
      depending on the implementation, records are updated only if one or more field(s) have been changed
      Specified by:
      update in interface I_SimpleCRUD
      Returns:
    • update

      public Boolean update(Timestamp transactionTime, boolean force)
      Description copied from interface: I_SimpleCRUD
      updateComposition the current entry even if the record is not modified
      intended to be used with temporal tables to ensure that a set of interdependent tables are updated in sync. This approach is used to simplify versions retrieval.
      Specified by:
      update in interface I_SimpleCRUD
      Returns:
    • update

      @Deprecated public Boolean update()
      Deprecated.
      Description copied from interface: I_SimpleCRUD
      updateComposition the current entry using time now as the system transaction time
      only implemented at root level object (contribution, composition, ehr). depending on the implementation, records are updated only if one or more field(s) have been changed
      Specified by:
      update in interface I_SimpleCRUD
      Returns:
      Throws:
      InternalServerException - because inherited interface function isn't implemented in this class
    • update

      @Deprecated public Boolean update(Boolean force)
      Deprecated.
      Description copied from interface: I_SimpleCRUD
      updateComposition the current entry using time now as the system transaction time
      only implemented at root level object (contribution, composition, ehr). depending on the implementation, records are updated only if one or more field(s) have been changed
      Specified by:
      update in interface I_SimpleCRUD
      Returns:
      Throws:
      InternalServerException - because inherited interface function isn't implemented in this class
    • delete

      public Integer delete()
      Description copied from interface: I_SimpleCRUD
      delete the Versioned Object associated with the instance implementing this Data Access Interface. Relies on ON DELETE CASCADE
      Specified by:
      delete in interface I_SimpleCRUD
      Returns:
    • retrieveInstance

      public static I_SystemAccess retrieveInstance(I_DomainAccess domainAccess, UUID id)
      Description copied from interface: I_SystemAccess
      retrieve a system entry by its Id
      Parameters:
      domainAccess - SQL access
      id - UUID
      Returns:
      UUID
    • getId

      public UUID getId()
      Specified by:
      getId in interface I_SystemAccess
    • getSettings

      public String getSettings()
      Specified by:
      getSettings in interface I_SystemAccess
    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface I_SystemAccess
    • getDataAccess

      public DataAccess getDataAccess()
      Specified by:
      getDataAccess in interface I_DomainAccess