Class EntryAccess

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

public class EntryAccess extends DataAccess implements I_EntryAccess
Operations on the Entry part of a Composition (Entry is archetyped).
Since:
1.0.0
Author:
Christian Chevalley, Jake Smolka, Luis Marco-Ruiz
  • Field Details

  • Constructor Details

    • EntryAccess

      public EntryAccess(I_DomainAccess domainAccess, String templateId, Integer sequence, UUID compositionId, com.nedap.archie.rm.composition.Composition composition, String tenantIdentifier)
      Constructor with convenient I_DomainAccess parameter, for better readability.
      Parameters:
      domainAccess - Current domain access object
      templateId - Template ID of this entry
      sequence - Sequence number of this entry
      compositionId - Linked composition ID
      composition - Object representation of linked composition
  • Method Details

    • retrieveInstanceInComposition

      public static I_EntryAccess retrieveInstanceInComposition(I_DomainAccess domainAccess, I_CompositionAccess compositionAccess)
      Description copied from interface: I_EntryAccess
      Retrieve the I_EntryAccess linked to given composition.
      Parameters:
      domainAccess - SQL context
      compositionAccess - a composition access interface instance
      Returns:
      the entry access
      Throws:
      IllegalArgumentException - if DB is inconsistent or operation fails
    • retrieveInstanceInCompositionVersion

      public static I_EntryAccess retrieveInstanceInCompositionVersion(I_DomainAccess domainAccess, I_CompositionAccess compositionHistoryAccess, int version)
      Description copied from interface: I_EntryAccess
      Retrieve the I_EntryAccess linked to given composition history.
      Parameters:
      domainAccess - SQL context
      compositionHistoryAccess - the composition history access instance
      version - the version of the composition
      Returns:
      the entry access
    • queryJSON

      public static Map<String,Object> queryJSON(I_DomainAccess domainAccess, String queryString)
      Description copied from interface: I_EntryAccess
      perform an arbitrary SQL query on entries and return the result set as a JSON string
      Parameters:
      domainAccess - SQL access
      queryString - a valid SQL queryJSON string
      Returns:
      a JSON formatted result set
      Throws:
      InternalServerException - when the query failed
    • getComposition

      public com.nedap.archie.rm.composition.Composition getComposition()
      Description copied from interface: I_EntryAccess
      get the actual composition held in this entry
      Specified by:
      getComposition in interface I_EntryAccess
      Returns:
      Composition
      See Also:
      • Composition
    • 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

      @Deprecated public UUID commit()
      Deprecated.
      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
      Throws:
      InternalServerException - because inherited interface function isn't implemented in this class
    • 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:
    • getId

      public UUID getId()
      Description copied from interface: I_EntryAccess
      get the entry Id
      Specified by:
      getId in interface I_EntryAccess
      Returns:
      entry ID as UUID
    • getEntryJson

      public org.jooq.JSONB getEntryJson()
      Description copied from interface: I_EntryAccess
      get the entry values as a JSON string
      Specified by:
      getEntryJson in interface I_EntryAccess
      Returns:
      JSON representation of entry values
    • getCategory

      public DvCodedTextRecord getCategory()
      Description copied from interface: I_EntryAccess
      get the entry category record id
      Category attribute is a DvCodedText
      Specified by:
      getCategory in interface I_EntryAccess
      Returns:
      DvCodedText of category concept
    • getCompositionName

      public DvCodedTextRecord getCompositionName()
    • setCompositionName

      public void setCompositionName(com.nedap.archie.rm.datavalues.DvText compositionName)
    • getCompositionId

      public UUID getCompositionId()
      Description copied from interface: I_EntryAccess
      get the composition Id owning this entry
      Specified by:
      getCompositionId in interface I_EntryAccess
      Returns:
      composition ID as UUID
    • setCompositionId

      public void setCompositionId(UUID compositionId)
      Description copied from interface: I_EntryAccess
      set the owner composition by its Id
      Specified by:
      setCompositionId in interface I_EntryAccess
      Parameters:
      compositionId - UUID
    • getTemplateId

      public String getTemplateId()
      Description copied from interface: I_EntryAccess
      get the template Id (a string) used to build the composition entry
      Specified by:
      getTemplateId in interface I_EntryAccess
      Returns:
      template ID as string
    • setTemplateId

      public void setTemplateId(String templateId)
      Description copied from interface: I_EntryAccess
      set the template id to build the composition
      Specified by:
      setTemplateId in interface I_EntryAccess
      Parameters:
      templateId - a string
    • getSequence

      public Integer getSequence()
      Description copied from interface: I_EntryAccess
      get the sequence number if applicable
      Specified by:
      getSequence in interface I_EntryAccess
      Returns:
      sequence number of entry
    • setSequence

      public void setSequence(Integer sequence)
      Description copied from interface: I_EntryAccess
      set the sequence number of this entry
      Specified by:
      setSequence in interface I_EntryAccess
      Parameters:
      sequence - number of this entry
    • getArchetypeId

      public String getArchetypeId()
      Description copied from interface: I_EntryAccess
      Get the root archetype to build the composition
      Specified by:
      getArchetypeId in interface I_EntryAccess
      Returns:
      archetype ID as string
    • getRmVersion

      public String getRmVersion()
      Specified by:
      getRmVersion in interface I_EntryAccess
    • getItemType

      public String getItemType()
      Description copied from interface: I_EntryAccess
      get the Item Type as a literal
      Item type is one of
      • section
      • care_entry
      • admin
      Specified by:
      getItemType in interface I_EntryAccess
      Returns:
      item type as string
    • setCompositionData

      public void setCompositionData(com.nedap.archie.rm.composition.Composition composition)
      Description copied from interface: I_EntryAccess
      set the composition data with an actual Composition
      Specified by:
      setCompositionData in interface I_EntryAccess
      Parameters:
      composition - Composition
      See Also:
      • Composition
    • getDataAccess

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