Search in sources :

Example 11 with PartyRef

use of com.nedap.archie.rm.support.identification.PartyRef in project openEHR_SDK by ehrbase.

the class DefaultRestEhrFieldsEndpointIT method testUpdateEhrStatus.

@Test
public void testUpdateEhrStatus() throws IOException {
    ehr = openEhrClient.ehrEndpoint().createEhr();
    EhrStatus ehrStatus = openEhrClient.ehrEndpoint().getEhrStatus(ehr).get();
    ehrStatus.setQueryable(false);
    ehrStatus.setModifiable(false);
    HierObjectId subjectId = new HierObjectId("6ee110de-08f8-4fac-8372-820650f150a9");
    ehrStatus.setSubject(new PartySelf(new PartyRef(subjectId, "default", "PERSON")));
    String value = IOUtils.toString(ItemStruktureTestDataCanonicalJson.SIMPLE_EHR_OTHER_Details.getStream(), UTF_8);
    ehrStatus.setOtherDetails(new CanonicalJson().unmarshal(value, ItemTree.class));
    ehrStatus.getOtherDetails().setArchetypeNodeId("other-details-test");
    ehrStatus.getOtherDetails().setName(new DvText("test"));
    openEhrClient.ehrEndpoint().updateEhrStatus(ehr, ehrStatus);
    EhrStatus actual = openEhrClient.ehrEndpoint().getEhrStatus(ehr).get();
    assertThat(actual.getSubject().getExternalRef().getId()).isEqualTo(subjectId);
    assertThat(actual.isModifiable()).isEqualTo(ehrStatus.isModifiable());
    assertThat(actual.isQueryable()).isEqualTo(ehrStatus.isQueryable());
    assertThat(actual.getOtherDetails()).isNotNull();
    assertThat(actual.getOtherDetails().getItems()).size().isEqualTo(ehrStatus.getOtherDetails().getItems().size());
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) ItemStruktureTestDataCanonicalJson(org.ehrbase.test_data.item_structure.ItemStruktureTestDataCanonicalJson) EhrStatus(com.nedap.archie.rm.ehr.EhrStatus) ItemTree(com.nedap.archie.rm.datastructures.ItemTree) HierObjectId(com.nedap.archie.rm.support.identification.HierObjectId) PartySelf(com.nedap.archie.rm.generic.PartySelf) DvText(com.nedap.archie.rm.datavalues.DvText) Test(org.junit.Test)

Example 12 with PartyRef

use of com.nedap.archie.rm.support.identification.PartyRef in project openEHR_SDK by ehrbase.

the class ParticipationConfig method buildChildValues.

/**
 * {@inheritDoc}
 */
@Override
public Map<String, Object> buildChildValues(String currentTerm, Participation rmObject, Context<Map<String, Object>> context) {
    Map<String, Object> result = new HashMap<>();
    addValue(result, currentTerm, "id", Optional.of(rmObject).map(Participation::getPerformer).map(PartyProxy::getExternalRef).map(ObjectRef::getId).map(ObjectId::getValue).orElse(null));
    addValue(result, currentTerm, "id_namespace", Optional.of(rmObject).map(Participation::getPerformer).map(PartyProxy::getExternalRef).map(ObjectRef::getNamespace).orElse(null));
    addValue(result, currentTerm, "id_scheme", Optional.of(rmObject).map(Participation::getPerformer).map(PartyProxy::getExternalRef).map(PartyRef::getId).filter(cls -> GenericId.class.isAssignableFrom(cls.getClass())).map(GenericId.class::cast).map(GenericId::getScheme).orElse(null));
    addValue(result, currentTerm, "name", Optional.of(rmObject).map(Participation::getPerformer).filter(p -> PartyIdentified.class.isAssignableFrom(p.getClass())).map(PartyIdentified.class::cast).map(PartyIdentified::getName).orElse(null));
    addValue(result, currentTerm, "mode", Optional.of(rmObject).map(Participation::getMode).map(DvText::getValue).orElse(null));
    addValue(result, currentTerm, "function", Optional.of(rmObject).map(Participation::getFunction).map(DvText::getValue).orElse(null));
    List<DvIdentifier> dvIdentifiers = Optional.of(rmObject).map(Participation::getPerformer).filter(p -> PartyIdentified.class.isAssignableFrom(p.getClass())).map(PartyIdentified.class::cast).map(PartyIdentified::getIdentifiers).orElse(Collections.emptyList());
    IntStream.range(0, dvIdentifiers.size()).forEach(i -> {
        DvIdentifier identifier = dvIdentifiers.get(i);
        addValue(result, currentTerm, "identifiers_id:" + i, identifier.getId());
        addValue(result, currentTerm, "identifiers_issuer:" + i, identifier.getIssuer());
        addValue(result, currentTerm, "identifiers_assigner:" + i, identifier.getAssigner());
        addValue(result, currentTerm, "identifiers_type:" + i, identifier.getType());
    });
    return result;
}
Also used : DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) IntStream(java.util.stream.IntStream) ObjectRef(com.nedap.archie.rm.support.identification.ObjectRef) Context(org.ehrbase.serialisation.walker.Context) java.util(java.util) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) PartyRef(com.nedap.archie.rm.support.identification.PartyRef) DvText(com.nedap.archie.rm.datavalues.DvText) GenericId(com.nedap.archie.rm.support.identification.GenericId) Participation(com.nedap.archie.rm.generic.Participation) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) Participation(com.nedap.archie.rm.generic.Participation) GenericId(com.nedap.archie.rm.support.identification.GenericId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) DvText(com.nedap.archie.rm.datavalues.DvText) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) ObjectRef(com.nedap.archie.rm.support.identification.ObjectRef)

