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());
}
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;
}
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);
}
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());
}
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);
}
Aggregations