private void checkExtensions(StructureDefinition profile, List<ValidationMessage> errors, String kind, ElementDefinition ec) { if (!ec.getType().isEmpty() && "Extension".equals(ec.getType().get(0).getCode()) && ec.getType().get(0).hasProfile()) { String url = ec.getType().get(0).getProfile(); StructureDefinition defn = context.fetchResource(StructureDefinition.class, url); rule(errors, IssueType.BUSINESSRULE, profile.getId(), defn != null, "Unable to find Extension '"+url+"' referenced at "+profile.getUrl()+" "+kind+" "+ec.getPath()+" ("+ec.getSliceName()+")"); } }
checkInvariants(errors, stack.getLiteralPath(), profile, definition, null, null, resource, element); if (definition.getFixed()!=null) checkFixedValue(errors, stack.getLiteralPath(), element, definition.getFixed(), definition.getSliceName(), null); String location = "Profile " + profile.getUrl() + ", Element '" + stack.getLiteralPath() + "." + tail(ed.getPath()) + (ed.hasSliceName()? "[" + ed.getSliceName() + "]": ""); if (ed.getMin() > 0) { if (problematicPaths.contains(ed.getPath()))
private ElementDefinition getElementByName(List<ElementDefinition> elements, String contentReference) { for (ElementDefinition ed : elements) if (ed.hasSliceName() && ("#"+ed.getSliceName()).equals(contentReference)) return ed; return null; }
checkFixedValue(errors,path,e, context.getFixed(), context.getSliceName(), null);
@Override public int compare(ElementDefinition o1, ElementDefinition o2) { String path1 = normalizePath(o1); String path2 = normalizePath(o2); int cmp = path1.compareTo(path2); if (cmp == 0) { String name1 = o1.hasSliceName() ? o1.getSliceName() : ""; String name2 = o2.hasSliceName() ? o2.getSliceName() : ""; cmp = name1.compareTo(name2); } return cmp; }
public String getUrl() { if (element == defn.getSnapshot().getElement().get(0)) return defn.getUrl(); else return element.getSliceName(); }
@Override public String toString() { if (self.hasSliceName()) return self.getPath()+"("+self.getSliceName()+")"; else return self.getPath(); } }
private String sliceSummary(ElementDefinition ed) { if (!ed.hasSlicing() && !ed.hasSliceName()) return ""; if (ed.hasSliceName()) return " (slicename = "+ed.getSliceName()+")"; StringBuilder b = new StringBuilder(); boolean first = true; for (ElementDefinitionSlicingDiscriminatorComponent d : ed.getSlicing().getDiscriminator()) { if (first) first = false; else b.append("|"); b.append(d.getPath()); } return " (slicing by "+b.toString()+")"; }
private ExtensionContext locateExtension(Class<StructureDefinition> class1, String value) { if (value.contains("#")) { StructureDefinition ext = context.fetchResource(StructureDefinition.class, value.substring(0, value.indexOf("#"))); if (ext == null) return null; String tail = value.substring(value.indexOf("#")+1); ElementDefinition ed = null; for (ElementDefinition ted : ext.getSnapshot().getElement()) { if (tail.equals(ted.getSliceName())) { ed = ted; return new ExtensionContext(ext, ed); } } return null; } else { StructureDefinition ext = context.fetchResource(StructureDefinition.class, value); if (ext == null) return null; else return new ExtensionContext(ext, ext.getSnapshot().getElement().get(0)); } }
private void checkExtensions(StructureDefinition profile, List<ValidationMessage> errors, String kind, ElementDefinition ec) { if (!ec.getType().isEmpty() && "Extension".equals(ec.getType().get(0).getCode()) && ec.getType().get(0).hasProfile()) { String url = ec.getType().get(0).getProfile(); StructureDefinition defn = context.fetchResource(StructureDefinition.class, url); rule(errors, IssueType.BUSINESSRULE, profile.getId(), defn != null, "Unable to find Extension '"+url+"' referenced at "+profile.getUrl()+" "+kind+" "+ec.getPath()+" ("+ec.getSliceName()+")"); } }
paths.remove(paths.size() - 1); String t = ed.hasSliceName() ? tail+":"+checkName(ed.getSliceName()) : /* why do this? name != null ? tail + ":"+checkName(name) : */ tail;
private boolean extensionIsComplex(String value) { if (value.contains("#")) { StructureDefinition ext = context.fetchResource(StructureDefinition.class, value.substring(0, value.indexOf("#"))); if (ext == null) return false; String tail = value.substring(value.indexOf("#")+1); ElementDefinition ed = null; for (ElementDefinition ted : ext.getSnapshot().getElement()) { if (tail.equals(ted.getSliceName())) { ed = ted; break; } } if (ed == null) return false; int i = ext.getSnapshot().getElement().indexOf(ed); int j = i+1; while (j < ext.getSnapshot().getElement().size() && !ext.getSnapshot().getElement().get(j).getPath().equals(ed.getPath())) j++; return j - i > 5; } else { StructureDefinition ext = context.fetchResource(StructureDefinition.class, value); return ext != null && ext.getSnapshot().getElement().size() > 5; } }
public String toString() { if (hasId()) return getId(); if (hasSliceName()) return getPath()+":"+getSliceName(); else return getPath(); }
tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); if (src.hasSliceName()) tgt.setName(src.getSliceName()); else tgt.setName(src.getId());
left.getPieces().add(gen.new Piece("br")); String indent = StringUtils.repeat('\u00A0', 1+2*(element.getPath().split("\\.").length)); left.getPieces().add(gen.new Piece(null, indent + "("+element.getSliceName() + ")", null));
tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); if (src.hasSliceName()) tgt.setName(src.getSliceName()); if (src.hasLabel()) tgt.setLabel(src.getLabel());
lines.add(line); line.addString(ed.getPath()); line.addString(ed.getSliceName()); line.addString(itemList(ed.getAlias())); line.addString(ed.getLabel());
private ElementDefinition overWriteWithCurrent(ElementDefinition profile, ElementDefinition usage) throws FHIRFormatError { ElementDefinition res = profile.copy(); if (usage.hasSliceName()) res.setSliceName(usage.getSliceName()); if (usage.hasLabel()) res.setLabel(usage.getLabel());
tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); if (src.hasSliceName()) tgt.setName(src.getSliceName()); else tgt.setName(src.getId());
tgt.addRepresentation(convertPropertyRepresentation(t.getValue())); if (src.hasSliceName()) tgt.setName(src.getSliceName()); if (src.hasLabel()) tgt.setLabel(src.getLabel());