Package org.ehrbase.api.service
Interface CompositionService
- All Superinterfaces:
VersionedObjectService<com.nedap.archie.rm.composition.Composition,UUID>
public interface CompositionService
extends VersionedObjectService<com.nedap.archie.rm.composition.Composition,UUID>
-
Method Summary
Modifier and TypeMethodDescriptionvoidadminDelete(UUID compositionId) Admin method to delete a Composition from the DB.com.nedap.archie.rm.composition.CompositionbuildComposition(String content, org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionFormat format, String templateId) booleanChecks if given ID is already used.static org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionDtogetEhrIdForComposition(UUID compositionId) Gets the EHR id for the given Composition id.intgetLastVersionNumber(UUID ehrId, UUID compositionId) Retrieve the latest version number for the given composition ID.Optional<com.nedap.archie.rm.changecontrol.OriginalVersion<com.nedap.archie.rm.composition.Composition>> getOriginalVersionComposition(UUID ehrUid, UUID versionedObjectUid, int version) Gets Original Version container class representation of the given composition at given version.com.nedap.archie.rm.generic.RevisionHistorygetRevisionHistoryOfVersionedComposition(UUID ehrUid, UUID compositionId) Gets revision history of given composition.intgetVersionByTimestamp(UUID compositionId, OffsetDateTime timestamp) Gets the version of a composition that is closest in time before timestampcom.nedap.archie.rm.ehr.VersionedCompositiongetVersionedComposition(UUID ehrUid, UUID compositionId) Gets version container Composition associated with given EHR and Composition ID.booleanChecks if given composition ID is ID of a logically deleted composition.Optional<com.nedap.archie.rm.composition.Composition> retrieveTemplateId(UUID compositionId) Retrieves the template ID associated with a given composition ID.org.ehrbase.openehr.sdk.response.dto.ehrscape.StructuredStringserialize(org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionDto composition, org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionFormat format) Public serializer entry point which will be called with composition dto fetched from database and the desired target serialized string format.
-
Method Details
-
from
static org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionDto from(UUID ehrId, com.nedap.archie.rm.composition.Composition composition) -
retrieve
Optional<com.nedap.archie.rm.composition.Composition> retrieve(UUID ehrId, UUID compositionId, Integer version) - Parameters:
ehrId- TheUUIDof the ehr wich contains the compositioncompositionId- TheUUIDof the composition to be returned.version- The version to returned. If null return the latest- Returns:
- Throws:
InternalServerException
-
serialize
org.ehrbase.openehr.sdk.response.dto.ehrscape.StructuredString serialize(org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionDto composition, org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionFormat format) Public serializer entry point which will be called with composition dto fetched from database and the desired target serialized string format. Will parse the composition dto into target format either with a custom lambda expression for desired target format- Parameters:
composition- Composition dto from databaseformat- Target format- Returns:
- Structured string with string of data and content format
-
getLastVersionNumber
Retrieve the latest version number for the given composition ID.- Parameters:
compositionId- TheUUIDof the composition to be returned.- Returns:
- latestVersion of the existing composition.
-
retrieveTemplateId
Retrieves the template ID associated with a given composition ID.- Parameters:
compositionId- The UUID of the composition for which to retrieve the template ID- Returns:
- The template ID associated with the given composition ID
-
getVersionByTimestamp
Gets the version of a composition that is closest in time before timestamp- Parameters:
compositionId- UUID (versioned_object_id) of compositiontimestamp- Given time- Returns:
- Version closest in time before given timestamp, or `null` in case of error.
-
exists
Checks if given ID is already used.- Parameters:
versionedObjectId- ID to check- Returns:
- if ID already exists
-
isDeleted
Checks if given composition ID is ID of a logically deleted composition.- Parameters:
ehrId- EHRid to delete composition forversionedObjectId- ID to checkversion- Version to delete, option uses head as default- Returns:
- True if deleted, false if not
-
adminDelete
Admin method to delete a Composition from the DB. See EHRbase Admin API specification for details.- Parameters:
compositionId- Composition to delete
-
getVersionedComposition
com.nedap.archie.rm.ehr.VersionedComposition getVersionedComposition(UUID ehrUid, UUID compositionId) Gets version container Composition associated with given EHR and Composition ID.- Parameters:
ehrUid- Given EHR IDcompositionId- Given Composition ID- Returns:
- Version container object
-
getRevisionHistoryOfVersionedComposition
com.nedap.archie.rm.generic.RevisionHistory getRevisionHistoryOfVersionedComposition(UUID ehrUid, UUID compositionId) Gets revision history of given composition.- Parameters:
compositionId- Given composition.- Returns:
- Revision history
-
getOriginalVersionComposition
Optional<com.nedap.archie.rm.changecontrol.OriginalVersion<com.nedap.archie.rm.composition.Composition>> getOriginalVersionComposition(UUID ehrUid, UUID versionedObjectUid, int version) Gets Original Version container class representation of the given composition at given version.- Parameters:
versionedObjectUid- Given composition Uid.version- Given version number.- Returns:
- Original Version container class representation.
-
buildComposition
-
getEhrIdForComposition
Gets the EHR id for the given Composition id.- Parameters:
compositionId- Given composition Uid.- Returns:
- EHR UID for the given Composition
-