Search in sources :

Example 1 with DvParsable

use of com.nedap.archie.rm.datavalues.encapsulated.DvParsable in project openEHR_SDK by ehrbase.

the class FeederAuditConfig method buildChildValues.

/**
 * {@inheritDoc}
 */
@Override
public Map<String, Object> buildChildValues(String currentTerm, FeederAudit rmObject, Context<Map<String, Object>> context) {
    Map<String, Object> result = new HashMap<>();
    if (rmObject.getOriginalContent() instanceof DvParsable) {
        result.putAll(DV_PARSABLE_CONFIG.buildChildValues(currentTerm + "/original_content", (DvParsable) rmObject.getOriginalContent(), context));
    } else if (rmObject.getOriginalContent() instanceof DvMultimedia) {
        result.putAll(DV_MULTIMEDIA_CONFIG.buildChildValues(currentTerm + "/original_content_multimedia", (DvMultimedia) rmObject.getOriginalContent(), context));
    }
    IntStream.range(0, rmObject.getFeederSystemItemIds().size()).forEach(i -> {
        DvIdentifier identifier = rmObject.getFeederSystemItemIds().get(i);
        result.putAll(DV_IDENTIFIER_CONFIG.buildChildValues(currentTerm + "/feeder_system_item_id:" + i, identifier, context));
    });
    IntStream.range(0, rmObject.getOriginatingSystemItemIds().size()).forEach(i -> {
        DvIdentifier identifier = rmObject.getOriginatingSystemItemIds().get(i);
        result.putAll(DV_IDENTIFIER_CONFIG.buildChildValues(currentTerm + "/originating_system_item_id:" + i, identifier, context));
    });
    if (rmObject.getOriginatingSystemAudit() != null) {
        result.putAll(FEEDER_AUDI_DETAILS_STD_CONFIG.buildChildValues(currentTerm + "/originating_system_audit", rmObject.getOriginatingSystemAudit(), context));
    }
    return result;
}
Also used : HashMap(java.util.HashMap) DvMultimedia(com.nedap.archie.rm.datavalues.encapsulated.DvMultimedia) DvParsable(com.nedap.archie.rm.datavalues.encapsulated.DvParsable) DvIdentifier(com.nedap.archie.rm.datavalues.DvIdentifier)

Example 2 with DvParsable

use of com.nedap.archie.rm.datavalues.encapsulated.DvParsable in project openEHR_SDK by ehrbase.

the class InstructionPostprocessor method process.

/**
 * {@inheritDoc}
 */
@Override
public void process(String term, Instruction rmObject, Map<FlatPathDto, String> values, Set<String> consumedPaths, Context<Map<FlatPathDto, String>> context) {
    Map<FlatPathDto, String> wfDefinition = values.entrySet().stream().filter(e -> e.getKey().startsWith(term + PATH_DIVIDER + "_wf_definition")).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
    if (!wfDefinition.isEmpty()) {
        rmObject.setWfDefinition(new DvParsable());
        handleRmAttribute(term, rmObject.getWfDefinition(), wfDefinition, consumedPaths, context, "wf_definition");
    }
}
Also used : Context(org.ehrbase.serialisation.walker.Context) PATH_DIVIDER(org.ehrbase.webtemplate.parser.OPTParser.PATH_DIVIDER) Map(java.util.Map) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) Set(java.util.Set) Instruction(com.nedap.archie.rm.composition.Instruction) DvParsable(com.nedap.archie.rm.datavalues.encapsulated.DvParsable) Collectors(java.util.stream.Collectors) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) DvParsable(com.nedap.archie.rm.datavalues.encapsulated.DvParsable) Map(java.util.Map)

Example 3 with DvParsable

use of com.nedap.archie.rm.datavalues.encapsulated.DvParsable in project openEHR_SDK by ehrbase.

the class ActivityValueInserter method insert.

@Override
public void insert(Activity rmObject, DefaultValues defaultValues) {
    if (RMHelper.isEmpty(rmObject.getTiming()) && defaultValues.containsDefaultValue(DefaultValuePath.ACTIVITY_TIMING)) {
        if (rmObject.getTiming() == null) {
            rmObject.setTiming(new DvParsable());
        }
        rmObject.getTiming().setValue(defaultValues.getDefaultValue(DefaultValuePath.ACTIVITY_TIMING));
        rmObject.getTiming().setFormalism("timing");
    }
    if (rmObject.getTiming() != null && rmObject.getTiming().getFormalism() == null) {
        // default
        rmObject.getTiming().setFormalism("timing");
    }
    if (rmObject.getActionArchetypeId() == null) {
        rmObject.setActionArchetypeId("/.*/");
    }
}
Also used : DvParsable(com.nedap.archie.rm.datavalues.encapsulated.DvParsable)

