Package org.ehrbase.dao.access.jooq
Class ContextAccess
- java.lang.Object
-
- org.ehrbase.dao.access.support.DataAccess
-
- org.ehrbase.dao.access.jooq.ContextAccess
-
- All Implemented Interfaces:
I_ContextAccess,I_DomainAccess,I_SimpleCRUD
public class ContextAccess extends DataAccess implements I_ContextAccess
- Since:
- 1.0
- Author:
- Christian Chevalley, Jake Smolka, Luis Marco-Ruiz
-
-
Field Summary
-
Fields 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_POOL
-
-
Constructor Summary
Constructors Constructor Description ContextAccess(org.jooq.DSLContext context, ServerConfig serverConfig, com.nedap.archie.rm.composition.EventContext eventContext)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description UUIDcommit()storeComposition a new entry in the DB, using a default transaction time
only implemented with "root" tables: ehr, contribution and composition!UUIDcommit(Timestamp transactionTime)storeComposition a new entry in the DBIntegerdelete()delete the Versioned Object associated with the instance implementing this Data Access Interface.DataAccessgetDataAccess()UUIDgetId()StringgetOtherContextJson()Retrieves otherContext from event context record, which is represented as json blob in the DB.booleanisVoid()com.nedap.archie.rm.composition.EventContextmapRmEventContext()Creates an EventContext object from already set record data of an already existing ContextAccess instance.static com.nedap.archie.rm.composition.EventContextretrieveHistoricalEventContext(I_DomainAccess domainAccess, UUID compositionId, Timestamp transactionTime)Retrieves an EventContext for a specific historical time.static I_ContextAccessretrieveInstance(I_DomainAccess domainAccess, UUID id)retrieve an Event Context access layer instance from the DBstatic I_ContextAccessretrieveInstance(I_DomainAccess domainAccess, org.jooq.Result<?> records)voidsetCompositionId(UUID compositionId)voidsetRecordFields(UUID id, com.nedap.archie.rm.composition.EventContext eventContext)setup an EventContextRecord instance based on values from an EventContext instanceBooleanupdate()Deprecated.Booleanupdate(Boolean force)Deprecated.Booleanupdate(Timestamp transactionTime)updateComposition the current entry
depending on the implementation, records are updated only if one or more field(s) have been changedBooleanupdate(Timestamp transactionTime, boolean force)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.-
Methods inherited from class org.ehrbase.dao.access.support.DataAccess
getConnection, getContext, getDialect, getIntrospectService, getKnowledgeManager, getServerConfig, releaseConnection
-
-
-
-
Constructor Detail
-
ContextAccess
public ContextAccess(org.jooq.DSLContext context, ServerConfig serverConfig, com.nedap.archie.rm.composition.EventContext eventContext)
-
-
Method Detail
-
retrieveInstance
public static I_ContextAccess retrieveInstance(I_DomainAccess domainAccess, UUID id)
Description copied from interface:I_ContextAccessretrieve an Event Context access layer instance from the DB- Parameters:
domainAccess- SQL contextid- the event context id- Returns:
- an interface to the access layer
-
retrieveInstance
public static I_ContextAccess retrieveInstance(I_DomainAccess domainAccess, org.jooq.Result<?> records)
-
retrieveHistoricalEventContext
public static com.nedap.archie.rm.composition.EventContext retrieveHistoricalEventContext(I_DomainAccess domainAccess, UUID compositionId, Timestamp transactionTime)
Description copied from interface:I_ContextAccessRetrieves an EventContext for a specific historical time.- Parameters:
domainAccess- Access objectcompositionId- ID of composition the context is connected totransactionTime- Historical time of the context- Returns:
- New
EventContextobject matching the given time or null if not available. - Throws:
InternalServerException- on failure of decoding DvText or DvDateTime
-
setRecordFields
public void setRecordFields(UUID id, com.nedap.archie.rm.composition.EventContext eventContext)
setup an EventContextRecord instance based on values from an EventContext instance- Specified by:
setRecordFieldsin interfaceI_ContextAccess- Parameters:
id-eventContext-
-
commit
public UUID commit(Timestamp transactionTime)
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:
InternalServerException- when database operation orIllegalArgumentException- when context commit failed
-
commit
public UUID commit()
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- when database operation orIllegalArgumentException- when context commit failed
-
update
public Boolean update(Timestamp transactionTime)
Description copied from interface:I_SimpleCRUDupdateComposition 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:
InternalServerException- if DB inconsistency or other problem with updating DB entry
-
update
public Boolean update(Timestamp transactionTime, boolean force)
Description copied from interface:I_SimpleCRUDupdateComposition 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:
InternalServerException- when update failed
-
update
@Deprecated public Boolean 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 public Boolean update(Boolean force)
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
-
delete
public Integer delete()
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:
-
mapRmEventContext
public com.nedap.archie.rm.composition.EventContext mapRmEventContext()
Description copied from interface:I_ContextAccessCreates an EventContext object from already set record data of an already existing ContextAccess instance.- Specified by:
mapRmEventContextin interfaceI_ContextAccess- Returns:
EventContextobject representing this instance's data- Throws:
InternalServerException- on failure of decoding DvText or DvDateTime
-
getOtherContextJson
public String getOtherContextJson()
Description copied from interface:I_ContextAccessRetrieves otherContext from event context record, which is represented as json blob in the DB.- Specified by:
getOtherContextJsonin interfaceI_ContextAccess- Returns:
- Json representation of otherContext
-
setCompositionId
public void setCompositionId(UUID compositionId)
- Specified by:
setCompositionIdin interfaceI_ContextAccess
-
getId
public UUID getId()
- Specified by:
getIdin interfaceI_ContextAccess
-
isVoid
public boolean isVoid()
- Specified by:
isVoidin interfaceI_ContextAccess
-
getDataAccess
public DataAccess getDataAccess()
- Specified by:
getDataAccessin interfaceI_DomainAccess
-
-