use of com.nedap.archie.rm.generic.RevisionHistoryItem in project ehrbase by ehrbase.
the class CompositionServiceImp method revisionHistoryItemFromComposition.
private RevisionHistoryItem revisionHistoryItemFromComposition(OriginalVersion<Composition> composition) {
ObjectVersionId objectVersionId = composition.getUid();
// Note: is List but only has more than one item when there are contributions regarding this
// object of change type attestation
List<AuditDetails> auditDetailsList = new ArrayList<>();
// retrieving the audits
auditDetailsList.add(composition.getCommitAudit());
// add retrieval of attestations, if there are any
if (composition.getAttestations() != null) {
for (Attestation a : composition.getAttestations()) {
AuditDetails newAudit = new AuditDetails(a.getSystemId(), a.getCommitter(), a.getTimeCommitted(), a.getChangeType(), a.getDescription());
auditDetailsList.add(newAudit);
}
}
return new RevisionHistoryItem(objectVersionId, auditDetailsList);
}
use of com.nedap.archie.rm.generic.RevisionHistoryItem in project openEHR_SDK by ehrbase.
the class DefaultRestVersionedCompositionEndpointIT method testFindRevisionHistoryValid.
@Test
public void testFindRevisionHistoryValid() {
ehrId = openEhrClient.ehrEndpoint().createEhr();
EhrbaseMultiOccurrenceDeV1Composition composition = TestData.buildEhrbaseMultiOccurrenceDeV1();
VersionUid v1 = openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition).getVersionUid();
VersionUid v2 = openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition).getVersionUid();
VersionUid v3 = openEhrClient.compositionEndpoint(ehrId).mergeCompositionEntity(composition).getVersionUid();
List<RevisionHistoryItem> revisionHistory = openEhrClient.versionedCompositionEndpoint(ehrId).findRevisionHistory(composition.getVersionUid().getUuid());
Assert.assertEquals(3, revisionHistory.size());
Assert.assertEquals(v1.toString(), revisionHistory.get(0).getVersionId().getValue());
Assert.assertEquals(v2.toString(), revisionHistory.get(1).getVersionId().getValue());
Assert.assertEquals(v3.toString(), revisionHistory.get(2).getVersionId().getValue());
}
Aggregations