use of org.ehrbase.webtemplate.parser.config.RmIntrospectConfig 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;
}
}
Aggregations