Package org.ehrbase.api.service
Interface CompositionService
- All Superinterfaces:
BaseService,VersionedObjectService<com.nedap.archie.rm.composition.Composition,UUID>
public interface CompositionService
extends BaseService, 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 a valid composition ID.static org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionDtogetLastVersionNumber(UUID compositionId) 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 composition) Gets revision history of given composition.getTemplateIdFromInputComposition(String content, org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionFormat format) Helper function to read the template ID from given composition input in stated format.getVersionByTimestamp(UUID compositionId, LocalDateTime timestamp) Gets the version of a composition that is closest in time before timestampcom.nedap.archie.rm.ehr.VersionedCompositiongetVersionedComposition(UUID ehrUid, UUID composition) 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.Methods inherited from interface org.ehrbase.api.service.BaseService
getServerConfig, getSystemUuid
-
Method Details
-
retrieve
Optional<com.nedap.archie.rm.composition.Composition> retrieve(UUID ehrId, UUID compositionId, Integer version) - Parameters:
compositionId- TheUUIDof the composition to be returned.ehrId- TheUUIDof the ehr wich contains the compositionversion- The version to returned. If null return the latest- Returns:
- Throws:
InternalServerException
-
from
static org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionDto from(UUID ehrId, com.nedap.archie.rm.composition.Composition composition) -
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
-
getTemplateIdFromInputComposition
String getTemplateIdFromInputComposition(String content, org.ehrbase.openehr.sdk.response.dto.ehrscape.CompositionFormat format) Helper function to read the template ID from given composition input in stated format.- Parameters:
content- Composition inputformat- Composition format- Returns:
- The UUID or null when not available.
-
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 a valid composition ID.- Parameters:
versionedObjectId- ID to check- Returns:
- True if ID exists
- Throws:
ObjectNotFoundException- if ID does not exist
-
isDeleted
Checks if given composition ID is ID of a logically deleted composition.- Parameters:
versionedObjectId- ID to check- 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
Gets version container Composition associated with given EHR and Composition ID.- Parameters:
ehrUid- Given EHR IDcomposition- Given Composition ID- Returns:
- Version container object
-
getRevisionHistoryOfVersionedComposition
com.nedap.archie.rm.generic.RevisionHistory getRevisionHistoryOfVersionedComposition(UUID ehrUid, UUID composition) Gets revision history of given composition.- Parameters:
composition- 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
-
getEhrId
-