Interface I_CompositionAccess

All Superinterfaces:
I_Compensatable, I_VersionedCRUD
All Known Implementing Classes:
CompositionAccess

public interface I_CompositionAccess extends I_VersionedCRUD, I_Compensatable
Composition Access Layer Interface
Interface CRUD and specific methods
  • Field Details

  • Method Details

    • getNewInstance

      static I_CompositionAccess getNewInstance(I_DomainAccess domain, com.nedap.archie.rm.composition.Composition composition, UUID ehrId, Short sysTenant)
      Get a new Composition Access Instance
      Parameters:
      domain - SQL context, knowledge
      composition - a valid RM composition
      ehrId - the EHR holding this instance
      Returns:
      I_CompositionAccess object of the new access instance
      Throws:
      IllegalArgumentException - when retrieval failed because of wrong input
    • retrieveCompositionVersion

      static I_CompositionAccess retrieveCompositionVersion(I_DomainAccess domainAccess, UUID id, int version)
      Retrieve composition(s) for an identified version
      Parameters:
      domainAccess - SQL context
      id - the versioned_object uuid
      version - version number
      Returns:
      I_CompositionAccess object of the matching access instance
      Throws:
      IllegalArgumentException - when version number is not greater 0
      ObjectNotFoundException - when not matching composition can't be found
    • getVersionFromTimeStamp

      static int getVersionFromTimeStamp(I_DomainAccess domainAccess, UUID vCompositionUid, Timestamp timeCommitted)
      Calculate the version corresponding to a VersionedComposition which is the closest in time (before) the Timestamp provided.
      Parameters:
      domainAccess - The I_DomainAccess containing the persistence information and DB connection parameters for persisting a composition.
      vCompositionUid - The UUID corresponding to a VersionedComposition
      timeCommitted - Timestamp of commit
      Returns:
      version number
      Throws:
      IllegalArgumentException - if no version is available for the Timestamp provided.
      InternalServerException - when SQL statements fail due to internal problems.
    • retrieveInstanceByTimestamp

      static I_CompositionAccess retrieveInstanceByTimestamp(I_DomainAccess domainAccess, UUID compositionUid, Timestamp timeCommitted)
      Returns the instance of a VersionedComposition corresponding to the version which is the closest in time before the timeCommitted provided.
      Parameters:
      domainAccess - I_DomainAccess with the persistence SQL Context and knowledge cache
      compositionUid - UUID that identifies the composition.
      timeCommitted - {java.sql.Timestamp} that indicates the point in time to search version for the composition backwards.
      Returns:
      the number of the version that is the closest in time (before) the timeCommitted parameter provided. If a null timeCommitted is provided the latest composition will be returned.
      Throws:
      IllegalArgumentException
      InternalServerException
      ObjectNotFoundException
    • retrieveInstance

      static I_CompositionAccess retrieveInstance(I_DomainAccess domainAccess, UUID id)
      Retrieve a composition access instance from the persistence layer
      Parameters:
      domainAccess - SQL context, knowledge
      id - a composition uuid
      Returns:
      a valid I_CompositionAccess
    • retrieveInstancesInContribution

      static Map<com.nedap.archie.rm.support.identification.ObjectVersionId,I_CompositionAccess> retrieveInstancesInContribution(I_DomainAccess domainAccess, UUID contributionId, String node)
      Retrieve a map of composition accesses for all compositions referencing a contribution
      Parameters:
      domainAccess - SQL context, knowledge
      contributionId - contribution object uuid
      node - Name of local node, for creation of object version ID
      Returns:
      a map of I_CompositionAccess and their version ID, that match the condition
      Throws:
      IllegalArgumentException - on DB inconsistency
    • hasPreviousVersion

      static boolean hasPreviousVersion(I_DomainAccess domainAccess, UUID compositionId)
      check if a composition has a previous version in history
      Parameters:
      domainAccess -
      compositionId -
      Returns:
    • getVersionMapOfComposition

      static Map<Integer,I_CompositionAccess> getVersionMapOfComposition(I_DomainAccess domainAccess, UUID compositionId)
      Creates Map containing all versions as their Access object with their matching version number.
      Parameters:
      domainAccess - Data Access
      compositionId - Given composition ID
      Returns:
      Map referencing all versions by their version number
    • getLastVersionNumber

      static Integer getLastVersionNumber(I_DomainAccess domainAccess, UUID compositionId)
      retrieve the number of versions for this composition or 1 if no history present
      Parameters:
      domainAccess -
      compositionId -
      Returns:
    • fetchTerritoryCode

      static int fetchTerritoryCode(I_DomainAccess domainAccess, String territoryAsString)
    • isValidLanguageCode

      static boolean isValidLanguageCode(I_DomainAccess domainAccess, String languageCode)
    • getEhrId

      static UUID getEhrId(I_DomainAccess domainAccess, UUID compositionId)
    • getSysTransaction

      Timestamp getSysTransaction()
      Specified by:
      getSysTransaction in interface I_Compensatable
    • getTimeCommitted

      Timestamp getTimeCommitted()
      Gets time_committed from contribution of composition.
      Returns:
      Timestamp of time of commitment
    • getId

      UUID getId()
      get the composition Id
      Specified by:
      getId in interface I_Compensatable
      Returns:
    • getEhrid

      UUID getEhrid()
      get the EHR id to which this composition belongs to
      Returns:
      UUID
    • setEhrid

      void setEhrid(UUID ehrId)
      set the EHR id
      Parameters:
      ehrId - UUID
    • getComposerId

      UUID getComposerId()
      get the composer Id
      Returns:
      UUID
    • setComposerId

      void setComposerId(UUID composerId)
      set the composer id
      Parameters:
      composerId - UUID
    • getContextId

      Optional<UUID> getContextId()
      get the event context id
      Returns:
      Optional with ID if it exists, otherwise empty Optional
    • getContributionId

      UUID getContributionId()
      get the contribution id
      Specified by:
      getContributionId in interface I_Compensatable
      Returns:
      UUID
    • getLanguageCode

      String getLanguageCode()
      get the language code for this composition (eg. 'en', 'fr' etc.)
      Returns:
      language code as string
    • setLanguageCode

      void setLanguageCode(String code)
      set the language code
      Parameters:
      code - String
    • getTerritoryCode

      Integer getTerritoryCode()
      FIXME: bug? comment says 2-letter while methods are saying Integer get the 2-letters country code
      Returns:
    • setTerritoryCode

      void setTerritoryCode(Integer code)
      FIXME: bug? comment says 2-letter while methods are saying Integer set the 2-letters territory code
      Parameters:
      code - String
    • getFeederAudit

      String getFeederAudit()
    • setFeederAudit

      void setFeederAudit(com.nedap.archie.rm.archetyped.FeederAudit feederAudit)
    • setLinks

      void setLinks(List<com.nedap.archie.rm.archetyped.Link> links)
    • getLinks

      String getLinks()
    • setContextCompositionId

      void setContextCompositionId(UUID contextId)
      set the event context id
      Parameters:
      contextId - UUID
      Throws:
      org.jooq.exception.DataAccessException - on problem updating context
    • getContent

      I_EntryAccess getContent()
      Get the entry linked to the composition.
      Returns:
      the entry
      See Also:
    • setContent

      void setContent(I_EntryAccess content)
    • setContributionId

      void setContributionId(UUID contributionId)
      set the contribution id for this composition
      Parameters:
      contributionId -
    • setCompositionRecord

      void setCompositionRecord(CompositionRecord record)
    • setCompositionRecord

      void setCompositionRecord(CompositionHistoryRecord record)
      Set the record via converting from a history record.
      Parameters:
      record - History record
    • setCompositionRecord

      void setCompositionRecord(org.jooq.Result<?> records)
      Throws:
      IllegalArgumentException - when handling of record failed
    • setComposition

      void setComposition(com.nedap.archie.rm.composition.Composition composition)
    • setContributionAccess

      void setContributionAccess(I_ContributionAccess contributionAccess)
    • setAuditDetailsAccess

      void setAuditDetailsAccess(I_AuditDetailsAccess auditDetailsAccess)
    • getVersion

      Integer getVersion()
    • updateCompositionData

      void updateCompositionData(com.nedap.archie.rm.composition.Composition newComposition)
      Throws:
      IllegalArgumentException - when seeking language code, territory code or composer ID failed
    • setContext

      void setContext(com.nedap.archie.rm.composition.EventContext historicalEventContext)
    • getAuditDetailsId

      UUID getAuditDetailsId()
    • getAuditDetailsAccess

      I_AuditDetailsAccess getAuditDetailsAccess()
    • setAuditDetailsId

      void setAuditDetailsId(UUID auditId)
    • exists

      static boolean exists(I_DomainAccess domainAccess, UUID versionedObjectId)
      Checks if the given versionedObjectID points to an existing composition.
      Parameters:
      domainAccess - Data access object
      versionedObjectId - ID to be checked
      Returns:
      True if exists
      Throws:
      ObjectNotFoundException - if ID does not exist
    • isDeleted

      static boolean isDeleted(I_DomainAccess domainAccess, UUID versionedObjectId)
      Checks if given composition ID is ID of a logically deleted composition.
      Parameters:
      domainAccess - Data access object
      versionedObjectId - ID to be checked
      Returns:
      True if deleted, false if not
      Throws:
      ObjectNotFoundException - If no composition entries at all can be found
      InternalServerException - If DB is inconsistent or some other problem occurs
    • adminDelete

      void adminDelete()
      Invoke physical deletion.
    • getAttestationRef

      UUID getAttestationRef()