use of org.ehrbase.jooq.pg.tables.records.EventContextRecord in project ehrbase by ehrbase.
the class RecordedDvCodedTextTest method testToDB.
@Test
public void testToDB() {
Record record = new EventContextRecord();
DvCodedText dvCodedText = new DvCodedText("testvalue", new CodePhrase("en"), new CodePhrase("UTF-8"), new CodePhrase(new TerminologyId("terminology"), "1224"));
TermMapping termMapping = new TermMapping(new CodePhrase(new TerminologyId("A"), "target"), Character.valueOf('>'), new DvCodedText("purpose", new CodePhrase(new TerminologyId("B"), "BBB")));
List<TermMapping> termMappings = new ArrayList<>();
termMappings.add(termMapping);
dvCodedText.setMappings(termMappings);
new RecordedDvCodedText().toDB(record, EventContext.EVENT_CONTEXT.SETTING, dvCodedText);
DvCodedTextRecord dvCodedTextRecord = record.get(EventContext.EVENT_CONTEXT.SETTING);
assertEquals(">", dvCodedTextRecord.getTermMapping()[0].split("|")[0]);
}
use of org.ehrbase.jooq.pg.tables.records.EventContextRecord in project ehrbase by ehrbase.
the class RecordedDvCodedTextTest method testFromDB.
@Test
public void testFromDB() {
Record record = new EventContextRecord();
DvCodedTextRecord dvCodedTextRecord = new DvCodedTextRecord();
dvCodedTextRecord.setValue("1234");
dvCodedTextRecord.setDefiningCode(new CodePhraseRecord("term1", "aaa"));
dvCodedTextRecord.setTermMapping(new String[] { ">|purpose|B|BBB|A|target" });
record.set(EventContext.EVENT_CONTEXT.SETTING, dvCodedTextRecord);
DvCodedText dvCodedText = (DvCodedText) new RecordedDvCodedText().fromDB(record, EventContext.EVENT_CONTEXT.SETTING);
assertEquals('>', dvCodedText.getMappings().get(0).getMatch());
}
use of org.ehrbase.jooq.pg.tables.records.EventContextRecord in project ehrbase by ehrbase.
the class ContextAccess method retrieveInstance.
public static I_ContextAccess retrieveInstance(I_DomainAccess domainAccess, Result<?> records) {
ContextAccess contextAccess = new ContextAccess(domainAccess);
EventContextRecord eventContextRecord = domainAccess.getContext().newRecord(EVENT_CONTEXT);
eventContextRecord.setStartTime((Timestamp) records.getValue(0, I_CompositionAccess.F_CONTEXT_START_TIME));
eventContextRecord.setStartTimeTzid((String) records.getValue(0, I_CompositionAccess.F_CONTEXT_START_TIME_TZID));
eventContextRecord.setEndTime((Timestamp) records.getValue(0, I_CompositionAccess.F_CONTEXT_END_TIME));
eventContextRecord.setEndTimeTzid((String) records.getValue(0, I_CompositionAccess.F_CONTEXT_END_TIME_TZID));
eventContextRecord.setLocation((String) records.getValue(0, I_CompositionAccess.F_CONTEXT_LOCATION));
// eventContextRecord.setSetting(records.getValue(0, I_CompositionAccess.F_CONTEXT_SETTING));
eventContextRecord.setOtherContext((JSONB) records.getValue(0, I_CompositionAccess.F_CONTEXT_OTHER_CONTEXT));
return contextAccess;
}
Aggregations