Search in sources :

Example 16 with DvDateTime

use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime 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 17 with DvDateTime

use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.

the class FeederAuditDetailsPostprocessor method process.

/**
 * {@inheritDoc}
 */
@Override
public void process(String term, FeederAuditDetails rmObject, Map<FlatPathDto, String> values, Set<String> consumedPaths, Context<Map<FlatPathDto, String>> context) {
    Map<FlatPathDto, String> locationValues = FlatHelper.filter(values, term + "/_location", false);
    if (!locationValues.isEmpty()) {
        rmObject.setLocation(new PartyIdentified());
        handleRmAttribute(term, rmObject.getLocation(), locationValues, consumedPaths, context, "location");
    }
    Map<FlatPathDto, String> subjectValues = FlatHelper.filter(values, term + "/_subject", false);
    if (!subjectValues.isEmpty()) {
        rmObject.setSubject(new PartyIdentified());
        handleRmAttribute(term, rmObject.getSubject(), subjectValues, consumedPaths, context, "subject");
    }
    Map<FlatPathDto, String> providerValues = FlatHelper.filter(values, term + "/_provider", false);
    if (!providerValues.isEmpty()) {
        rmObject.setProvider(new PartyIdentified());
        handleRmAttribute(term, rmObject.getProvider(), providerValues, consumedPaths, context, "provider");
    }
    Map<FlatPathDto, String> timeValues = FlatHelper.filter(values, term + "/_time", false);
    if (!timeValues.isEmpty()) {
        rmObject.setTime(new DvDateTime());
        handleRmAttribute(term, rmObject.getTime(), timeValues, consumedPaths, context, "time");
    }
}
Also used : PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)

Example 18 with DvDateTime

use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.

the class ObservationValueInserter method insert.

private void insert(History<?> rmObject, DefaultValues defaultValues) {
    if (RMHelper.isEmpty(rmObject.getOrigin()) && (defaultValues.containsDefaultValue(DefaultValuePath.TIME) || defaultValues.containsDefaultValue(DefaultValuePath.HISTORY_ORIGIN))) {
        TemporalAccessor defaultTemporalAccessor = Stream.of(DefaultValuePath.HISTORY_ORIGIN, DefaultValuePath.TIME).map(defaultValues::getDefaultValue).filter(Objects::nonNull).findFirst().orElseThrow();
        rmObject.setOrigin(new DvDateTime(defaultTemporalAccessor));
    }
}
Also used : TemporalAccessor(java.time.temporal.TemporalAccessor) Objects(java.util.Objects) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)

Example 19 with DvDateTime

use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime 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)

Example 20 with DvDateTime

use of com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime in project openEHR_SDK by ehrbase.

the class FeederAuditDetailsRMUnmarshaller method handle.

/**
 * {@inheritDoc}
 */
@Override
public void handle(String currentTerm, FeederAuditDetails rmObject, Map<FlatPathDto, String> currentValues, Context<Map<FlatPathDto, String>> context, Set<String> consumedPaths) {
    setValue(currentTerm, "time", currentValues, s -> {
        if (s != null) {
            rmObject.setTime(new DvDateTime(s));
        }
    }, String.class, consumedPaths);
    Map<FlatPathDto, String> locationValues = FlatHelper.filter(currentValues, currentTerm + "/location", false);
    if (!locationValues.isEmpty()) {
        rmObject.setLocation(new PartyIdentified());
        RMUnmarshaller rmUnmarshaller = findRMUnmarshaller(rmObject.getLocation().getClass());
        rmUnmarshaller.handle(currentTerm + "/location", rmObject.getLocation(), locationValues, null, consumedPaths);
    }
    Map<FlatPathDto, String> subjectValues = FlatHelper.filter(currentValues, currentTerm + "/subject", false);
    if (!subjectValues.isEmpty()) {
        rmObject.setSubject(new PartyIdentified());
        RMUnmarshaller rmUnmarshaller = findRMUnmarshaller(rmObject.getSubject().getClass());
        rmUnmarshaller.handle(currentTerm + "/subject", rmObject.getSubject(), subjectValues, null, consumedPaths);
    }
    Map<FlatPathDto, String> providerValues = FlatHelper.filter(currentValues, currentTerm + "/provider", false);
    if (!providerValues.isEmpty()) {
        rmObject.setProvider(new PartyIdentified());
        RMUnmarshaller rmUnmarshaller = findRMUnmarshaller(rmObject.getProvider().getClass());
        rmUnmarshaller.handle(currentTerm + "/provider", rmObject.getProvider(), providerValues, null, consumedPaths);
    }
    setValue(currentTerm, "system_id", currentValues, rmObject::setSystemId, String.class, consumedPaths);
    setValue(currentTerm, "version_id", currentValues, rmObject::setVersionId, String.class, consumedPaths);
}
Also used : PartyIdentified(com.nedap.archie.rm.generic.PartyIdentified) StdToCompositionWalker.findRMUnmarshaller(org.ehrbase.serialisation.flatencoding.std.umarshal.StdToCompositionWalker.findRMUnmarshaller) FlatPathDto(org.ehrbase.webtemplate.path.flat.FlatPathDto) DvDateTime(com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)

Aggregations

DvDateTime (com.nedap.archie.rm.datavalues.quantity.datetime.DvDateTime)44 PartyIdentified (com.nedap.archie.rm.generic.PartyIdentified)11 Test (org.junit.Test)10 DvCodedText (com.nedap.archie.rm.datavalues.DvCodedText)8 PartyProxy (com.nedap.archie.rm.generic.PartyProxy)7 EventContext (com.nedap.archie.rm.composition.EventContext)6 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)5 TerminologyId (com.nedap.archie.rm.support.identification.TerminologyId)5 PersistedPartyProxy (org.ehrbase.dao.access.jooq.party.PersistedPartyProxy)5 Composition (com.nedap.archie.rm.composition.Composition)4 CodePhrase (com.nedap.archie.rm.datatypes.CodePhrase)4 Participation (com.nedap.archie.rm.generic.Participation)4 TemporalAccessor (java.time.temporal.TemporalAccessor)4 Objects (java.util.Objects)4 DvIdentifier (com.nedap.archie.rm.datavalues.DvIdentifier)3 DvText (com.nedap.archie.rm.datavalues.DvText)3 EhrStatus (com.nedap.archie.rm.ehr.EhrStatus)3 AuditDetails (com.nedap.archie.rm.generic.AuditDetails)3 UUID (java.util.UUID)3 Test (org.junit.jupiter.api.Test)3