use of com.nedap.archie.rm.composition.InstructionDetails 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 com.nedap.archie.rm.composition.InstructionDetails in project openEHR_SDK by ehrbase.
the class InstructionDetailsRMUnmarshaller method handle.
/**
* {@inheritDoc}
*/
@Override
public void handle(String currentTerm, InstructionDetails rmObject, Map<FlatPathDto, String> currentValues, Context<Map<FlatPathDto, String>> context, Set<String> consumedPaths) {
if (currentValues.keySet().stream().anyMatch(k -> List.of("instruction_uid", "wt_path", "instruction_index").contains(k.getLast().getAttributeName()))) {
throw new SdkException(String.format("Calculation of Path from instruction_uid, wt_path or instruction_index is not supported. Provide |path at %s ", currentTerm));
}
if (currentValues.keySet().stream().anyMatch(k -> List.of("activity_index").contains(k.getLast().getAttributeName()))) {
throw new SdkException(String.format("Calculation of activity_id from activity_index is not supported. Provide |activity_id at %s ", currentTerm));
}
setValue(currentTerm, "activity_id", currentValues, rmObject::setActivityId, String.class, consumedPaths);
rmObject.setInstructionId(new LocatableRef());
rmObject.getInstructionId().setNamespace("local");
rmObject.getInstructionId().setType("INSTRUCTION");
setValue(currentTerm, "composition_uid", currentValues, s -> Optional.ofNullable(s).ifPresent(p -> rmObject.getInstructionId().setId(new HierObjectId(p))), String.class, consumedPaths);
setValue(currentTerm, "path", currentValues, s -> rmObject.getInstructionId().setPath(s), String.class, consumedPaths);
}
Aggregations