Example 13 with PartyRef

use of com.nedap.archie.rm.support.identification.PartyRef in project openEHR_SDK by ehrbase.

the class CanonicalXMLTest method marshalInline.

@Test
public void marshalInline() {
    Folder folder = new Folder();
    folder.setName(new DvText("folder name"));
    folder.addItem(new PartyRef());
    CanonicalXML canonicalXML = new CanonicalXML();
    String inline = canonicalXML.marshalInline(folder, new QName(null, "folder"));
    System.out.println(inline);
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) QName(javax.xml.namespace.QName) CompositionTestDataCanonicalXML(org.ehrbase.test_data.composition.CompositionTestDataCanonicalXML) Folder(com.nedap.archie.rm.directory.Folder) DvText(com.nedap.archie.rm.datavalues.DvText) Test(org.junit.Test)

Example 14 with PartyRef

use of com.nedap.archie.rm.support.identification.PartyRef in project openEHR_SDK by ehrbase.

the class ItemStructureVisitorTest method ehrVisitorTest.

@Test
public void ehrVisitorTest() throws Throwable {
    String value = IOUtils.toString(ItemStruktureTestDataCanonicalJson.SIMPLE_EHR_OTHER_Details.getStream(), UTF_8);
    RMJacksonConfiguration configuration = new RMJacksonConfiguration();
    configuration.setTypePropertyName("_type");
    ObjectMapper objectMapper = JacksonUtil.getObjectMapper(configuration);
    ItemTree otherDetails = objectMapper.readValue(value, ItemTree.class);
    EhrStatus ehrStatus = new EhrStatus("ehr_status", new DvText("ehr_status"), new PartySelf(new PartyRef()), true, true, otherDetails);
    itemStructureVisitor.validate(ehrStatus);
    assertEquals(3, itemStructureVisitor.getElementOccurrences());
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) EhrStatus(com.nedap.archie.rm.ehr.EhrStatus) ItemTree(com.nedap.archie.rm.datastructures.ItemTree) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) RMJacksonConfiguration(com.nedap.archie.json.RMJacksonConfiguration) DvText(com.nedap.archie.rm.datavalues.DvText) PartySelf(com.nedap.archie.rm.generic.PartySelf) Test(org.junit.Test)

Example 15 with PartyRef

use of com.nedap.archie.rm.support.identification.PartyRef in project ehrbase by ehrbase.

the class EventContextFactory method makeNull.

public EventContext makeNull() {
    PartyRef partyRef = new PartyRef(new HierObjectId("ref"), "null", "null");
    PartyIdentified healthcareFacility = new PartyIdentified(partyRef, "null", null);
    DvCodedText concept = new DvCodedText("Other Care", new CodePhrase(new TerminologyId("openehr"), "238"));
    return new EventContext(healthcareFacility, new DvDateTime(new DateTime(0L).toString()), null, null, null, concept, null);
}
Also used : PartyRef(com.nedap.archie.rm.support.identification.PartyRef) EventContext(com.nedap.archie.rm.composition.EventContext) TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) HierObjectId(com.nedap.archie.rm.support.identification.HierObjectId) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) DateTime(org.joda.time.DateTime) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)

Aggregations

PartyRef (com.nedap.archie.rm.support.identification.PartyRef)19 DvText (com.nedap.archie.rm.datavalues.DvText)9 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)8 PartySelf (com.nedap.archie.rm.generic.PartySelf)8 GenericId (com.nedap.archie.rm.support.identification.GenericId)8 EhrStatus (com.nedap.archie.rm.ehr.EhrStatus)7 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)6 ObjectId (com.nedap.archie.rm.support.identification.ObjectId)5 Test (org.junit.Test)4 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)3 EventContext (com.nedap.archie.rm.composition.EventContext)2 ItemTree (com.nedap.archie.rm.datastructures.ItemTree)2 CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)2 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)2 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)2 Participation (com.nedap.archie.rm.generic.Participation)2 TerminologyId (com.nedap.archie.rm.support.identification.TerminologyId)2 URI (java.net.URI)2 UUID (java.util.UUID)2 DateTime (org.joda.time.DateTime)2