Package org.ehrbase.dao.access.jooq
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)Created by Christian Chevalley on 4/9/2015.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDB_INCONSISTENCY-
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 EntryAccess(I_DomainAccess domainAccess, String templateId, Integer sequence, UUID compositionId, com.nedap.archie.rm.composition.Composition composition)Constructor with convenientI_DomainAccessparameter, for better readability.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description UUIDcommit()Deprecated.UUIDcommit(Timestamp transactionTime)storeComposition a new entry in the DBIntegerdelete()delete the Versioned Object associated with the instance implementing this Data Access Interface.StringgetArchetypeId()Get the root archetype to build the compositionDvCodedTextRecordgetCategory()get the entry category record id
Category attribute is a DvCodedTextcom.nedap.archie.rm.composition.CompositiongetComposition()get the actual composition held in this entryUUIDgetCompositionId()get the composition Id owning this entryDvCodedTextRecordgetCompositionName()DataAccessgetDataAccess()org.jooq.JSONBgetEntryJson()get the entry values as a JSON stringUUIDgetId()get the entry IdStringgetItemType()get the Item Type as a literal
Item type is one of section care_entry adminStringgetRmVersion()IntegergetSequence()get the sequence number if applicableStringgetTemplateId()get the template Id (a string) used to build the composition entrystatic Map<String,Object>queryJSON(I_DomainAccess domainAccess, String queryString)perform an arbitrary SQL query on entries and return the result set as a JSON stringstatic List<I_EntryAccess>retrieveInstanceInComposition(I_DomainAccess domainAccess, I_CompositionAccess compositionAccess)retrieve the list of entries for a compositionstatic List<I_EntryAccess>retrieveInstanceInCompositionVersion(I_DomainAccess domainAccess, I_CompositionAccess compositionHistoryAccess, int version)voidsetCompositionData(com.nedap.archie.rm.composition.Composition composition)set the composition data with an actualCompositionvoidsetCompositionId(UUID compositionId)set the owner composition by its IdvoidsetCompositionName(com.nedap.archie.rm.datavalues.DvText compositionName)voidsetSequence(Integer sequence)set the sequence number of this entryvoidsetTemplateId(String templateId)set the template id to build the compositionBooleanupdate()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
-
-
-
-
Field Detail
-
DB_INCONSISTENCY
public static final String DB_INCONSISTENCY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EntryAccess
public EntryAccess(I_DomainAccess domainAccess, String templateId, Integer sequence, UUID compositionId, com.nedap.archie.rm.composition.Composition composition)
Constructor with convenientI_DomainAccessparameter, for better readability.- Parameters:
domainAccess- Current domain access objecttemplateId- Template ID of this entrysequence- Sequence number of this entrycompositionId- Linked composition IDcomposition- Object representation of linked composition
-
-
Method Detail
-
retrieveInstanceInComposition
public static List<I_EntryAccess> retrieveInstanceInComposition(I_DomainAccess domainAccess, I_CompositionAccess compositionAccess)
Description copied from interface:I_EntryAccessretrieve the list of entries for a composition- Parameters:
domainAccess- SQL contextcompositionAccess- a composition access interface instance- Returns:
- a list of
I_EntryAccess - Throws:
IllegalArgumentException- if DB is inconsistent or operation fails
-
retrieveInstanceInCompositionVersion
public static List<I_EntryAccess> retrieveInstanceInCompositionVersion(I_DomainAccess domainAccess, I_CompositionAccess compositionHistoryAccess, int version)
-
queryJSON
public static Map<String,Object> queryJSON(I_DomainAccess domainAccess, String queryString)
Description copied from interface:I_EntryAccessperform an arbitrary SQL query on entries and return the result set as a JSON string- Parameters:
domainAccess- SQL accessqueryString- 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_EntryAccessget the actual composition held in this entry- Specified by:
getCompositionin interfaceI_EntryAccess- Returns:
Composition- See Also:
Composition
-
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
-
commit
@Deprecated public UUID 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
-
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:
-
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:
-
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:
-
getId
public UUID getId()
Description copied from interface:I_EntryAccessget the entry Id- Specified by:
getIdin interfaceI_EntryAccess- Returns:
- entry ID as
UUID
-
getEntryJson
public org.jooq.JSONB getEntryJson()
Description copied from interface:I_EntryAccessget the entry values as a JSON string- Specified by:
getEntryJsonin interfaceI_EntryAccess- Returns:
- JSON representation of entry values
-
getCategory
public DvCodedTextRecord getCategory()
Description copied from interface:I_EntryAccessget the entry category record id
Category attribute is a DvCodedText- Specified by:
getCategoryin interfaceI_EntryAccess- Returns:
DvCodedTextof 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_EntryAccessget the composition Id owning this entry- Specified by:
getCompositionIdin interfaceI_EntryAccess- Returns:
- composition ID as
UUID
-
setCompositionId
public void setCompositionId(UUID compositionId)
Description copied from interface:I_EntryAccessset the owner composition by its Id- Specified by:
setCompositionIdin interfaceI_EntryAccess- Parameters:
compositionId- UUID
-
getTemplateId
public String getTemplateId()
Description copied from interface:I_EntryAccessget the template Id (a string) used to build the composition entry- Specified by:
getTemplateIdin interfaceI_EntryAccess- Returns:
- template ID as string
-
setTemplateId
public void setTemplateId(String templateId)
Description copied from interface:I_EntryAccessset the template id to build the composition- Specified by:
setTemplateIdin interfaceI_EntryAccess- Parameters:
templateId- a string
-
getSequence
public Integer getSequence()
Description copied from interface:I_EntryAccessget the sequence number if applicable- Specified by:
getSequencein interfaceI_EntryAccess- Returns:
- sequence number of entry
-
setSequence
public void setSequence(Integer sequence)
Description copied from interface:I_EntryAccessset the sequence number of this entry- Specified by:
setSequencein interfaceI_EntryAccess- Parameters:
sequence- number of this entry
-
getArchetypeId
public String getArchetypeId()
Description copied from interface:I_EntryAccessGet the root archetype to build the composition- Specified by:
getArchetypeIdin interfaceI_EntryAccess- Returns:
- archetype ID as string
-
getRmVersion
public String getRmVersion()
- Specified by:
getRmVersionin interfaceI_EntryAccess
-
getItemType
public String getItemType()
Description copied from interface:I_EntryAccessget the Item Type as a literal
Item type is one of- section
- care_entry
- admin
- Specified by:
getItemTypein interfaceI_EntryAccess- Returns:
- item type as string
-
setCompositionData
public void setCompositionData(com.nedap.archie.rm.composition.Composition composition)
Description copied from interface:I_EntryAccessset the composition data with an actualComposition- Specified by:
setCompositionDatain interfaceI_EntryAccess- Parameters:
composition- Composition- See Also:
Composition
-
getDataAccess
public DataAccess getDataAccess()
- Specified by:
getDataAccessin interfaceI_DomainAccess
-
-