Search in sources :

Example 1 with EventContextRecord

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]);
}
Also used : TermMapping(com.nedap.archie.rm.datavalues.TermMapping) TerminologyId(com.nedap.archie.rm.support.identification.TerminologyId) DvCodedTextRecord(org.ehrbase.jooq.pg.udt.records.DvCodedTextRecord) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) CodePhrase(com.nedap.archie.rm.datatypes.CodePhrase) ArrayList(java.util.ArrayList) Record(org.jooq.Record) CodePhraseRecord(org.ehrbase.jooq.pg.udt.records.CodePhraseRecord) DvCodedTextRecord(org.ehrbase.jooq.pg.udt.records.DvCodedTextRecord) EventContextRecord(org.ehrbase.jooq.pg.tables.records.EventContextRecord) EventContextRecord(org.ehrbase.jooq.pg.tables.records.EventContextRecord) Test(org.junit.Test)

Example 2 with EventContextRecord

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());
}
Also used : DvCodedTextRecord(org.ehrbase.jooq.pg.udt.records.DvCodedTextRecord) DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) Record(org.jooq.Record) CodePhraseRecord(org.ehrbase.jooq.pg.udt.records.CodePhraseRecord) DvCodedTextRecord(org.ehrbase.jooq.pg.udt.records.DvCodedTextRecord) EventContextRecord(org.ehrbase.jooq.pg.tables.records.EventContextRecord) EventContextRecord(org.ehrbase.jooq.pg.tables.records.EventContextRecord) CodePhraseRecord(org.ehrbase.jooq.pg.udt.records.CodePhraseRecord) Test(org.junit.Test)

Example 3 with EventContextRecord

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;
}
Also used : I_ContextAccess(org.ehrbase.dao.access.interfaces.I_ContextAccess) EventContextRecord(org.ehrbase.jooq.pg.tables.records.EventContextRecord)

Aggregations

EventContextRecord (org.ehrbase.jooq.pg.tables.records.EventContextRecord)3 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)2 CodePhraseRecord (org.ehrbase.jooq.pg.udt.records.CodePhraseRecord)2 DvCodedTextRecord (org.ehrbase.jooq.pg.udt.records.DvCodedTextRecord)2 Record (org.jooq.Record)2 Test (org.junit.Test)2 CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)1 TermMapping (com.nedap.archie.rm.datavalues.TermMapping)1 TerminologyId (com.nedap.archie.rm.support.identification.TerminologyId)1 ArrayList (java.util.ArrayList)1 I_ContextAccess (org.ehrbase.dao.access.interfaces.I_ContextAccess)1