performance related changes
This commit is contained in:
parent
e9d10baba2
commit
ae13abfc2a
|
@ -98,7 +98,7 @@ public class JavaExtensionsFactoryGenerator extends JavaBaseGenerator {
|
||||||
ElementDefinition edRoot = sd.getSnapshot().getElementFirstRep();
|
ElementDefinition edRoot = sd.getSnapshot().getElementFirstRep();
|
||||||
boolean repeats = !edRoot.getMax().equals("1");
|
boolean repeats = !edRoot.getMax().equals("1");
|
||||||
String verb = repeats ? "add" : "set";
|
String verb = repeats ? "add" : "set";
|
||||||
ElementDefinition edValue = sd.getSnapshot().getElementByPath("Extension.value[x]");
|
ElementDefinition edValue = sd.getSnapshot().getElementByPath("Extension.value[x]", false);
|
||||||
List<TypeTuple> types = analyseTypes(edValue);
|
List<TypeTuple> types = analyseTypes(edValue);
|
||||||
if (types.size() > 5) {
|
if (types.size() > 5) {
|
||||||
src.append(" public static Extension make"+name+"(DataType value) {\r\n");
|
src.append(" public static Extension make"+name+"(DataType value) {\r\n");
|
||||||
|
|
|
@ -338,7 +338,7 @@ public class DataRenderer extends Renderer {
|
||||||
StructureDefinition sd = getContext().getWorker().fetchTypeDefinition(t);
|
StructureDefinition sd = getContext().getWorker().fetchTypeDefinition(t);
|
||||||
if (sd == null)
|
if (sd == null)
|
||||||
return false;
|
return false;
|
||||||
if (Utilities.existsInList(t, VersionUtilities.getCanonicalResourceNames(getContext().getWorker().getVersion()))) {
|
if (VersionUtilities.getCanonicalResourceNames(getContext().getWorker().getVersion()).contains(t)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Utilities.existsInList(t,
|
if (Utilities.existsInList(t,
|
||||||
|
|
|
@ -3969,12 +3969,12 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
if (!isExtensionDefinition(sd)) {
|
if (!isExtensionDefinition(sd)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ElementDefinition value = sd.getSnapshot().getElementByPath("Extension.value");
|
ElementDefinition value = sd.getSnapshot().getElementByPath("Extension.value", true);
|
||||||
return value != null && !value.isProhibited();
|
return value != null && !value.isProhibited();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isModifierExtension(StructureDefinition sd) {
|
public static boolean isModifierExtension(StructureDefinition sd) {
|
||||||
ElementDefinition defn = sd.getSnapshot().getElementByPath("Extension");
|
ElementDefinition defn = sd.getSnapshot().getElementByPath("Extension", true);
|
||||||
return defn.getIsModifier();
|
return defn.getIsModifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1457,7 +1457,7 @@ public class Element extends Base {
|
||||||
if (property.getStructure().hasExtension(ToolingExtensions.EXT_RESOURCE_IMPLEMENTS)) {
|
if (property.getStructure().hasExtension(ToolingExtensions.EXT_RESOURCE_IMPLEMENTS)) {
|
||||||
StructureDefinition sd = property.getContext().fetchResource(StructureDefinition.class, ExtensionsUtils.getExtensionString(property.getStructure(), ToolingExtensions.EXT_RESOURCE_IMPLEMENTS));
|
StructureDefinition sd = property.getContext().fetchResource(StructureDefinition.class, ExtensionsUtils.getExtensionString(property.getStructure(), ToolingExtensions.EXT_RESOURCE_IMPLEMENTS));
|
||||||
if (sd != null) {
|
if (sd != null) {
|
||||||
ElementDefinition ed = sd.getSnapshot().getElementByPath(property.getDefinition().getPath().replace(property.getStructure().getType(), sd.getType()));
|
ElementDefinition ed = sd.getSnapshot().getElementByPath(property.getDefinition().getPath().replace(property.getStructure().getType(), sd.getType()), true);
|
||||||
if (ed != null) {
|
if (ed != null) {
|
||||||
return ed.getBase().getPath();
|
return ed.getBase().getPath();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1233,12 +1233,15 @@ public class StructureDefinition extends CanonicalResource {
|
||||||
|
|
||||||
// added from java-adornments.txt:
|
// added from java-adornments.txt:
|
||||||
|
|
||||||
public ElementDefinition getElementByPath(String path) {
|
public ElementDefinition getElementByPath(String path, boolean autoChoice) {
|
||||||
|
if (autoChoice && path.endsWith("[x]")) {
|
||||||
|
path = path.substring(0, path.length()-3);
|
||||||
|
}
|
||||||
if (path == null) {
|
if (path == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
for (ElementDefinition ed : getElement()) {
|
for (ElementDefinition ed : getElement()) {
|
||||||
if (path.equals(ed.getPath()) || (path+"[x]").equals(ed.getPath())) {
|
if (path.equals(ed.getPath()) || (autoChoice && (path+"[x]").equals(ed.getPath()))) {
|
||||||
return ed;
|
return ed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ public abstract class PEDefinition {
|
||||||
type= type.substring(0, type.indexOf("."));
|
type= type.substring(0, type.indexOf("."));
|
||||||
}
|
}
|
||||||
StructureDefinition sd = builder.getContext().fetchTypeDefinition(type);
|
StructureDefinition sd = builder.getContext().fetchTypeDefinition(type);
|
||||||
return sd.getSnapshot().getElementByPath(definition.getBase().getPath());
|
return sd.getSnapshot().getElementByPath(definition.getBase().getPath(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,8 +21,8 @@ public class PEDefinitionExtension extends PEDefinition {
|
||||||
super(builder, name, profile, definition, ppath);
|
super(builder, name, profile, definition, ppath);
|
||||||
this.sliceDefinition = sliceDefinition;
|
this.sliceDefinition = sliceDefinition;
|
||||||
this.extension= extension;
|
this.extension= extension;
|
||||||
eed = extension.getSnapshot().getElementByPath("Extension.extension");
|
eed = extension.getSnapshot().getElementByPath("Extension.extension", true);
|
||||||
ved = extension.getSnapshot().getElementByPath("Extension.value[x]");
|
ved = extension.getSnapshot().getElementByPath("Extension.value[x]", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -375,7 +375,7 @@ public class DataRenderer extends Renderer implements CodeResolver {
|
||||||
StructureDefinition sd = getContext().getWorker().fetchTypeDefinition(t);
|
StructureDefinition sd = getContext().getWorker().fetchTypeDefinition(t);
|
||||||
if (sd == null)
|
if (sd == null)
|
||||||
return false;
|
return false;
|
||||||
if (Utilities.existsInList(t, VersionUtilities.getCanonicalResourceNames(getContext().getWorker().getVersion()))) {
|
if (VersionUtilities.getCanonicalResourceNames(getContext().getWorker().getVersion()).contains(t)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Utilities.existsInList(t,
|
if (Utilities.existsInList(t,
|
||||||
|
|
|
@ -32,6 +32,7 @@ package org.hl7.fhir.r5.terminologies.validation;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -471,10 +472,12 @@ public class ValueSetValidator {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final HashSet<String> SERVER_SIDE_LIST = new HashSet<>(Arrays.asList("http://fdasis.nlm.nih.gov", "http://hl7.org/fhir/sid/ndc", "http://loinc.org", "http://snomed.info/sct", "http://unitsofmeasure.org",
|
||||||
|
"http://unstats.un.org/unsd/methods/m49/m49.htm", "http://varnomen.hgvs.org", "http://www.nlm.nih.gov/research/umls/rxnorm", "https://www.usps.com/",
|
||||||
|
"urn:ietf:bcp:13","urn:ietf:bcp:47","urn:ietf:rfc:3986", "urn:iso:std:iso:3166","urn:iso:std:iso:4217", "urn:oid:1.2.36.1.2001.1005.17"));
|
||||||
|
|
||||||
private boolean preferServerSide(String system) {
|
private boolean preferServerSide(String system) {
|
||||||
if (Utilities.existsInList(system, "http://fdasis.nlm.nih.gov", "http://hl7.org/fhir/sid/ndc", "http://loinc.org", "http://snomed.info/sct", "http://unitsofmeasure.org",
|
if (SERVER_SIDE_LIST.contains(system)) {
|
||||||
"http://unstats.un.org/unsd/methods/m49/m49.htm", "http://varnomen.hgvs.org", "http://www.nlm.nih.gov/research/umls/rxnorm", "https://www.usps.com/",
|
|
||||||
"urn:ietf:bcp:13","urn:ietf:bcp:47","urn:ietf:rfc:3986", "urn:iso:std:iso:3166","urn:iso:std:iso:4217", "urn:oid:1.2.36.1.2001.1005.17")) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,9 @@ package org.hl7.fhir.r5.utils;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class BuildExtensions extends ToolingExtensions {
|
public class BuildExtensions extends ToolingExtensions {
|
||||||
|
|
||||||
|
@ -51,19 +53,24 @@ public class BuildExtensions extends ToolingExtensions {
|
||||||
public static final String EXT_BINDING_NAME = "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName";
|
public static final String EXT_BINDING_NAME = "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName";
|
||||||
|
|
||||||
|
|
||||||
public static List<String> allConsts() {
|
private static Set<String> cachedConsts;
|
||||||
List<String> list = new ArrayList<>();
|
|
||||||
for (Field field : BuildExtensions.class.getDeclaredFields()) {
|
public static Set<String> allConsts() {
|
||||||
int modifiers = field.getModifiers();
|
if (cachedConsts == null) {
|
||||||
if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) {
|
Set<String> list = new HashSet<>();
|
||||||
try {
|
for (Field field : BuildExtensions.class.getDeclaredFields()) {
|
||||||
list.add(field.get(field.getType()).toString());
|
int modifiers = field.getModifiers();
|
||||||
} catch (Exception e) {
|
if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) {
|
||||||
|
try {
|
||||||
|
list.add(field.get(field.getType()).toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
list.addAll(ToolingExtensions.allConsts());
|
||||||
|
cachedConsts = list;
|
||||||
}
|
}
|
||||||
list.addAll(ToolingExtensions.allConsts());
|
return cachedConsts;
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,8 @@ import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.fhir.ucum.Utilities;
|
import org.fhir.ucum.Utilities;
|
||||||
|
@ -236,8 +238,6 @@ public class ToolingExtensions {
|
||||||
public static final String EXT_MAPPING_TGTTYPE = "http://hl7.org/fhir/tools/StructureDefinition/conceptmap-target-type";
|
public static final String EXT_MAPPING_TGTTYPE = "http://hl7.org/fhir/tools/StructureDefinition/conceptmap-target-type";
|
||||||
public static final String EXT_MAPPING_TGTCARD = "http://hl7.org/fhir/tools/StructureDefinition/conceptmap-target-cardinality";
|
public static final String EXT_MAPPING_TGTCARD = "http://hl7.org/fhir/tools/StructureDefinition/conceptmap-target-cardinality";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static final String WEB_EXTENSION_STYLE = "http://build.fhir.org/ig/FHIR/fhir-tools-ig/format-extensions.html#extension-related-extensions";
|
public static final String WEB_EXTENSION_STYLE = "http://build.fhir.org/ig/FHIR/fhir-tools-ig/format-extensions.html#extension-related-extensions";
|
||||||
public static final String EXT_IGDEP_COMMENT = "http://hl7.org/fhir/tools/StructureDefinition/implementationguide-dependency-comment";
|
public static final String EXT_IGDEP_COMMENT = "http://hl7.org/fhir/tools/StructureDefinition/implementationguide-dependency-comment";
|
||||||
public static final String EXT_XPATH_CONSTRAINT = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ElementDefinition.constraint.xpath";
|
public static final String EXT_XPATH_CONSTRAINT = "http://hl7.org/fhir/4.0/StructureDefinition/extension-ElementDefinition.constraint.xpath";
|
||||||
|
@ -1029,20 +1029,23 @@ public class ToolingExtensions {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> allConsts() {
|
private static Set<String> cachedConsts;
|
||||||
|
|
||||||
List<String> list = new ArrayList<>();
|
public static Set<String> allConsts() {
|
||||||
for (Field field : ToolingExtensions.class.getDeclaredFields()) {
|
if (cachedConsts == null) {
|
||||||
int modifiers = field.getModifiers();
|
Set<String> list = new HashSet<>();
|
||||||
if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) {
|
for (Field field : ToolingExtensions.class.getDeclaredFields()) {
|
||||||
try {
|
int modifiers = field.getModifiers();
|
||||||
list.add(field.get(field.getType()).toString());
|
if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) {
|
||||||
} catch (Exception e) {
|
try {
|
||||||
|
list.add(field.get(field.getType()).toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
cachedConsts = list;
|
||||||
}
|
}
|
||||||
return list;
|
return cachedConsts;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasExtensions(ElementDefinition d, String... urls) {
|
public static boolean hasExtensions(ElementDefinition d, String... urls) {
|
||||||
|
|
|
@ -2,6 +2,8 @@ package org.hl7.fhir.utilities;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
|
@ -393,8 +395,10 @@ public class VersionUtilities {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<String> getCanonicalResourceNames(String version) {
|
|
||||||
ArrayList<String> res = new ArrayList<String>();
|
public static Set<String> getCanonicalResourceNames(String version) {
|
||||||
|
|
||||||
|
Set<String> res = new HashSet<String>();
|
||||||
if (isR2Ver(version) || isR2BVer(version)) {
|
if (isR2Ver(version) || isR2BVer(version)) {
|
||||||
res.add("ValueSet");
|
res.add("ValueSet");
|
||||||
res.add("ConceptMap");
|
res.add("ConceptMap");
|
||||||
|
|
|
@ -1031,7 +1031,7 @@ public class BaseValidator implements IValidationContextResourceLoader {
|
||||||
if (!Utilities.isAbsoluteUrl(ref)) {
|
if (!Utilities.isAbsoluteUrl(ref)) {
|
||||||
String[] p = ref.split("\\/");
|
String[] p = ref.split("\\/");
|
||||||
List<Element> ml = new ArrayList<>();
|
List<Element> ml = new ArrayList<>();
|
||||||
if (p.length >= 2 && Utilities.existsInList(p[0], context.getResourceNames()) && Utilities.isValidId(p[1])) {
|
if (p.length >= 2 && context.getResourceNamesAsSet().contains(p[0]) && Utilities.isValidId(p[1])) {
|
||||||
for (int i = 0; i < entries.size(); i++) {
|
for (int i = 0; i < entries.size(); i++) {
|
||||||
Element we = entries.get(i);
|
Element we = entries.get(i);
|
||||||
Element r = we.getNamedChild(RESOURCE);
|
Element r = we.getNamedChild(RESOURCE);
|
||||||
|
|
|
@ -42,6 +42,7 @@ import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -260,6 +261,29 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
private static final boolean STACK_TRACE = false;
|
private static final boolean STACK_TRACE = false;
|
||||||
private static final boolean DEBUG_ELEMENT = false;
|
private static final boolean DEBUG_ELEMENT = false;
|
||||||
|
|
||||||
|
private static final HashSet<String> NO_TX_SYSTEM_EXEMPT = new HashSet<>(Arrays.asList("http://loinc.org", "http://unitsofmeasure.org", "http://hl7.org/fhir/sid/icd-9-cm", "http://snomed.info/sct", "http://www.nlm.nih.gov/research/umls/rxnorm"));
|
||||||
|
private static final HashSet<String> NO_HTTPS_LIST = new HashSet<>(Arrays.asList("https://loinc.org", "https://unitsofmeasure.org", "https://snomed.info/sct", "https://www.nlm.nih.gov/research/umls/rxnorm"));
|
||||||
|
private static final HashSet<String> EXTENSION_CONTEXT_LIST = new HashSet<>(Arrays.asList("ElementDefinition.example.value", "ElementDefinition.pattern", "ElementDefinition.fixed"));
|
||||||
|
private static final HashSet<String> ID_EXEMPT_LIST = new HashSet<>(Arrays.asList("id", "base64Binary", "markdown"));
|
||||||
|
private static final HashSet<String> HTML_ELEMENTS = new HashSet<>(Arrays.asList(
|
||||||
|
"p", "br", "div", "h1", "h2", "h3", "h4", "h5", "h6", "a", "span", "b", "em", "i", "strong",
|
||||||
|
"small", "big", "tt", "small", "dfn", "q", "var", "abbr", "acronym", "cite", "blockquote", "hr", "address", "bdo", "kbd", "q", "sub", "sup",
|
||||||
|
"ul", "ol", "li", "dl", "dt", "dd", "pre", "table", "caption", "colgroup", "col", "thead", "tr", "tfoot", "tbody", "th", "td",
|
||||||
|
"code", "samp", "img", "map", "area"));
|
||||||
|
private static final HashSet<String> HTML_ATTRIBUTES = new HashSet<>(Arrays.asList(
|
||||||
|
"title", "style", "class", "id", "lang", "xml:lang", "dir", "accesskey", "tabindex",
|
||||||
|
// tables
|
||||||
|
"span", "width", "align", "valign", "char", "charoff", "abbr", "axis", "headers", "scope", "rowspan", "colspan"));
|
||||||
|
|
||||||
|
private static final HashSet<String> HTML_COMBO_LIST = new HashSet<>(Arrays.asList(
|
||||||
|
"a.href", "a.name", "img.src", "img.border", "div.xmlns", "blockquote.cite", "q.cite",
|
||||||
|
"a.charset", "a.type", "a.name", "a.href", "a.hreflang", "a.rel", "a.rev", "a.shape", "a.coords", "img.src",
|
||||||
|
"img.alt", "img.longdesc", "img.height", "img.width", "img.usemap", "img.ismap", "map.name", "area.shape",
|
||||||
|
"area.coords", "area.href", "area.nohref", "area.alt", "table.summary", "table.width", "table.border",
|
||||||
|
"table.frame", "table.rules", "table.cellspacing", "table.cellpadding", "pre.space", "td.nowrap"));
|
||||||
|
private static final HashSet<String> HTML_BLOCK_LIST = new HashSet<>(Arrays.asList("div", "blockquote", "table", "ol", "ul", "p"));
|
||||||
|
private static final HashSet<String> RESOURCE_X_POINTS = new HashSet<>(Arrays.asList("Bundle.entry.resource", "Bundle.entry.response.outcome", "DomainResource.contained", "Parameters.parameter.resource", "Parameters.parameter.part.resource"));
|
||||||
|
|
||||||
private class ValidatorHostServices implements IEvaluationContext {
|
private class ValidatorHostServices implements IEvaluationContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1024,7 +1048,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (context.isNoTerminologyServer() && Utilities.existsInList(system, "http://loinc.org", "http://unitsofmeasure.org", "http://hl7.org/fhir/sid/icd-9-cm", "http://snomed.info/sct", "http://www.nlm.nih.gov/research/umls/rxnorm")) {
|
} else if (context.isNoTerminologyServer() && NO_TX_SYSTEM_EXEMPT.contains(system)) {
|
||||||
return true; // no checks in this case
|
return true; // no checks in this case
|
||||||
} else if (startsWithButIsNot(system, "http://snomed.info/sct", "http://loinc.org", "http://unitsofmeasure.org", "http://www.nlm.nih.gov/research/umls/rxnorm")) {
|
} else if (startsWithButIsNot(system, "http://snomed.info/sct", "http://loinc.org", "http://unitsofmeasure.org", "http://www.nlm.nih.gov/research/umls/rxnorm")) {
|
||||||
rule(errors, NO_RULE_DATE, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_SYSTEM_INVALID, system);
|
rule(errors, NO_RULE_DATE, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_SYSTEM_INVALID, system);
|
||||||
|
@ -1039,7 +1063,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
if (system.startsWith("https:") && system.length() > 7) {
|
if (system.startsWith("https:") && system.length() > 7) {
|
||||||
String ns = "http:"+system.substring(6);
|
String ns = "http:"+system.substring(6);
|
||||||
CodeSystem cs = getCodeSystem(ns);
|
CodeSystem cs = getCodeSystem(ns);
|
||||||
if (cs != null || Utilities.existsInList(system, "https://loinc.org", "https://unitsofmeasure.org", "https://snomed.info/sct", "https://www.nlm.nih.gov/research/umls/rxnorm")) {
|
if (cs != null || NO_HTTPS_LIST.contains(system)) {
|
||||||
rule(errors, NO_RULE_DATE, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_SYSTEM_HTTPS, system);
|
rule(errors, NO_RULE_DATE, IssueType.CODEINVALID, element.line(), element.col(), path, false, I18nConstants.TERMINOLOGY_TX_SYSTEM_HTTPS, system);
|
||||||
done = true;
|
done = true;
|
||||||
}
|
}
|
||||||
|
@ -1868,7 +1892,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
}
|
}
|
||||||
} else if (SpecialExtensions.isKnownExtension(url)) {
|
} else if (SpecialExtensions.isKnownExtension(url)) {
|
||||||
ex = SpecialExtensions.getDefinition(url);
|
ex = SpecialExtensions.getDefinition(url);
|
||||||
} else if (Utilities.existsInList(url, BuildExtensions.allConsts())) {
|
} else if (BuildExtensions.allConsts().contains(url)) {
|
||||||
// nothing
|
// nothing
|
||||||
} else if (rule(errors, NO_RULE_DATE, IssueType.STRUCTURE, element.line(), element.col(), path, allowUnknownExtension(url), I18nConstants.EXTENSION_EXT_UNKNOWN_NOTHERE, url)) {
|
} else if (rule(errors, NO_RULE_DATE, IssueType.STRUCTURE, element.line(), element.col(), path, allowUnknownExtension(url), I18nConstants.EXTENSION_EXT_UNKNOWN_NOTHERE, url)) {
|
||||||
hint(errors, NO_RULE_DATE, IssueType.STRUCTURE, element.line(), element.col(), path, isKnownExtension(url), I18nConstants.EXTENSION_EXT_UNKNOWN, url);
|
hint(errors, NO_RULE_DATE, IssueType.STRUCTURE, element.line(), element.col(), path, isKnownExtension(url), I18nConstants.EXTENSION_EXT_UNKNOWN, url);
|
||||||
|
@ -1964,7 +1988,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
for (String s : stack.getLogicalPaths()) {
|
for (String s : stack.getLogicalPaths()) {
|
||||||
String p = stripIndexes(s);
|
String p = stripIndexes(s);
|
||||||
// all extensions are always allowed in ElementDefinition.example.value, and in fixed and pattern values. TODO: determine the logical paths from the path stated in the element definition....
|
// all extensions are always allowed in ElementDefinition.example.value, and in fixed and pattern values. TODO: determine the logical paths from the path stated in the element definition....
|
||||||
if (Utilities.existsInList(p, "ElementDefinition.example.value", "ElementDefinition.pattern", "ElementDefinition.fixed")) {
|
if (EXTENSION_CONTEXT_LIST.contains(p)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
plist.add(p);
|
plist.add(p);
|
||||||
|
@ -2549,9 +2573,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
if (context.hasPattern()) {
|
if (context.hasPattern()) {
|
||||||
ok = checkFixedValue(errors, path, e, context.getPattern(), profile.getVersionedUrl(), context.getSliceName(), null, true) && ok;
|
ok = checkFixedValue(errors, path, e, context.getPattern(), profile.getVersionedUrl(), context.getSliceName(), null, true) && ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (ok && !Utilities.existsInList(e.fhirType(), "id", "base64Binary", "markdown")) { // ids get checked elsewhere
|
if (ok && !ID_EXEMPT_LIST.contains(e.fhirType())) { // ids get checked elsewhere
|
||||||
String regext = FHIRPathExpressionFixer.fixRegex(getRegexFromType(e.fhirType()));
|
String regext = FHIRPathExpressionFixer.fixRegex(getRegexFromType(e.fhirType()));
|
||||||
if (regext != null) {
|
if (regext != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -2757,7 +2780,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
if (!"url".equals(p[1])) {
|
if (!"url".equals(p[1])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return Utilities.existsInList(p[0], VersionUtilities.getCanonicalResourceNames(context.getVersion()));
|
return VersionUtilities.getCanonicalResourceNames(context.getVersion()).contains((p[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean containsHtmlTags(String cnt) {
|
private boolean containsHtmlTags(String cnt) {
|
||||||
|
@ -2852,30 +2875,16 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, !node.getContent().startsWith("DOCTYPE"), I18nConstants.XHTML_XHTML_DOCTYPE_ILLEGAL);
|
rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, !node.getContent().startsWith("DOCTYPE"), I18nConstants.XHTML_XHTML_DOCTYPE_ILLEGAL);
|
||||||
}
|
}
|
||||||
if (node.getNodeType() == NodeType.Element) {
|
if (node.getNodeType() == NodeType.Element) {
|
||||||
rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, Utilities.existsInList(node.getName(),
|
rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, HTML_ELEMENTS.contains(node.getName()), I18nConstants.XHTML_XHTML_ELEMENT_ILLEGAL, node.getName());
|
||||||
"p", "br", "div", "h1", "h2", "h3", "h4", "h5", "h6", "a", "span", "b", "em", "i", "strong",
|
|
||||||
"small", "big", "tt", "small", "dfn", "q", "var", "abbr", "acronym", "cite", "blockquote", "hr", "address", "bdo", "kbd", "q", "sub", "sup",
|
|
||||||
"ul", "ol", "li", "dl", "dt", "dd", "pre", "table", "caption", "colgroup", "col", "thead", "tr", "tfoot", "tbody", "th", "td",
|
|
||||||
"code", "samp", "img", "map", "area"), I18nConstants.XHTML_XHTML_ELEMENT_ILLEGAL, node.getName());
|
|
||||||
|
|
||||||
for (String an : node.getAttributes().keySet()) {
|
for (String an : node.getAttributes().keySet()) {
|
||||||
boolean bok = an.startsWith("xmlns") || Utilities.existsInList(an,
|
boolean bok = an.startsWith("xmlns") || HTML_ATTRIBUTES.contains(an) || HTML_COMBO_LIST.contains(node.getName() + "." + an);
|
||||||
"title", "style", "class", ID, "lang", "xml:lang", "dir", "accesskey", "tabindex",
|
|
||||||
// tables
|
|
||||||
"span", "width", "align", "valign", "char", "charoff", "abbr", "axis", "headers", "scope", "rowspan", "colspan") ||
|
|
||||||
|
|
||||||
Utilities.existsInList(node.getName() + "." + an, "a.href", "a.name", "img.src", "img.border", "div.xmlns", "blockquote.cite", "q.cite",
|
|
||||||
"a.charset", "a.type", "a.name", "a.href", "a.hreflang", "a.rel", "a.rev", "a.shape", "a.coords", "img.src",
|
|
||||||
"img.alt", "img.longdesc", "img.height", "img.width", "img.usemap", "img.ismap", "map.name", "area.shape",
|
|
||||||
"area.coords", "area.href", "area.nohref", "area.alt", "table.summary", "table.width", "table.border",
|
|
||||||
"table.frame", "table.rules", "table.cellspacing", "table.cellpadding", "pre.space", "td.nowrap"
|
|
||||||
);
|
|
||||||
if (!bok) {
|
if (!bok) {
|
||||||
rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, false, I18nConstants.XHTML_XHTML_ATTRIBUTE_ILLEGAL, an, node.getName());
|
rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, false, I18nConstants.XHTML_XHTML_ATTRIBUTE_ILLEGAL, an, node.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ok = rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, !(inPara && Utilities.existsInList(node.getName(), "div", "blockquote", "table", "ol", "ul", "p")) , I18nConstants.XHTML_XHTML_ELEMENT_ILLEGAL_IN_PARA, node.getName()) && ok;
|
ok = rule(errors, NO_RULE_DATE, IssueType.INVALID, e.line(), e.col(), path, !(inPara && HTML_BLOCK_LIST.contains(node.getName())) , I18nConstants.XHTML_XHTML_ELEMENT_ILLEGAL_IN_PARA, node.getName()) && ok;
|
||||||
|
|
||||||
ok = checkInnerNames(errors, e, path, node.getChildNodes(), inPara || "p".equals(node.getName())) && ok;
|
ok = checkInnerNames(errors, e, path, node.getChildNodes(), inPara || "p".equals(node.getName())) && ok;
|
||||||
}
|
}
|
||||||
|
@ -3291,7 +3300,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
refType = "bundled";
|
refType = "bundled";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean conditional = ref.contains("?") && Utilities.existsInList(ref.substring(0, ref.indexOf("?")), context.getResourceNames());
|
boolean conditional = ref.contains("?") && context.getResourceNamesAsSet().contains(ref.substring(0, ref.indexOf("?")));
|
||||||
ReferenceValidationPolicy pol;
|
ReferenceValidationPolicy pol;
|
||||||
if (refType.equals("contained") || refType.equals("bundled")) {
|
if (refType.equals("contained") || refType.equals("bundled")) {
|
||||||
pol = ReferenceValidationPolicy.CHECK_VALID;
|
pol = ReferenceValidationPolicy.CHECK_VALID;
|
||||||
|
@ -5685,7 +5694,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isResourceAndTypes(ElementDefinition ed) {
|
private boolean isResourceAndTypes(ElementDefinition ed) {
|
||||||
if (!Utilities.existsInList(ed.getBase().getPath(), "Bundle.entry.resource", "Bundle.entry.response.outcome", "DomainResource.contained", "Parameters.parameter.resource", "Parameters.parameter.part.resource")) {
|
if (!RESOURCE_X_POINTS.contains(ed.getBase().getPath())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (TypeRefComponent tr : ed.getType()) {
|
for (TypeRefComponent tr : ed.getType()) {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1060,7 +1060,7 @@ public class StructureMapValidator extends BaseValidator {
|
||||||
if (sdt == null) {
|
if (sdt == null) {
|
||||||
throw new Error("Unable to resolve "+url);
|
throw new Error("Unable to resolve "+url);
|
||||||
} else {
|
} else {
|
||||||
ElementDefinition t2 = sdt.getSnapshot().getElementByPath(path);
|
ElementDefinition t2 = sdt.getSnapshot().getElementByPath(path, true);
|
||||||
if (t2 == null) {
|
if (t2 == null) {
|
||||||
throw new Error("Unable to resolve "+path+" in "+url);
|
throw new Error("Unable to resolve "+path+" in "+url);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue