private static String conf(ElementDefinitionBindingComponent def) { switch (def.getStrength()) { case EXAMPLE: return "For example codes, see "; case PREFERRED: return "The codes SHOULD be taken from "; case EXTENSIBLE: return "The codes SHALL be taken from "; case REQUIRED: return "The codes SHALL be taken from "; default: return "??"; } }
public static String describeBinding( String prefix, ElementDefinitionBindingComponent def, PageProcessor page) throws Exception { if (!def.hasValueSet()) return def.getDescription(); String ref = def.getValueSet() instanceof UriType ? ((UriType) def.getValueSet()).asStringValue() : ((Reference) def.getValueSet()).getReference(); ValueSet vs = page.getValueSets().get(ref); if (vs != null) { String pp = (String) vs.getUserData("path"); return def.getDescription() + "<br/>" + conf(def) + "<a href=\"" + prefix + pp.replace(File.separatorChar, '/') + "\">" + vs.getName() + "</a>" + confTail(def); } if (ref.startsWith("http:") || ref.startsWith("https:")) return def.getDescription() + "<br/>" + conf(def) + " <a href=\"" + ref + "\">" + ref + "</a>" + confTail(def); else return def.getDescription() + "<br/>" + conf(def) + " ?? Broken Reference to " + ref + " ??" + confTail(def); }
private static String confTail(ElementDefinitionBindingComponent def) { if (def.getStrength() == BindingStrength.EXTENSIBLE) return "; other codes may be used where these codes are not suitable"; else return ""; }