use of com.nedap.archie.rminfo.RMTypeInfo in project openEHR_SDK by ehrbase.
the class DefaultNamingStrategy method isEntityAttribute.
private boolean isEntityAttribute(ClassGeneratorContext context, WebTemplateNode node) {
FlatPath relativPath = new FlatPath(context.nodeDeque.peek().buildRelativePath(node));
RMTypeInfo typeInfo = RM_INFO_LOOKUP.getTypeInfo(context.nodeDeque.peek().getRmType());
return relativPath.getChild() == null && typeInfo != null && typeInfo.getAttributes().containsKey(relativPath.getName());
}
use of com.nedap.archie.rminfo.RMTypeInfo in project openEHR_SDK by ehrbase.
the class OPTParser method addInContext.
private void addInContext(WebTemplateNode node, WebTemplateNode child) {
Map<Class<?>, List<String>> contextAttributes = Map.of(Locatable.class, List.of("language"), Action.class, List.of("time"), Activity.class, List.of("timing", "action_archetype_id"), Instruction.class, List.of("narrative"), IsmTransition.class, List.of("current_state", "careflow_step", "transition"), History.class, List.of("origin"), Event.class, List.of("time"), Entry.class, List.of("language", "provider", "other_participations", "subject", "encoding"), EventContext.class, List.of("start_time", "end_time", "location", "setting", "healthCareFacility", "participations"), Composition.class, List.of("language", "territory", "composer", "category"));
RMTypeInfo typeInfo = ARCHIE_RM_INFO_LOOKUP.getTypeInfo(node.getRmType());
if (typeInfo != null) {
contextAttributes.forEach((k, v) -> {
if (k.isAssignableFrom(typeInfo.getJavaClass()) && v.contains(child.getId())) {
child.setInContext(true);
}
});
}
}
use of com.nedap.archie.rminfo.RMTypeInfo in project openEHR_SDK by ehrbase.
the class FlatHelper method isNonMandatoryRmAttribute.
public boolean isNonMandatoryRmAttribute(WebTemplateNode node, WebTemplateNode parent) {
RMTypeInfo typeInfo = Walker.ARCHIE_RM_INFO_LOOKUP.getTypeInfo(parent.getRmType());
boolean nonMandatoryRmAttribute = typeInfo.getAttributes().containsKey(node.getName()) && node.getMin() == 0;
boolean mandatoryNotInWebTemplate = List.of("name", "archetype_node_id", "origin", "media_type", "upper_included", "lower_included", "upper_unbounded", "lower_unbounded").contains(node.getName());
boolean nonMandatoryInWebTemplate = typeInfo.getRmName().equals("ACTIVITY") && node.getName().equals("timing") || typeInfo.getRmName().equals("INSTRUCTION") && node.getName().equals("expiry_time") || typeInfo.getRmName().equals("INTERVAL_EVENT") && node.getName().equals("width") || typeInfo.getRmName().equals("INTERVAL_EVENT") && node.getName().equals("math_function") || typeInfo.getRmName().equals(ISM_TRANSITION) && node.getName().equals("transition");
return (nonMandatoryRmAttribute || mandatoryNotInWebTemplate) && !nonMandatoryInWebTemplate;
}
use of com.nedap.archie.rminfo.RMTypeInfo in project openEHR_SDK by ehrbase.
the class FlattFilter method skip.
@Override
protected boolean skip(WebTemplateNode node, WebTemplate context, Deque<WebTemplateNode> deque) {
WebTemplateNode parent = deque.peek();
if (isTrivialNode(node, parent)) {
return true;
} else {
if (parent != null) {
RMTypeInfo typeInfo = ARCHIE_RM_INFO_LOOKUP.getTypeInfo(parent.getRmType());
Set<String> attributeNames = Optional.ofNullable(configMap.get(typeInfo.getJavaClass())).map(RmIntrospectConfig::getNonTemplateFields).orElse(Collections.emptySet()).stream().map(s -> new SnakeCase(s).camelToSnake()).collect(Collectors.toSet());
attributeNames.add("context");
attributeNames.add("timing");
attributeNames.add("expiry_time");
attributeNames.add("lower");
attributeNames.add("upper");
attributeNames.add("ism_transition");
attributeNames.add("location");
attributeNames.add("lower_included");
attributeNames.add("upper_included");
attributeNames.add("sample_count");
deque.poll();
if (!isTrivialNode(parent, deque.peek()) && Locatable.class.isAssignableFrom(typeInfo.getJavaClass())) {
attributeNames.add("feeder_audit");
}
deque.push(parent);
if (config.isAddNullFlavor()) {
attributeNames.add("null_flavour");
}
SetUtils.SetView<String> difference = SetUtils.difference(typeInfo.getAttributes().keySet(), attributeNames);
if (difference.contains(node.getName())) {
return true;
}
}
return false;
}
}
use of com.nedap.archie.rminfo.RMTypeInfo in project openEHR_SDK by ehrbase.
the class Filter method isNonMandatoryRmAttribute.
protected boolean isNonMandatoryRmAttribute(WebTemplateNode node, WebTemplateNode parent) {
RMTypeInfo typeInfo = ARCHIE_RM_INFO_LOOKUP.getTypeInfo(parent.getRmType());
boolean nonMandatoryRmAttribute = typeInfo.getAttributes().containsKey(node.getName()) && node.getMin() == 0;
boolean mandatoryNotInWebTemplate = List.of("name", "archetype_node_id", "origin", "media_type", "upper_included", "lower_included", "upper_unbounded", "lower_unbounded").contains(node.getName());
boolean nonMandatoryInWebTemplate = typeInfo.getRmName().equals("ACTIVITY") && node.getName().equals("timing") || typeInfo.getRmName().equals("INSTRUCTION") && node.getName().equals("expiry_time") || typeInfo.getRmName().equals("ISM_TRANSITION") && node.getName().equals("transition") || typeInfo.getRmName().equals("COMPOSITION") && node.getName().equals("context");
return (nonMandatoryRmAttribute || mandatoryNotInWebTemplate) && !nonMandatoryInWebTemplate;
}
Aggregations