use of org.ehrbase.client.openehrclient.OpenEhrClient in project fhir-bridge by ehrbase.
the class CompositionComponent method doInit.
@Override
protected void doInit() throws Exception {
if (configuration.getOpenEhrClient() == null && isAllowAutoWiredOpenEhrClient()) {
Set<OpenEhrClient> beans = getCamelContext().getRegistry().findByType(OpenEhrClient.class);
if (beans.size() == 1) {
OpenEhrClient client = beans.iterator().next();
configuration.setOpenEhrClient(client);
} else if (beans.size() > 1) {
LOG.debug("Cannot autowire OpenEhrClient as {} instances found in registry.", beans.size());
}
}
super.doStart();
}
use of org.ehrbase.client.openehrclient.OpenEhrClient in project openEHR_SDK by ehrbase.
the class DefaultRestCompositionEndpointIT method testSaveCompositionWithDefaultEntity.
@Test
public void testSaveCompositionWithDefaultEntity() throws URISyntaxException {
openEhrClient = setupDefaultRestClientWithDefaultProvider(o -> {
DefaultValues defaultValues = new DefaultValues();
defaultValues.addDefaultValue(DefaultValuePath.END_TIME, OffsetDateTime.of(2019, 05, 03, 22, 00, 00, 00, ZoneOffset.UTC));
Participation participation = new Participation(new PartyIdentified(null, "Dr. Peter", null), new DvText("Performer"), ParticipationMode.PHYSICALLY_PRESENT.toCodedText(), null);
defaultValues.addDefaultValue(DefaultValuePath.PARTICIPATION, new ArrayList<>(Collections.singleton(participation)));
return defaultValues;
});
ehr = openEhrClient.ehrEndpoint().createEhr();
EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV0 = TestData.buildEhrbaseBloodPressureSimpleDeV0WithEmptyFields();
// Not set during creation
assertThat(bloodPressureSimpleDeV0.getEndTimeValue()).isNull();
assertThat(bloodPressureSimpleDeV0.getParticipations()).isEmpty();
// during saving default values will be set
bloodPressureSimpleDeV0 = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(bloodPressureSimpleDeV0);
assertThat(bloodPressureSimpleDeV0.getEndTimeValue()).isEqualTo(OffsetDateTime.of(2019, 05, 03, 22, 00, 00, 00, ZoneOffset.UTC));
assertThat(bloodPressureSimpleDeV0.getParticipations()).extracting(p -> ((PartyIdentified) p.getPerformer()).getName(), p -> p.getMode().getValue()).containsExactlyInAnyOrder(new Tuple("Dr. Peter", "physically present"));
}
Aggregations