Search in sources :

Example 1 with DvEHRURI

use of com.nedap.archie.rm.datavalues.DvEHRURI in project ehrbase by ehrbase.

the class AttestationAccess method getAsAttestation.

@Override
public Attestation getAsAttestation() {
    // take most values from super class entry
    AuditDetails audit = auditDetailsAccess.getAsAuditDetails();
    String systemId = audit.getSystemId();
    PartyProxy committer = audit.getCommitter();
    DvDateTime time = audit.getTimeCommitted();
    DvCodedText changeType = audit.getChangeType();
    DvText description = audit.getDescription();
    // FIXME VERSIONED_OBJECT_POC: implement retrieval from "attested_view" table
    DvMultimedia attestedView = null;
    String proof = attestationRecord.getProof();
    // FIXME VERSIONED_OBJECT_POC: implement?! seems to be completely unsupported right now
    List<DvEHRURI> items = null;
    DvText reason = new DvText(attestationRecord.getReason());
    boolean isPending = attestationRecord.getIsPending();
    return new Attestation(systemId, committer, time, changeType, description, attestedView, proof, items, reason, isPending);
}
Also used : DvCodedText(com.nedap.archie.rm.datavalues.DvCodedText) DvEHRURI(com.nedap.archie.rm.datavalues.DvEHRURI) PartyProxy(com.nedap.archie.rm.generic.PartyProxy) AuditDetails(com.nedap.archie.rm.generic.AuditDetails) DvMultimedia(com.nedap.archie.rm.datavalues.encapsulated.DvMultimedia) Attestation(com.nedap.archie.rm.generic.Attestation) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) DvText(com.nedap.archie.rm.datavalues.DvText)

Example 2 with DvEHRURI

use of com.nedap.archie.rm.datavalues.DvEHRURI in project openEHR_SDK by ehrbase.

the class LocatableMarshalPostprocessor method process.

/**
 * {@inheritDoc}
 */
@Override
public void process(String term, Locatable rmObject, Map<String, Object> values, Context<Map<String, Object>> context) {
    if (RmConstants.ELEMENT.equals(context.getNodeDeque().peek().getRmType()) || !context.getFlatHelper().skip(context)) {
        addValue(values, term + PATH_DIVIDER + "_uid", null, Optional.of(rmObject).map(Locatable::getUid).map(ObjectId::getValue).orElse(null));
        if (rmObject.getLinks() != null) {
            IntStream.range(0, rmObject.getLinks().size()).forEach(i -> {
                Link link = rmObject.getLinks().get(i);
                String termLoop = term + PATH_DIVIDER + "_link:" + i;
                addValue(values, termLoop, "meaning", Optional.of(link).map(Link::getMeaning).map(DvText::getValue).orElse(null));
                addValue(values, termLoop, "type", Optional.of(link).map(Link::getType).map(DvText::getValue).orElse(null));
                addValue(values, termLoop, "target", Optional.of(link).map(Link::getTarget).map(DvEHRURI::getValue).orElse(null));
            });
        }
        if (rmObject.getFeederAudit() != null) {
            callMarshal(term, "_feeder_audit", rmObject.getFeederAudit(), values, context, context.getNodeDeque().peek().findChildById("feeder_audit").orElse(FlatHelper.buildDummyChild("feeder_audit", context.getNodeDeque().peek())));
        }
        if (Optional.ofNullable(rmObject.getName()).map(DvText::getValue).filter(n -> !Objects.equals(context.getNodeDeque().peek().getName(), n)).isPresent()) {
            handleRmAttribute(term, rmObject.getName(), values, context, "name");
        }
    }
}
Also used : IntStream(java.util.stream.IntStream) Context(org.ehrbase.serialisation.walker.Context) FlatHelper(org.ehrbase.serialisation.walker.FlatHelper) DvText(com.nedap.archie.rm.datavalues.DvText) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) DvEHRURI(com.nedap.archie.rm.datavalues.DvEHRURI) Objects(java.util.Objects) PATH_DIVIDER(org.ehrbase.webtemplate.parser.OPTParser.PATH_DIVIDER) Map(java.util.Map) RmConstants(org.ehrbase.util.rmconstants.RmConstants) Locatable(com.nedap.archie.rm.archetyped.Locatable) Optional(java.util.Optional) Link(com.nedap.archie.rm.archetyped.Link) ObjectId(com.nedap.archie.rm.support.identification.ObjectId) DvEHRURI(com.nedap.archie.rm.datavalues.DvEHRURI) Link(com.nedap.archie.rm.archetyped.Link) DvText(com.nedap.archie.rm.datavalues.DvText)