Example 4 with DvParsable

use of com.nedap.archie.rm.datavalues.encapsulated.DvParsable in project openEHR_SDK by ehrbase.

the class FeederAuditRMUnmarshaller method handle.

@Override
public void handle(String currentTerm, FeederAudit rmObject, Map<FlatPathDto, String> currentValues, Context<Map<FlatPathDto, String>> context, Set<String> consumedPaths) {
    Map<FlatPathDto, String> originalContentValues = FlatHelper.filter(currentValues, currentTerm + "/original_content", false);
    if (!originalContentValues.isEmpty()) {
        rmObject.setOriginalContent(new DvParsable());
        DV_PARSABLE_RM_UNMARSHALLER.handle(currentTerm + "/original_content", (DvParsable) rmObject.getOriginalContent(), originalContentValues, context, consumedPaths);
    }
    Map<FlatPathDto, String> originalContentMultimediaValues = FlatHelper.filter(currentValues, currentTerm + "/original_content_multimedia", false);
    if (!originalContentMultimediaValues.isEmpty()) {
        rmObject.setOriginalContent(new DvMultimedia());
        DV_MULTIMEDIA_RM_UNMARSHALLER.handle(currentTerm + "/original_content_multimedia", (DvMultimedia) rmObject.getOriginalContent(), originalContentMultimediaValues, context, consumedPaths);
    }
    Map<FlatPathDto, String> originatingSystemAuditValues = FlatHelper.filter(currentValues, currentTerm + "/originating_system_audit", false);
    if (!originatingSystemAuditValues.isEmpty()) {
        rmObject.setOriginatingSystemAudit(new FeederAuditDetails());
        FEEDER_AUDIT_DETAILS_RM_UNMARSHALLER.handle(currentTerm + "/originating_system_audit", rmObject.getOriginatingSystemAudit(), currentValues, context, consumedPaths);
    }
    Map<Integer, Map<String, String>> feederSystemIds = extractMultiValued(currentTerm, "feeder_system_item_id", currentValues);
    rmObject.getFeederSystemItemIds().addAll(feederSystemIds.values().stream().map(DefaultValues::toDvIdentifier).collect(Collectors.toList()));
    consumeAllMatching(currentTerm + PATH_DIVIDER + "feeder_system_item_id", currentValues, consumedPaths, false);
    Map<Integer, Map<String, String>> originatingSystemIds = extractMultiValued(currentTerm, "originating_system_item_id", currentValues);
    rmObject.getOriginatingSystemItemIds().addAll(originatingSystemIds.values().stream().map(DefaultValues::toDvIdentifier).collect(Collectors.toList()));
    consumeAllMatching(currentTerm + PATH_DIVIDER + "originating_system_item_id", currentValues, consumedPaths, false);
}
Also used : FeederAuditDetails(com.nedap.archie.rm.archetyped.FeederAuditDetails) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) DefaultValues(org.ehrbase.serialisation.walker.defaultvalues.DefaultValues) DvMultimedia(com.nedap.archie.rm.datavalues.encapsulated.DvMultimedia) DvParsable(com.nedap.archie.rm.datavalues.encapsulated.DvParsable) Map(java.util.Map)

Aggregations

DvParsable (com.nedap.archie.rm.datavalues.encapsulated.DvParsable)4 DvMultimedia (com.nedap.archie.rm.datavalues.encapsulated.DvMultimedia)2 Map (java.util.Map)2 FlatPathDto (org.ehrbase.webtemplate.path.flat.FlatPathDto)2 FeederAuditDetails (com.nedap.archie.rm.archetyped.FeederAuditDetails)1 Instruction (com.nedap.archie.rm.composition.Instruction)1 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)1 HashMap (java.util.HashMap)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 Context (org.ehrbase.serialisation.walker.Context)1 DefaultValues (org.ehrbase.serialisation.walker.defaultvalues.DefaultValues)1 PATH_DIVIDER (org.ehrbase.webtemplate.parser.OPTParser.PATH_DIVIDER)1