Search in sources :

Example 1 with RevisionHistoryItem

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);
}
Also used : RevisionHistoryItem(com.nedap.archie.rm.generic.RevisionHistoryItem) ArrayList(java.util.ArrayList) ObjectVersionId(com.nedap.archie.rm.support.identification.ObjectVersionId) AuditDetails(com.nedap.archie.rm.generic.AuditDetails) Attestation(com.nedap.archie.rm.generic.Attestation)

Example 2 with RevisionHistoryItem

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());
}
Also used : EhrbaseMultiOccurrenceDeV1Composition(org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition) VersionUid(org.ehrbase.client.openehrclient.VersionUid) RevisionHistoryItem(com.nedap.archie.rm.generic.RevisionHistoryItem) Test(org.junit.Test)

Aggregations

RevisionHistoryItem (com.nedap.archie.rm.generic.RevisionHistoryItem)2 Attestation (com.nedap.archie.rm.generic.Attestation)1 AuditDetails (com.nedap.archie.rm.generic.AuditDetails)1 ObjectVersionId (com.nedap.archie.rm.support.identification.ObjectVersionId)1 ArrayList (java.util.ArrayList)1 EhrbaseMultiOccurrenceDeV1Composition (org.ehrbase.client.classgenerator.examples.ehrbasemultioccurrencedev1composition.EhrbaseMultiOccurrenceDeV1Composition)1 VersionUid (org.ehrbase.client.openehrclient.VersionUid)1 Test (org.junit.Test)1