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);
}
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");
}
}
}
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);
}
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);
}
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);
}
Aggregations