Search in sources :

Example 1 with IsmTransition

use of com.nedap.archie.rm.composition.IsmTransition 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 IsmTransition

use of com.nedap.archie.rm.composition.IsmTransition in project openEHR_SDK by ehrbase.

the class ActionValueInserter method insert.

@Override
public void insert(Action rmObject, DefaultValues defaultValues) {
    if (RMHelper.isEmpty(rmObject.getTime()) && (defaultValues.containsDefaultValue(DefaultValuePath.TIME) || defaultValues.containsDefaultValue(DefaultValuePath.ACTION_TIME))) {
        TemporalAccessor defaultTemporalAccessor = Stream.of(DefaultValuePath.ACTION_TIME, DefaultValuePath.TIME).map(defaultValues::getDefaultValue).filter(Objects::nonNull).findFirst().orElseThrow();
        rmObject.setTime(new DvDateTime(defaultTemporalAccessor));
    }
    if (rmObject.getIsmTransition() == null) {
        rmObject.setIsmTransition(new IsmTransition());
    }
    new IsmTransitionValueInserter().insert(rmObject.getIsmTransition(), defaultValues);
    if (RMHelper.isEmpty(rmObject.getIsmTransition())) {
        rmObject.setIsmTransition(null);
    }
}
Also used : TemporalAccessor(java.time.temporal.TemporalAccessor) Objects(java.util.Objects) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime) IsmTransition(com.nedap.archie.rm.composition.IsmTransition)

Aggregations

IsmTransition (com.nedap.archie.rm.composition.IsmTransition)2 DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)2 InstructionDetails (com.nedap.archie.rm.composition.InstructionDetails)1 TemporalAccessor (java.time.temporal.TemporalAccessor)1 Objects (java.util.Objects)1 RmObjectEncoding (org.ehrbase.serialisation.dbencoding.RmObjectEncoding)1