Package org.ehrbase.api.service
Interface CompositionService
-
- All Superinterfaces:
BaseService
public interface CompositionService extends BaseService
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description UUIDcreate(UUID ehrId, com.nedap.archie.rm.composition.Composition composition, UUID contributionId)Creates a composition which will be connected to the given existing contribution.UUIDcreate(UUID ehrId, String content, CompositionFormat format)Overloaded wrapper function to create composition with minimal set of input.UUIDcreate(UUID ehrId, String content, CompositionFormat format, String templateId, UUID linkUid)Creates a deserialized representation of the composition data from source format and stores these data into the corresponding tables.LocalDateTimedelete(UUID compositionId)Deletes a composition, i.e.LocalDateTimedelete(UUID compositionId, UUID contributionId)Deletes a composition which will be connected to the given existing contribution.booleanexists(UUID versionedObjectId)Checks if given ID is a valid composition ID.IntegergetLastVersionNumber(UUID compositionId)StringgetUidFromInputComposition(String content, CompositionFormat format)Helper function to read UUID from given composition input in stated format.IntegergetVersionByTimestamp(UUID compositionId, LocalDateTime timestamp)Gets the version of a composition that is closest in time before timestampbooleanisDeleted(UUID versionedObjectId)Checks if given composition ID is ID of a logically deleted composition.Optional<CompositionDto>retrieve(UUID compositionId, Integer version)Optional<CompositionDto>retrieveByTimestamp(UUID compositionId, LocalDateTime timestamp)TODO: untested because not needed, yet Gets the composition that is closest in time before timestampStructuredStringserialize(CompositionDto composition, CompositionFormat format)Public serializer entry point which will be called with composition dto fetched from database and the desired target serialized string format.Stringupdate(UUID compositionId, com.nedap.archie.rm.composition.Composition composition, UUID contributionId)Updates a composition which will be connected to the given existing contribution.Stringupdate(UUID compositionId, CompositionFormat format, String content)Overloaded wrapper function to update composition with minimal set of input.Stringupdate(UUID compositionId, CompositionFormat format, String content, String templateId)Updates an existing composition entry with new data.-
Methods inherited from interface org.ehrbase.api.service.BaseService
getServerConfig, getSystemUuid
-
-
-
-
Method Detail
-
retrieve
Optional<CompositionDto> retrieve(UUID compositionId, Integer version)
- Parameters:
compositionId- TheUUIDof the composition to be returned.version- The version to returned. If null return the latest- Returns:
- Throws:
InternalServerException
-
retrieveByTimestamp
Optional<CompositionDto> retrieveByTimestamp(UUID compositionId, LocalDateTime timestamp)
TODO: untested because not needed, yet Gets the composition that is closest in time before timestamp- Parameters:
compositionId- UUID (versioned_object_id) of compositiontimestamp- Given time- Returns:
- Optional of CompositionDto closest in time before timestamp
-
serialize
StructuredString serialize(CompositionDto composition, 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
-
create
UUID create(UUID ehrId, String content, CompositionFormat format)
Overloaded wrapper function to create composition with minimal set of input. TemplateID is read from composition content.- Parameters:
ehrId- - Target EHRcontent- - String representation of contentformat- - Format of data within the string representation- Returns:
- - UUID of new created composition entry
- Throws:
InternalServerException
-
create
UUID create(UUID ehrId, String content, CompositionFormat format, String templateId, UUID linkUid)
Creates a deserialized representation of the composition data from source format and stores these data into the corresponding tables.- Parameters:
ehrId- - Target EHRcontent- - String representation of contentformat- - Format of data within the string representationtemplateId- - Template id for usage with Marand's composition converterlinkUid- - UUID of link for compo_xref entry master- Returns:
- - UUID of new created composition entry
- Throws:
InternalServerException
-
create
UUID create(UUID ehrId, com.nedap.archie.rm.composition.Composition composition, UUID contributionId)
Creates a composition which will be connected to the given existing contribution. Unlike with the general create() methods, where the contribution will be created ad hoc.- Parameters:
ehrId- Target EHRcomposition- Composition as RM objectcontributionId- ID of the contribution this composition is part of- Returns:
- UUID of newly created composition
- Throws:
InternalServerException- when creation failed
-
update
String update(UUID compositionId, CompositionFormat format, String content)
Overloaded wrapper function to update composition with minimal set of input. TemplateID is read from composition content.- Parameters:
compositionId-format-content-- Returns:
- Versioned id string of updated composition
- Throws:
InternalServerException- when updating failedObjectNotFoundException- when targeted composition couldn't be found
-
update
String update(UUID compositionId, CompositionFormat format, String content, String templateId)
Updates an existing composition entry with new data. Implicitly created new contribution ad-hoc.- Parameters:
compositionId- - Target composition UUID to updateformat- - Source format of contentcontent- - String representation of payload datatemplateId- - Corresponding template id- Returns:
- - Versioned id string of updated composition
- Throws:
InternalServerException- when updating failedObjectNotFoundException- when targeted composition couldn't be found
-
update
String update(UUID compositionId, com.nedap.archie.rm.composition.Composition composition, UUID contributionId)
Updates a composition which will be connected to the given existing contribution. Unlike with the general update() methods, where the contribution will be created ad hoc.- Parameters:
compositionId- Target composition UUID to updatecomposition- Composition as RM objectcontributionId- ID of the contribution this composition is part of- Returns:
- Versioned id string of updated composition
- Throws:
InternalServerException- when updating failedObjectNotFoundException- when targeted composition couldn't be found
-
delete
LocalDateTime delete(UUID compositionId)
Deletes a composition, i.e. creates a new version with deleted status. Return time of deletion.- Parameters:
compositionId- - Target composition UUID- Returns:
- Time of deletion on database level
- Throws:
ObjectNotFoundException- when targeted composition couldn't be foundInternalServerException- when deletion failed
-
delete
LocalDateTime delete(UUID compositionId, UUID contributionId)
Deletes a composition which will be connected to the given existing contribution. Unlike with the general delete() methods, where the contribution will be created ad hoc.- Parameters:
compositionId- Target composition UUIDcontributionId- Custom contribution UUID- Returns:
- Time of deletion, if successful
-
getUidFromInputComposition
String getUidFromInputComposition(String content, CompositionFormat format)
Helper function to read UUID from given composition input in stated format.- Parameters:
content- Composition inputformat- Composition format- Returns:
- The UUID or null when not available.
-
getVersionByTimestamp
Integer getVersionByTimestamp(UUID compositionId, LocalDateTime timestamp)
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
-
exists
boolean exists(UUID versionedObjectId)
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
boolean isDeleted(UUID versionedObjectId)
Checks if given composition ID is ID of a logically deleted composition.- Parameters:
versionedObjectId- ID to check- Returns:
- True if deleted, false if not
-
-