use of org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition in project openEHR_SDK by ehrbase.
the class DefaultRestAqlEndpointTestIT method testExecuteEntityQueryWithList.
@Test
public void testExecuteEntityQueryWithList() {
ehr = openEhrClient.ehrEndpoint().createEhr();
EhrbaseBloodPressureSimpleDeV0Composition comp1 = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildEhrbaseBloodPressureSimpleDeV0());
EhrbaseBloodPressureSimpleDeV0Composition comp2 = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildEhrbaseBloodPressureSimpleDeV0());
EhrbaseBloodPressureSimpleDeV0CompositionContainment containmentComposition = EhrbaseBloodPressureSimpleDeV0CompositionContainment.getInstance();
EntityQuery<Record2<TemporalAccessor, List<BloodPressureTrainingSampleObservation>>> entityQuery = Query.buildEntityQuery(containmentComposition, containmentComposition.START_TIME_VALUE, containmentComposition.BLOOD_PRESSURE_TRAINING_SAMPLE);
Parameter<UUID> ehrIdParameter = entityQuery.buildParameter();
entityQuery.where(Condition.equal(EhrFields.EHR_ID(), ehrIdParameter));
List<Record2<TemporalAccessor, List<BloodPressureTrainingSampleObservation>>> actual = openEhrClient.aqlEndpoint().execute(entityQuery, ehrIdParameter.setValue(ehr));
assertThat(actual).size().isEqualTo(2);
}
use of org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition in project openEHR_SDK by ehrbase.
the class DefaultRestAqlEndpointTestIT method testExecuteEntityQuery.
@Test
public void testExecuteEntityQuery() {
ehr = openEhrClient.ehrEndpoint().createEhr();
EhrbaseBloodPressureSimpleDeV0Composition comp1 = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildEhrbaseBloodPressureSimpleDeV0());
EhrbaseBloodPressureSimpleDeV0Composition comp2 = openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(TestData.buildEhrbaseBloodPressureSimpleDeV0());
EhrbaseBloodPressureSimpleDeV0CompositionContainment containmentComposition = EhrbaseBloodPressureSimpleDeV0CompositionContainment.getInstance();
BloodPressureTrainingSampleObservationContainment containmentObservation = BloodPressureTrainingSampleObservationContainment.getInstance();
containmentComposition.setContains(containmentObservation);
EntityQuery<Record3<TemporalAccessor, BloodPressureTrainingSampleObservation, CuffSizeDefiningCode>> entityQuery = Query.buildEntityQuery(containmentComposition, containmentComposition.START_TIME_VALUE, containmentObservation.BLOOD_PRESSURE_TRAINING_SAMPLE_OBSERVATION, containmentObservation.CUFF_SIZE_DEFINING_CODE);
Parameter<UUID> ehrIdParameter = entityQuery.buildParameter();
entityQuery.where(Condition.equal(EhrFields.EHR_ID(), ehrIdParameter));
List<Record3<TemporalAccessor, BloodPressureTrainingSampleObservation, CuffSizeDefiningCode>> actual = openEhrClient.aqlEndpoint().execute(entityQuery, ehrIdParameter.setValue(ehr));
assertThat(actual).size().isEqualTo(2);
Record3<TemporalAccessor, BloodPressureTrainingSampleObservation, CuffSizeDefiningCode> record1 = actual.get(0);
assertThat(record1.value1()).isEqualTo(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
assertThat(record1.value2().getKorotkoffSoundsDefiningCode()).isEqualTo(KorotkoffSoundsDefiningCode.FIFTH_SOUND);
assertThat(record1.value3()).isEqualTo(CuffSizeDefiningCode.ADULT);
}
use of org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition in project openEHR_SDK by ehrbase.
the class DefaultRestCompositionEndpointIT method testDeleteCompositionInvalidPrecedingVersionUid.
@Test
public void testDeleteCompositionInvalidPrecedingVersionUid() {
ehr = openEhrClient.ehrEndpoint().createEhr();
CompositionEndpoint compositionEndpoint = openEhrClient.compositionEndpoint(ehr);
EhrbaseBloodPressureSimpleDeV0Composition composition = TestData.buildEhrbaseBloodPressureSimpleDeV0();
composition = compositionEndpoint.mergeCompositionEntity(composition);
composition = compositionEndpoint.mergeCompositionEntity(composition);
VersionUid precedingVersionUid = new VersionUid(composition.getVersionUid().getUuid(), composition.getVersionUid().getSystem(), 1);
assertThrows(WrongStatusCodeException.class, () -> compositionEndpoint.delete(precedingVersionUid));
}
use of org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition in project openEHR_SDK by ehrbase.
the class DefaultRestCompositionEndpointIT method testSaveCompositionEntityCgiProxy.
@Test
public void testSaveCompositionEntityCgiProxy() {
ehr = openEhrClient.ehrEndpoint().createEhr();
EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV0 = TestData.buildEhrbaseBloodPressureSimpleDeV0();
Enhancer enhancer = new Enhancer();
enhancer.setSuperclass(EhrbaseBloodPressureSimpleDeV0Composition.class);
enhancer.setCallback((MethodInterceptor) (obj, method, args, proxy) -> {
if (method.getDeclaringClass() != Object.class && method.getName().equals("getLanguage")) {
return Language.EN;
} else {
return proxy.invokeSuper(obj, args);
}
});
EhrbaseBloodPressureSimpleDeV0Composition proxy = (EhrbaseBloodPressureSimpleDeV0Composition) enhancer.create();
proxy.setStartTimeValue(OffsetDateTime.of(2019, 04, 03, 22, 00, 00, 00, ZoneOffset.UTC));
proxy.setEndTimeValue(OffsetDateTime.now());
proxy.setBloodPressureTrainingSample(new ArrayList<>());
proxy.setLanguage(Language.DE);
proxy.setTerritory(Territory.DE);
proxy.setCategoryDefiningCode(org.ehrbase.client.classgenerator.shareddefinition.Category.EVENT);
proxy.setSettingDefiningCode(Setting.NURSING_HOME_CARE);
proxy.setComposer(new PartyIdentified(null, "Test", null));
proxy.setParticipations(new ArrayList<>());
proxy.getParticipations().add(new Participation(new PartyIdentified(null, "Test", null), new DvText("Pos1"), null, null));
proxy.getParticipations().add(new Participation(new PartyIdentified(null, "Test2", null), new DvText("Pos2"), null, null));
proxy.setBloodPressureTrainingSample(bloodPressureSimpleDeV0.getBloodPressureTrainingSample());
openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(proxy);
assertThat(proxy.getVersionUid()).isNotNull();
assertThat(proxy.getVersionUid().getVersion()).isEqualTo(1L);
EhrbaseBloodPressureSimpleDeV0Composition actual = openEhrClient.compositionEndpoint(ehr).find(proxy.getVersionUid().getUuid(), EhrbaseBloodPressureSimpleDeV0Composition.class).get();
assertThat(actual.getLanguage()).isEqualTo(Language.EN);
}
use of org.ehrbase.client.classgenerator.examples.ehrbasebloodpressuresimpledev0composition.EhrbaseBloodPressureSimpleDeV0Composition in project openEHR_SDK by ehrbase.
the class DefaultRestCompositionEndpointIT method testSaveCompositionEntityNative.
@Test
public void testSaveCompositionEntityNative() {
ehr = openEhrClient.ehrEndpoint().createEhr();
EhrbaseBloodPressureSimpleDeV0Composition bloodPressureSimpleDeV0 = TestData.buildEhrbaseBloodPressureSimpleDeV0();
openEhrClient.compositionEndpoint(ehr).mergeCompositionEntity(bloodPressureSimpleDeV0);
assertThat(bloodPressureSimpleDeV0.getVersionUid()).isNotNull();
assertThat(bloodPressureSimpleDeV0.getVersionUid().getVersion()).isEqualTo(1L);
Optional<Composition> aNative = openEhrClient.compositionEndpoint(ehr).findRaw(bloodPressureSimpleDeV0.getVersionUid().getUuid());
assertThat(aNative).isPresent();
assertThat(aNative.get().getUid().getExtension()).isEqualTo("local.ehrbase.org::1");
VersionUid versionUid = openEhrClient.compositionEndpoint(ehr).mergeRaw(aNative.get());
assertThat(versionUid.getVersion()).isEqualTo(2l);
aNative.get().setUid(null);
versionUid = openEhrClient.compositionEndpoint(ehr).mergeRaw(aNative.get());
assertThat(versionUid.getVersion()).isEqualTo(1L);
}
Aggregations