Package org.ehrbase.dao.access.jooq
Class EhrAccess
java.lang.Object
org.ehrbase.dao.access.support.DataAccess
org.ehrbase.dao.access.jooq.EhrAccess
- All Implemented Interfaces:
I_DomainAccess,I_EhrAccess,I_SimpleCRUD
Persistence operations on EHR.
- Since:
- 1.0.0
- Author:
- Christian Chevalley, Jake Smolka, Luis Marco-Ruiz
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from interface org.ehrbase.dao.access.interfaces.I_DomainAccess
DBCP2_POOL, KEY_AUTO_RECONNECT, KEY_CONNECTION_MODE, KEY_DATABASE, KEY_DIALECT, KEY_HOST, KEY_INITIAL_CONNECTIONS, KEY_INTROSPECT_CACHE, KEY_KNOWLEDGE, KEY_LOG_ABANDONNED, KEY_LOGIN, KEY_MAX_ACTIVE, KEY_MAX_CONNECTION, KEY_MAX_IDLE, KEY_PASSWORD, KEY_PORT, KEY_REMOVE_ABANDONNED, KEY_REMOVE_ABANDONNED_TIMEOUT, KEY_SCHEMA, KEY_SET_MAX_PREPARED_STATEMENTS, KEY_SET_POOL_PREPARED_STATEMENTS, KEY_TEST_ON_BORROW, KEY_URL, KEY_WAIT_MS, PG_POOLFields inherited from interface org.ehrbase.dao.access.interfaces.I_EhrAccess
TAG_TEMPLATE_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoke physical deletion.commit()Deprecated.storeComposition a new entry in the DBdelete()Deprecated.fetchSubjectIdentifiers(I_DomainAccess domainAccess, UUID ehrId) retrieve the list of identifiers for a subject owning an Ehr
the identifiers are formatted as: "CODE:ISSUER"getCompositionList(I_DomainAccess domainAccess, UUID ehrId) FIXME: check this method.getId()com.nedap.archie.rm.datastructures.ItemStructuregetParty()com.nedap.archie.rm.ehr.EhrStatusGets latest EHR_STATUS, which is attached to this EHR instance after retrieving it.static booleanhasEhr(I_DomainAccess domainAccess, UUID ehrId) Check for existence of given ID as EHR.static BooleanisModifiable(I_DomainAccess domainAccess, UUID ehrId) Check if the EHR identified by the given ID is marked as modifiable.booleanisNew()check if Ehr is newly created (uncommitted)reload()TODO: doc or is this one really not needed anymore? delete if so.static I_EhrAccessretrieveInstance(I_DomainAccess domainAccess, UUID ehrId) Retrieve the Ehr entry from its ID (incl latest STATUS).static I_EhrAccessretrieveInstanceByStatus(I_DomainAccess domainAccess, UUID ehrId, UUID status, Integer version) static UUIDretrieveInstanceBySubject(I_DomainAccess domainAccess, String subjectId, String issuerSpace) // TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject identification with an identifier
a subject identification consists of the issuer identification (ex.static UUIDretrieveInstanceBySubject(I_DomainAccess domainAccess, UUID subjectUuid) // TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject UUID
a subject identification consists of the issuer identification (ex.static UUIDretrieveInstanceBySubjectExternalRef(I_DomainAccess domainAccess, String subjectId, String issuerSpace) // TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject identification by external reference
a subject identification consists of the issuer identification (ex.voidset access idvoidsetArchetypeNodeId(String archetypeNodeId) voidsetContributionAccess(I_ContributionAccess contributionAccess) voidsetModifiable(Boolean modifiable) voidsetName(com.nedap.archie.rm.datavalues.DvCodedText name) voidsetName(com.nedap.archie.rm.datavalues.DvText name) voidsetOtherDetails(com.nedap.archie.rm.datastructures.ItemStructure otherDetails, String templateId) voidvoidsetQueryable(Boolean queryable) voidsetStatus(com.nedap.archie.rm.ehr.EhrStatus status) voidsetStatusAccess(I_StatusAccess statusAccess) voidset system Idupdate()Deprecated.Deprecated.updateComposition the current entry
depending on the implementation, records are updated only if one or more field(s) have been changedupdateComposition 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.update(UUID committerId, UUID systemId, UUID contributionId, ContributionDef.ContributionState state, I_ConceptAccess.ContributionChangeType contributionChangeType, String description, UUID audit) Updates the whole EHR access in the DB, e.g.Methods inherited from class org.ehrbase.dao.access.support.DataAccess
getConnection, getContext, getDialect, getIntrospectService, getKnowledgeManager, getServerConfig, releaseConnection
-
Field Details
-
JSONB
- See Also:
-
EXCEPTION
- See Also:
-
COULD_NOT_RETRIEVE_EHR_FOR_ID
- See Also:
-
COULD_NOT_RETRIEVE_EHR_FOR_PARTY
- See Also:
-
-
Constructor Details
-
EhrAccess
public EhrAccess(I_DomainAccess domain, UUID partyId, UUID systemId, UUID accessId, UUID ehrId, String tenantIdentifier) - Throws:
InternalServerException- if creating or retrieving system failed
-
-
Method Details
-
retrieveInstanceBySubject
Description copied from interface:I_EhrAccess// TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject UUID
a subject identification consists of the issuer identification (ex. NHS) and an identification code- Parameters:
domainAccess- SQL accesssubjectUuid- the subject uuid- Returns:
- UUID of corresponding Ehr or null
- Throws:
IllegalArgumentException- if retrieving failed for given input
-
retrieveInstanceBySubject
public static UUID retrieveInstanceBySubject(I_DomainAccess domainAccess, String subjectId, String issuerSpace) Description copied from interface:I_EhrAccess// TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject identification with an identifier
a subject identification consists of the issuer identification (ex. NHS) and an identification code- Parameters:
domainAccess- SQL accesssubjectId- the subject code or numberissuerSpace- the issuer identifier- Returns:
- UUID of corresponding Ehr or null
- Throws:
IllegalArgumentException- if retrieving failed for given input
-
retrieveInstanceBySubjectExternalRef
public static UUID retrieveInstanceBySubjectExternalRef(I_DomainAccess domainAccess, String subjectId, String issuerSpace) Description copied from interface:I_EhrAccess// TODO: keep! likely to be used by EHR controller retrieve an Ehr for a subject identification by external reference
a subject identification consists of the issuer identification (ex. NHS) and an identification code- Parameters:
domainAccess- SQL accesssubjectId- the subject code or numberissuerSpace- the namespace- Returns:
- UUID of corresponding Ehr or null
- Throws:
IllegalArgumentException- if retrieving failed for given input
-
retrieveInstanceByStatus
public static I_EhrAccess retrieveInstanceByStatus(I_DomainAccess domainAccess, UUID ehrId, UUID status, Integer version) -
retrieveInstance
Description copied from interface:I_EhrAccessRetrieve the Ehr entry from its ID (incl latest STATUS).- Parameters:
domainAccess- SQL accessehrId- the Ehr UUID- Returns:
- UUID of corresponding Ehr or null
- Throws:
IllegalArgumentException- when either no EHR for ID, or problem with data structure of EHR, or DB inconsistency
-
fetchSubjectIdentifiers
Description copied from interface:I_EhrAccessretrieve the list of identifiers for a subject owning an Ehr
the identifiers are formatted as: "CODE:ISSUER"- Parameters:
domainAccess- SQL accessehrId- the Ehr Id to search the subject from- Returns:
- a list of identifiers
- Throws:
IllegalArgumentException- when no EHR found for ID
-
getCompositionList
public static Map<String,Map<String, getCompositionListString>> (I_DomainAccess domainAccess, UUID ehrId) FIXME: check this method. appears to be needed later on. problematic: it actually gets a list of entries, not compositions. why only with three attributes? what about the unique key problem below?- Returns:
- Throws:
IllegalArgumentException- when no EHR found for ID
-
getDataAccess
- Specified by:
getDataAccessin interfaceI_DomainAccess
-
setAccess
Description copied from interface:I_EhrAccessset access id- Specified by:
setAccessin interfaceI_EhrAccess- Parameters:
access- UUID
-
setSystem
Description copied from interface:I_EhrAccessset system Id- Specified by:
setSystemin interfaceI_EhrAccess- Parameters:
system- UUID
-
setModifiable
- Specified by:
setModifiablein interfaceI_EhrAccess
-
setArchetypeNodeId
- Specified by:
setArchetypeNodeIdin interfaceI_EhrAccess
-
getArchetypeNodeId
- Specified by:
getArchetypeNodeIdin interfaceI_EhrAccess
-
setName
public void setName(com.nedap.archie.rm.datavalues.DvText name) - Specified by:
setNamein interfaceI_EhrAccess
-
setName
public void setName(com.nedap.archie.rm.datavalues.DvCodedText name) - Specified by:
setNamein interfaceI_EhrAccess
-
setQueryable
- Specified by:
setQueryablein interfaceI_EhrAccess
-
commit
Description copied from interface:I_SimpleCRUDstoreComposition a new entry in the DB- Specified by:
commitin interfaceI_SimpleCRUD- Returns:
- the UUID of the newly created record
- Throws:
InvalidApiParameterException- when input couldn't be processed, i.e. EHR not stored
-
commit
Deprecated.Description copied from interface:I_SimpleCRUDstoreComposition a new entry in the DB, using a default transaction time
only implemented with "root" tables: ehr, contribution and composition!- Specified by:
commitin interfaceI_SimpleCRUD- Returns:
- the UUID of the newly created record
- Throws:
InternalServerException- because inherited interface function isn't implemented in this class
-
commit
- Specified by:
commitin interfaceI_EhrAccess- Throws:
IllegalArgumentException- when EHR couldn't be stored
-
update
updateComposition the current entry
depending on the implementation, records are updated only if one or more field(s) have been changed- Specified by:
updatein interfaceI_SimpleCRUD- Returns:
- Throws:
InvalidApiParameterException- when marshalling of EHR_STATUS / OTHER_DETAILS failed
-
update
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:
updatein interfaceI_SimpleCRUD- Returns:
- Throws:
InvalidApiParameterException- when marshalling of EHR_STATUS / OTHER_DETAILS failed
-
update
Deprecated.Description copied from interface:I_SimpleCRUDupdateComposition 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:
updatein interfaceI_SimpleCRUD- Returns:
- Throws:
InternalServerException- because inherited interface function isn't implemented in this class
-
update
Deprecated.Description copied from interface:I_SimpleCRUDupdateComposition 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:
updatein interfaceI_SimpleCRUD- Returns:
- Throws:
InternalServerException- because inherited interface function isn't implemented in this class
-
update
public Boolean update(UUID committerId, UUID systemId, UUID contributionId, ContributionDef.ContributionState state, I_ConceptAccess.ContributionChangeType contributionChangeType, String description, UUID audit) Description copied from interface:I_EhrAccessUpdates the whole EHR access in the DB, e.g. to update the status. Embeds contribution and audit handling.- Specified by:
updatein interfaceI_EhrAccess- Parameters:
committerId- ID of committersystemId- ID of committing systemcontributionId- Optional custom contribution ID, can be nullstate- State of contributioncontributionChangeType- Change type of contributiondescription- Description field- Returns:
- True for success
-
delete
Deprecated.Description copied from interface:I_SimpleCRUDdelete the Versioned Object associated with the instance implementing this Data Access Interface. Relies on ON DELETE CASCADE- Specified by:
deletein interfaceI_SimpleCRUD- Returns:
- Throws:
InternalServerException- because inherited interface function isn't implemented in this class
-
reload
Description copied from interface:I_EhrAccessTODO: doc or is this one really not needed anymore? delete if so.- Specified by:
reloadin interfaceI_EhrAccess- Returns:
- Throws:
IllegalArgumentException- when instance's EHR ID can't be matched to existing one
-
retrieve
-
getEhrRecord
- Specified by:
getEhrRecordin interfaceI_EhrAccess
-
isNew
public boolean isNew()Description copied from interface:I_EhrAccesscheck if Ehr is newly created (uncommitted)- Specified by:
isNewin interfaceI_EhrAccess- Returns:
- true if new, false otherwise
-
getParty
- Specified by:
getPartyin interfaceI_EhrAccess
-
setParty
- Specified by:
setPartyin interfaceI_EhrAccess
-
getId
- Specified by:
getIdin interfaceI_EhrAccess
-
isModifiable
- Specified by:
isModifiablein interfaceI_EhrAccess
-
isQueryable
- Specified by:
isQueryablein interfaceI_EhrAccess
-
getSystemId
- Specified by:
getSystemIdin interfaceI_EhrAccess
-
getStatusId
- Specified by:
getStatusIdin interfaceI_EhrAccess
-
getAccessId
- Specified by:
getAccessIdin interfaceI_EhrAccess
-
setOtherDetails
public void setOtherDetails(com.nedap.archie.rm.datastructures.ItemStructure otherDetails, String templateId) - Specified by:
setOtherDetailsin interfaceI_EhrAccess
-
getOtherDetails
public com.nedap.archie.rm.datastructures.ItemStructure getOtherDetails()- Specified by:
getOtherDetailsin interfaceI_EhrAccess
-
getContributionAccess
-
setContributionAccess
- Specified by:
setContributionAccessin interfaceI_EhrAccess
-
getStatusAccess
- Specified by:
getStatusAccessin interfaceI_EhrAccess
-
setStatusAccess
- Specified by:
setStatusAccessin interfaceI_EhrAccess
-
setStatus
public void setStatus(com.nedap.archie.rm.ehr.EhrStatus status) - Specified by:
setStatusin interfaceI_EhrAccess
-
getStatus
public com.nedap.archie.rm.ehr.EhrStatus getStatus()Description copied from interface:I_EhrAccessGets latest EHR_STATUS, which is attached to this EHR instance after retrieving it.- Specified by:
getStatusin interfaceI_EhrAccess- Returns:
- Latest EHR_STATUS
-
adminDeleteEhr
public void adminDeleteEhr()Description copied from interface:I_EhrAccessInvoke physical deletion.- Specified by:
adminDeleteEhrin interfaceI_EhrAccess
-
hasEhr
Description copied from interface:I_EhrAccessCheck for existence of given ID as EHR.- Parameters:
domainAccess- ContextehrId- EHR ID to check- Returns:
- true or false
-
isModifiable
Description copied from interface:I_EhrAccessCheck if the EHR identified by the given ID is marked as modifiable. Use this method if you do not need a full I_EhrAccess instance.- Parameters:
domainAccess- ContextehrId- EHR ID to check- Returns:
- true if EHR.ehr_status.isModifiable, false if not, null if EHR does not exist
-