Skip to content

Commit

Permalink
fix multiple section of same archetype
Browse files Browse the repository at this point in the history
  • Loading branch information
nr23730 committed Mar 20, 2024
1 parent 0cf10c8 commit 874e870
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/de/uksh/medic/etl/openehrmapper/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,15 @@ public void gen_SECTION(String path, String name, Object jsonmap, Map<String, Ob
throws Exception {
String paramName = getArcheTypeId(path);
String label = getTypeLabel(path, getNodeId(path));
String resolvedPath = paramName + ", '" + label + "'";
String newPath = path + "/attributes";
Section section = new Section();
section.setArchetypeNodeId(paramName);

section.setNameAsString(label);
List<ContentItem> items = new ArrayList<>();
processAttributeChildren(newPath, paramName, items, (Map<String, Object>) map.get(paramName));
processAttributeChildren(newPath, paramName, items,
(Map<String, Object>) map.getOrDefault(resolvedPath, map.get(paramName)));
section.setItems(items);

((List<ContentItem>) jsonmap).add(section);
Expand All @@ -122,7 +124,6 @@ public void gen_SECTION(String path, String name, Object jsonmap, Map<String, Ob
@SuppressWarnings("unchecked")
public void gen_ADMIN_ENTRY(String path, String name, Object jsonmap, Map<String, Object> map)
throws Exception {

String paramName = getArcheTypeId(path);
String oap = path + "/attributes[rm_attribute_name=\"data\"]";
Boolean oa = (Boolean) XP.evaluate(oap, opt, XPathConstants.BOOLEAN);
Expand Down

0 comments on commit 874e870

Please sign in to comment.