@Test public void testIsIterative() throws Exception { String valuePointPath = "/content[openEHR-EHR-OBSERVATION.laboratory_test.v0]/data[at0001]/events[at0002]/data[at0003]/items[openEHR-EHR-CLUSTER.laboratory_test_panel.v0]/items[at0002]/items[at0001]/value"; String[] ignoreIterativeOnRegexp = {"^content.*", "^events.*"}; IterativeNode iterativeNode = new IterativeNode("IDCR - Laboratory Test Report.v0", introspectCache, Arrays.asList(ignoreIterativeOnRegexp), 1); Integer[] result = iterativeNode.iterativeAt(Locatable.dividePathIntoSegments(valuePointPath)); assertEquals((Integer)6, result[0]); }
public Integer[] iterativeAt(List<String> segmentedPath) throws Exception { int marked = 0; List<Integer> retarray = new ArrayList<>(); if (unbounded.size() == 0) { retarray.add(-1); } else { String path = "/" + String.join("/", compact(segmentedPath)); for (int i = unbounded.size() - 1; i >= 0; i--) { Map mapEntry = unbounded.get(i); String aql_path = (String) mapEntry.get("aql_path"); List<String> aqlPathSegments = Locatable.dividePathIntoSegments(aql_path); boolean ignoreThisAqlPath = false; if (ignoreIterativeNode != null && ignoreIterativeNode.size() > 0) { for (String ignoreItemRegex : ignoreIterativeNode) { if (aqlPathSegments.get(aqlPathSegments.size() - 1).matches(ignoreItemRegex)) { ignoreThisAqlPath = true; break; } } } if (ignoreThisAqlPath) continue; if (path.startsWith(aql_path)) { int pos = aqlPathInJsonbArray(aqlPathSegments, segmentedPath); retarray.add(pos); if (++marked >= depth) break; } } } retarray.sort(Comparator.<Integer>naturalOrder()); return retarray.toArray(new Integer[0]); }
IterativeNode implements I_IterativeNode { public Integer[] iterativeAt(List<String> segmentedPath) throws Exception { int marked = 0; List<Integer> retarray = new ArrayList<>(); if (unbounded.size() == 0) { retarray.add(-1); } else { String path = "/" + String.join("/", compact(segmentedPath)); for (int i = unbounded.size() - 1; i >= 0; i--) { Map mapEntry = unbounded.get(i); String aql_path = (String) mapEntry.get("aql_path"); List<String> aqlPathSegments = Locatable.dividePathIntoSegments(aql_path); boolean ignoreThisAqlPath = false; if (ignoreIterativeNode != null && ignoreIterativeNode.size() > 0) { for (String ignoreItemRegex : ignoreIterativeNode) { if (aqlPathSegments.get(aqlPathSegments.size() - 1).matches(ignoreItemRegex)) { ignoreThisAqlPath = true; break; } } } if (ignoreThisAqlPath) continue; if (path.startsWith(aql_path)) { int pos = aqlPathInJsonbArray(aqlPathSegments, segmentedPath); retarray.add(pos); if (++marked >= depth) break; } } } retarray.sort(Comparator.<Integer>naturalOrder()); return retarray.toArray(new Integer[0]); } }
IterativeNode implements I_IterativeNode { public Integer[] iterativeAt(List<String> segmentedPath) throws Exception { int marked = 0; List<Integer> retarray = new ArrayList<>(); if (unbounded.size() == 0) { retarray.add(-1); } else { String path = "/" + String.join("/", compact(segmentedPath)); for (int i = unbounded.size() - 1; i >= 0; i--) { Map mapEntry = unbounded.get(i); String aql_path = (String) mapEntry.get("aql_path"); List<String> aqlPathSegments = Locatable.dividePathIntoSegments(aql_path); boolean ignoreThisAqlPath = false; if (ignoreIterativeNode != null && ignoreIterativeNode.size() > 0) { for (String ignoreItemRegex : ignoreIterativeNode) { if (aqlPathSegments.get(aqlPathSegments.size() - 1).matches(ignoreItemRegex)) { ignoreThisAqlPath = true; break; } } } if (ignoreThisAqlPath) continue; if (path.startsWith(aql_path)) { int pos = aqlPathInJsonbArray(aqlPathSegments, segmentedPath); retarray.add(pos); if (++marked >= depth) break; } } } retarray.sort(Comparator.<Integer>naturalOrder()); return retarray.toArray(new Integer[0]); } IterativeNode(String templateId, I_IntrospectCache introspectCache, List<String> ignoreIterativeNode, int depth); }
IterativeNode implements I_IterativeNode { public Integer[] iterativeAt(List<String> segmentedPath) throws Exception { int marked = 0; List<Integer> retarray = new ArrayList<>(); if (unbounded.size() == 0) { retarray.add(-1); } else { String path = "/" + String.join("/", compact(segmentedPath)); for (int i = unbounded.size() - 1; i >= 0; i--) { Map mapEntry = unbounded.get(i); String aql_path = (String) mapEntry.get("aql_path"); List<String> aqlPathSegments = Locatable.dividePathIntoSegments(aql_path); boolean ignoreThisAqlPath = false; if (ignoreIterativeNode != null && ignoreIterativeNode.size() > 0) { for (String ignoreItemRegex : ignoreIterativeNode) { if (aqlPathSegments.get(aqlPathSegments.size() - 1).matches(ignoreItemRegex)) { ignoreThisAqlPath = true; break; } } } if (ignoreThisAqlPath) continue; if (path.startsWith(aql_path)) { int pos = aqlPathInJsonbArray(aqlPathSegments, segmentedPath); retarray.add(pos); if (++marked >= depth) break; } } } retarray.sort(Comparator.<Integer>naturalOrder()); return retarray.toArray(new Integer[0]); } IterativeNode(String templateId, I_IntrospectCache introspectCache, List<String> ignoreIterativeNode, int depth); Integer[] iterativeAt(List<String> segmentedPath); List<String> clipInIterativeMarker(List<String> segmentedPath, Integer[] clipPos); }
IterativeNode implements I_IterativeNode { public Integer[] iterativeAt(List<String> segmentedPath) throws Exception { int marked = 0; List<Integer> retarray = new ArrayList<>(); if (unbounded.size() == 0) { retarray.add(-1); } else { String path = "/" + String.join("/", compact(segmentedPath)); for (int i = unbounded.size() - 1; i >= 0; i--) { Map mapEntry = unbounded.get(i); String aql_path = (String) mapEntry.get("aql_path"); List<String> aqlPathSegments = Locatable.dividePathIntoSegments(aql_path); boolean ignoreThisAqlPath = false; if (ignoreIterativeNode != null && ignoreIterativeNode.size() > 0) { for (String ignoreItemRegex : ignoreIterativeNode) { if (aqlPathSegments.get(aqlPathSegments.size() - 1).matches(ignoreItemRegex)) { ignoreThisAqlPath = true; break; } } } if (ignoreThisAqlPath) continue; if (path.startsWith(aql_path)) { int pos = aqlPathInJsonbArray(aqlPathSegments, segmentedPath); retarray.add(pos); if (++marked >= depth) break; } } } retarray.sort(Comparator.<Integer>naturalOrder()); return retarray.toArray(new Integer[0]); } IterativeNode(String templateId, I_IntrospectCache introspectCache, List<String> ignoreIterativeNode, int depth); Integer[] iterativeAt(List<String> segmentedPath); List<String> clipInIterativeMarker(List<String> segmentedPath, Integer[] clipPos);  }