use of org.ehrbase.serialisation.dbencoding.RmObjectEncoding in project openEHR_SDK by ehrbase.
the class ActionAttributes method toMap.
public Map<String, Object> toMap(Action action) {
if (action.getTime() != null && !action.getTime().equals(new DvDateTime())) {
map = toMap(TAG_TIME, action.getTime(), action.getName());
}
if (action.getInstructionDetails() != null) {
InstructionDetails instructionDetails = action.getInstructionDetails();
map.put(TAG_INSTRUCTION_DETAILS, new RmObjectEncoding(instructionDetails).toMap());
}
if (action.getIsmTransition() != null) {
IsmTransition ismTransition = action.getIsmTransition();
if (ismTransition != null) {
map.put(TAG_ISM_TRANSITION, new RmObjectEncoding(ismTransition).toMap());
}
}
map = super.toMap(action);
return map;
}
use of org.ehrbase.serialisation.dbencoding.RmObjectEncoding in project openEHR_SDK by ehrbase.
the class FeederAuditAttributes method toMap.
/**
* encode the attributes lower snake case to comply with UML conventions and make is queryable
* @return
*/
public Map<String, Object> toMap() {
Map<String, Object> valuemap = PathMap.getInstance();
valuemap.put(TAG_CLASS, new SimpleClassName(feederAudit).toString());
if (feederAudit.getOriginatingSystemItemIds() != null && !feederAudit.getOriginatingSystemItemIds().isEmpty()) {
valuemap.put("originating_system_item_ids", encodeDvIdentifiers(feederAudit.getOriginatingSystemItemIds()));
}
valuemap.put("feeder_system_audit", new FeederAuditDetailsAttributes(feederAudit.getFeederSystemAudit()).toMap());
if (feederAudit.getFeederSystemItemIds() != null && !feederAudit.getFeederSystemItemIds().isEmpty()) {
valuemap.put("feeder_system_item_ids", encodeDvIdentifiers(feederAudit.getFeederSystemItemIds()));
}
if (feederAudit.getOriginalContent() != null)
valuemap.put("original_content", new RmObjectEncoding(feederAudit.getOriginalContent()).toMap());
valuemap.put("originating_system_audit", new FeederAuditDetailsAttributes(feederAudit.getOriginatingSystemAudit()).toMap());
return valuemap;
}
use of org.ehrbase.serialisation.dbencoding.RmObjectEncoding in project openEHR_SDK by ehrbase.
the class FeederAuditDetailsAttributes method toMap.
/**
* encode the attributes lower snake case to comply with UML conventions and make is queryable
* @return
*/
public Map<String, Object> toMap() {
Map<String, Object> valuemap = PathMap.getInstance();
if (feederAuditDetails == null)
return null;
valuemap.put(I_DvTypeAdapter.AT_TYPE, new SnakeCase(FeederAuditDetails.class.getSimpleName()).camelToUpperSnake());
if (feederAuditDetails.getLocation() != null) {
valuemap.put("location", new RmObjectEncoding(feederAuditDetails.getLocation()).toMap());
}
if (feederAuditDetails.getProvider() != null) {
valuemap.put("provider", new RmObjectEncoding(feederAuditDetails.getProvider()).toMap());
}
if (feederAuditDetails.getSubject() != null) {
valuemap.put("subject", new RmObjectEncoding(feederAuditDetails.getSubject()).toMap());
}
if (feederAuditDetails.getSystemId() != null) {
valuemap.put("system_id", feederAuditDetails.getSystemId());
}
if (feederAuditDetails.getTime() != null) {
valuemap.put("time", new RmObjectEncoding(feederAuditDetails.getTime()).toMap());
}
if (feederAuditDetails.getVersionId() != null) {
valuemap.put("version_id", feederAuditDetails.getVersionId());
}
if (feederAuditDetails.getOtherDetails() != null) {
String dbEncoded = new CompositionSerializer().dbEncode(feederAuditDetails.getOtherDetails());
Map<String, Object> asMap = new LightRawJsonEncoder(dbEncoded).encodeOtherDetailsAsMap();
String nodeId = asMap.get("/archetype_node_id").toString();
// make sure node id is wrapped in [ and ] and throw errors if invalid input
if (!nodeId.startsWith("[")) {
if (nodeId.endsWith("]"))
throw new IllegalArgumentException("Invalid archetype node id");
nodeId = "[" + nodeId + "]";
} else if (!nodeId.endsWith("]")) {
throw new IllegalArgumentException("Invalid archetype node id");
}
valuemap.put("other_details" + nodeId, asMap);
}
return valuemap;
}
Aggregations