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;
}
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");
}
}
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));
}
}
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);
}
}
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);
}
Aggregations