Example 3 with DvEHRURI

use of com.nedap.archie.rm.datavalues.DvEHRURI in project openEHR_SDK by ehrbase.

the class LinksEncodingTest method testToDb.

public void testToDb() {
    LinksEncoding encoding = new LinksEncoding();
    Link link = new Link(new DvText("something"), new DvText("something else"), new DvEHRURI("ehr://target"));
    String encoded = encoding.toDB(Collections.singletonList(link));
    assertNotNull(encoded);
}
Also used : DvEHRURI(com.nedap.archie.rm.datavalues.DvEHRURI) Link(com.nedap.archie.rm.archetyped.Link) DvText(com.nedap.archie.rm.datavalues.DvText)

Example 4 with DvEHRURI

use of com.nedap.archie.rm.datavalues.DvEHRURI in project openEHR_SDK by ehrbase.

the class LinksEncodingTest method testFromDbOneLink.

public void testFromDbOneLink() {
    LinksEncoding encoding = new LinksEncoding();
    Link link = new Link(new DvText("something"), new DvText("something else"), new DvEHRURI("ehr://target"));
    List<Link> list = Collections.singletonList(link);
    String encoded = encoding.toDB(list);
    assertNotNull(encoded);
    List<Link> result1 = encoding.fromDB(encoded);
    assertEquals(list, result1);
}
Also used : DvEHRURI(com.nedap.archie.rm.datavalues.DvEHRURI) Link(com.nedap.archie.rm.archetyped.Link) DvText(com.nedap.archie.rm.datavalues.DvText)

Example 5 with DvEHRURI

use of com.nedap.archie.rm.datavalues.DvEHRURI in project openEHR_SDK by ehrbase.

the class LinksEncodingTest method testFromDbTwoLinks.

public void testFromDbTwoLinks() {
    LinksEncoding encoding = new LinksEncoding();
    Link link = new Link(new DvText("something"), new DvText("something else"), new DvEHRURI("ehr://target"));
    List<Link> list = Collections.singletonList(link);
    String encoded = encoding.toDB(list);
    assertNotNull(encoded);
    Link link2 = new Link(new DvText("something2"), new DvText("something else2"), new DvEHRURI("ehr://target2"));
    List<Link> list2 = new ArrayList<Link>();
    list2.add(link);
    list2.add(link2);
    String encoded2 = encoding.toDB(list2);
    List<Link> result2 = encoding.fromDB(encoded2);
    assertEquals(list2, result2);
}
Also used : DvEHRURI(com.nedap.archie.rm.datavalues.DvEHRURI) ArrayList(java.util.ArrayList) Link(com.nedap.archie.rm.archetyped.Link) DvText(com.nedap.archie.rm.datavalues.DvText)

Aggregations

DvEHRURI (com.nedap.archie.rm.datavalues.DvEHRURI)5 DvText (com.nedap.archie.rm.datavalues.DvText)5 Link (com.nedap.archie.rm.archetyped.Link)4 Locatable (com.nedap.archie.rm.archetyped.Locatable)1 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)1 DvMultimedia (com.nedap.archie.rm.datavalues.encapsulated.DvMultimedia)1 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)1 Attestation (com.nedap.archie.rm.generic.Attestation)1 AuditDetails (com.nedap.archie.rm.generic.AuditDetails)1 PartyProxy (com.nedap.archie.rm.generic.PartyProxy)1 ObjectId (com.nedap.archie.rm.support.identification.ObjectId)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 IntStream (java.util.stream.IntStream)1 Context (org.ehrbase.serialisation.walker.Context)1 FlatHelper (org.ehrbase.serialisation.walker.FlatHelper)1 RmConstants (org.ehrbase.util.rmconstants.RmConstants)1 PATH_DIVIDER (org.ehrbase.webtemplate.parser.OPTParser.PATH_DIVIDER)1