Search in sources :

Example 1 with InstructionDetails

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;
}
Also used : InstructionDetails(com.nedap.archie.rm.composition.InstructionDetails) RmObjectEncoding(org.ehrbase.serialisation.dbencoding.RmObjectEncoding) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) IsmTransition(com.nedap.archie.rm.composition.IsmTransition)

Example 2 with InstructionDetails

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);
}
Also used : InstructionDetails(com.nedap.archie.rm.composition.InstructionDetails) HierObjectId(com.nedap.archie.rm.support.identification.HierObjectId) Context(org.ehrbase.serialisation.walker.Context) List(java.util.List) SdkException(org.ehrbase.util.exception.SdkException) Map(java.util.Map) LocatableRef(com.nedap.archie.rm.support.identification.LocatableRef) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) Optional(java.util.Optional) Set(java.util.Set) SdkException(org.ehrbase.util.exception.SdkException) LocatableRef(com.nedap.archie.rm.support.identification.LocatableRef) HierObjectId(com.nedap.archie.rm.support.identification.HierObjectId)

Aggregations

InstructionDetails (com.nedap.archie.rm.composition.InstructionDetails)2 IsmTransition (com.nedap.archie.rm.composition.IsmTransition)1 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)1 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)1 LocatableRef (com.nedap.archie.rm.support.identification.LocatableRef)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 RmObjectEncoding (org.ehrbase.serialisation.dbencoding.RmObjectEncoding)1 Context (org.ehrbase.serialisation.walker.Context)1 SdkException (org.ehrbase.util.exception.SdkException)1 FlatPathDto (org.ehrbase.webtemplate.path.flat.FlatPathDto)1