diff --git a/org.hl7.fhir.convertors/pom.xml b/org.hl7.fhir.convertors/pom.xml index 3a501104a..b4d749c75 100644 --- a/org.hl7.fhir.convertors/pom.xml +++ b/org.hl7.fhir.convertors/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R5ToR5Loader.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R5ToR5Loader.java index 0cdbca665..9518ab1c3 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R5ToR5Loader.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/loaders/loaderR5/R5ToR5Loader.java @@ -138,44 +138,9 @@ public class R5ToR5Loader extends BaseLoaderR5 { patchUrl(ed); } } - // hack errors in R5 ballot - if (r5 instanceof StructureDefinition) { - StructureDefinition sd = (StructureDefinition) r5; - if ("5.0.0-ballot".equals(sd.getVersion()) && "ElementDefinition".equals(sd.getType())) { - for (ElementDefinition ed : sd.getDifferential().getElement()) { - hackEDR5BallotError(ed); - } - for (ElementDefinition ed : sd.getSnapshot().getElement()) { - hackEDR5BallotError(ed); - } - } - if ("5.0.0-ballot".equals(sd.getVersion()) && "Bundle".equals(sd.getType())) { - for (ElementDefinition ed : sd.getDifferential().getElement()) { - hackBundleR5BallotError(ed); - } - for (ElementDefinition ed : sd.getSnapshot().getElement()) { - hackBundleR5BallotError(ed); - } - } - if ("5.0.0-ballot".equals(sd.getVersion()) && "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype".equals(sd.getUrl())) { - sd.getContextFirstRep().setExpression("ElementDefinition"); - } - } return r5; } - private void hackBundleR5BallotError(ElementDefinition ed) { - if (ed.getPath().equals("Bundle.link.relation")) { - ToolingExtensions.removeExtension(ed.getBinding(), ToolingExtensions.EXT_BINDING_NAME); - } - } - - private void hackEDR5BallotError(ElementDefinition ed) { - if (ed.getPath().equals("ElementDefinition.type.code")) { - ed.getBinding().setStrength(BindingStrength.EXTENSIBLE); - } - } - private void patchUrl(ElementDefinition ed) { for (TypeRefComponent tr : ed.getType()) { for (CanonicalType s : tr.getTargetProfile()) { diff --git a/org.hl7.fhir.dstu2/pom.xml b/org.hl7.fhir.dstu2/pom.xml index def8546a2..434687572 100644 --- a/org.hl7.fhir.dstu2/pom.xml +++ b/org.hl7.fhir.dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu2016may/pom.xml b/org.hl7.fhir.dstu2016may/pom.xml index 53413c4d2..63021afb1 100644 --- a/org.hl7.fhir.dstu2016may/pom.xml +++ b/org.hl7.fhir.dstu2016may/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.dstu3/pom.xml b/org.hl7.fhir.dstu3/pom.xml index bc527a127..7fd29c1f8 100644 --- a/org.hl7.fhir.dstu3/pom.xml +++ b/org.hl7.fhir.dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r4/pom.xml b/org.hl7.fhir.r4/pom.xml index e580f01c0..74b827351 100644 --- a/org.hl7.fhir.r4/pom.xml +++ b/org.hl7.fhir.r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r4b/pom.xml b/org.hl7.fhir.r4b/pom.xml index 40ef7e5ae..9587e989c 100644 --- a/org.hl7.fhir.r4b/pom.xml +++ b/org.hl7.fhir.r4b/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/utils/FHIRPathEngine.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/utils/FHIRPathEngine.java index d0f46b80c..46c5b0007 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/utils/FHIRPathEngine.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/utils/FHIRPathEngine.java @@ -569,7 +569,7 @@ public class FHIRPathEngine { return executeType(new ExecutionTypeContext(appContext, resourceType, types, types), types, expr, true); } - private FHIRException makeExceptionPL(Integer num, ExpressionNode holder, String constName, Object... args) { + private FHIRException makeExceptionPlural(Integer num, ExpressionNode holder, String constName, Object... args) { String fmt = worker.formatMessagePlural(num, constName, args); if (location != null) { fmt = fmt + " "+worker.formatMessage(I18nConstants.FHIRPATH_LOCATION, location); @@ -2486,13 +2486,13 @@ public class FHIRPathEngine { return new ArrayList(); } if (left.size() > 1) { - throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "+"); + throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "+"); } if (!left.get(0).isPrimitive()) { throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "+", left.get(0).fhirType()); } if (right.size() > 1) { - throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "+"); + throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "+"); } if (!right.get(0).isPrimitive() && !((left.get(0).isDateTime() || "0".equals(left.get(0).primitiveValue()) || left.get(0).hasType("Quantity")) && right.get(0).hasType("Quantity"))) { throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "+", right.get(0).fhirType()); @@ -2573,13 +2573,13 @@ public class FHIRPathEngine { return new ArrayList(); } if (left.size() > 1) { - throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "*"); + throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "*"); } if (!left.get(0).isPrimitive() && !(left.get(0) instanceof Quantity)) { throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "*", left.get(0).fhirType()); } if (right.size() > 1) { - throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "*"); + throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "*"); } if (!right.get(0).isPrimitive() && !(right.get(0) instanceof Quantity)) { throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "*", right.get(0).fhirType()); @@ -2612,13 +2612,13 @@ public class FHIRPathEngine { private List opConcatenate(List left, List right, ExpressionNode expr) throws PathEngineException { if (left.size() > 1) { - throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "&"); + throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "&"); } if (left.size() > 0 && !left.get(0).hasType(FHIR_TYPES_STRING)) { throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "&", left.get(0).fhirType()); } if (right.size() > 1) { - throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "&"); + throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "&"); } if (right.size() > 0 && !right.get(0).hasType(FHIR_TYPES_STRING)) { throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "&", right.get(0).fhirType()); @@ -2745,13 +2745,13 @@ public class FHIRPathEngine { return new ArrayList(); } if (left.size() > 1) { - throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "-"); + throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "-"); } if (!left.get(0).isPrimitive() && !left.get(0).hasType("Quantity")) { throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "-", left.get(0).fhirType()); } if (right.size() > 1) { - throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "-"); + throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "-"); } if (!right.get(0).isPrimitive() && !((left.get(0).isDateTime() || "0".equals(left.get(0).primitiveValue()) || left.get(0).hasType("Quantity")) && right.get(0).hasType("Quantity"))) { throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "-", right.get(0).fhirType()); @@ -2784,13 +2784,13 @@ public class FHIRPathEngine { return new ArrayList(); } if (left.size() > 1) { - throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "/"); + throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "/"); } if (!left.get(0).isPrimitive() && !(left.get(0) instanceof Quantity)) { throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "/", left.get(0).fhirType()); } if (right.size() > 1) { - throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "/"); + throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "/"); } if (!right.get(0).isPrimitive() && !(right.get(0) instanceof Quantity)) { throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "/", right.get(0).fhirType()); @@ -2830,13 +2830,13 @@ public class FHIRPathEngine { return new ArrayList(); } if (left.size() > 1) { - throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "div"); + throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "div"); } if (!left.get(0).isPrimitive() && !(left.get(0) instanceof Quantity)) { throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "div", left.get(0).fhirType()); } if (right.size() > 1) { - throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "div"); + throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "div"); } if (!right.get(0).isPrimitive() && !(right.get(0) instanceof Quantity)) { throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "div", right.get(0).fhirType()); @@ -2870,13 +2870,13 @@ public class FHIRPathEngine { if (left.size() == 0 || right.size() == 0) { return new ArrayList(); } if (left.size() > 1) { - throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "mod"); + throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "mod"); } if (!left.get(0).isPrimitive()) { throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "mod", left.get(0).fhirType()); } if (right.size() > 1) { - throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "mod"); + throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "mod"); } if (!right.get(0).isPrimitive()) { throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "mod", right.get(0).fhirType()); @@ -3611,7 +3611,7 @@ public class FHIRPathEngine { private List funcSqrt(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "sqrt", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "sqrt", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -3631,7 +3631,7 @@ public class FHIRPathEngine { private List funcAbs(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "abs", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "abs", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -3654,7 +3654,7 @@ public class FHIRPathEngine { private List funcCeiling(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "ceiling", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "ceiling", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -3672,7 +3672,7 @@ public class FHIRPathEngine { private List funcFloor(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "floor", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "floor", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -3695,7 +3695,7 @@ public class FHIRPathEngine { return new ArrayList(); } if (focus.size() > 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "exp", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "exp", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -3716,7 +3716,7 @@ public class FHIRPathEngine { private List funcLn(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "ln", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "ln", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -3736,7 +3736,7 @@ public class FHIRPathEngine { private List funcLog(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "log", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "log", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -3764,7 +3764,7 @@ public class FHIRPathEngine { private List funcPower(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "power", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "power", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -3788,7 +3788,7 @@ public class FHIRPathEngine { private List funcTruncate(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "truncate", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "truncate", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -3806,7 +3806,7 @@ public class FHIRPathEngine { private List funcLowBoundary(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "lowBoundary", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "lowBoundary", focus.size()); } int precision = 0; if (expr.getParameters().size() > 0) { @@ -3836,7 +3836,7 @@ public class FHIRPathEngine { private List funcHighBoundary(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "highBoundary", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "highBoundary", focus.size()); } int precision = 0; if (expr.getParameters().size() > 0) { @@ -3866,7 +3866,7 @@ public class FHIRPathEngine { private List funcPrecision(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "highBoundary", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "highBoundary", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -3884,7 +3884,7 @@ public class FHIRPathEngine { private List funcRound(ExecutionContext context, List focus, ExpressionNode expr) { if (focus.size() != 1) { - throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "round", focus.size()); + throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "round", focus.size()); } Base base = focus.get(0); List result = new ArrayList(); @@ -5794,13 +5794,13 @@ public class FHIRPathEngine { throw makeException(expr, I18nConstants.FHIRPATH_DISCRIMINATOR_RESOLVE_NO_TYPE, element.getElement().getId()); } if (element.getTypes().size() > 1) { - throw makeExceptionPL(element.getTypes().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL, element.getElement().getId()); + throw makeExceptionPlural(element.getTypes().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL, element.getElement().getId()); } if (!element.getTypes().get(0).hasTarget()) { throw makeException(expr, I18nConstants.FHIRPATH_DISCRIMINATOR_RESOLVE_NOT_REFERENCE, element.getElement().getId(), element.getElement().getType().get(0).getCode()+")"); } if (element.getTypes().get(0).getTargetProfile().size() > 1) { - throw makeExceptionPL(element.getTypes().get(0).getTargetProfile().size(), expr, I18nConstants.FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL, element.getElement().getId()); + throw makeExceptionPlural(element.getTypes().get(0).getTargetProfile().size(), expr, I18nConstants.FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL, element.getElement().getId()); } sd = worker.fetchResource(StructureDefinition.class, element.getTypes().get(0).getTargetProfile().get(0).getValue()); if (sd == null) { @@ -5897,10 +5897,10 @@ public class FHIRPathEngine { throw makeException(expr, I18nConstants.FHIRPATH_DISCRIMINATOR_NOTYPE, ed.getElement().getId()); } if (ed.getTypes().size() > 1) { - throw makeExceptionPL(ed.getTypes().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL, ed.getElement().getId()); + throw makeExceptionPlural(ed.getTypes().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL, ed.getElement().getId()); } if (ed.getTypes().get(0).getProfile().size() > 1) { - throw makeExceptionPL(ed.getTypes().get(0).getProfile().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL, ed.getElement().getId()); + throw makeExceptionPlural(ed.getTypes().get(0).getProfile().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL, ed.getElement().getId()); } if (ed.getTypes().get(0).hasProfile()) { return worker.fetchResource(StructureDefinition.class, ed.getTypes().get(0).getProfile().get(0).getValue()); diff --git a/org.hl7.fhir.r5/pom.xml b/org.hl7.fhir.r5/pom.xml index 8f0c6730d..2e6563f12 100644 --- a/org.hl7.fhir.r5/pom.xml +++ b/org.hl7.fhir.r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java index 88a4da1ec..2d1c792bb 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java @@ -40,6 +40,7 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Date; @@ -117,6 +118,7 @@ import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent; import org.hl7.fhir.r5.renderers.TerminologyRenderer; import org.hl7.fhir.r5.renderers.spreadsheets.SpreadsheetGenerator; import org.hl7.fhir.r5.renderers.utils.RenderingContext; +import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType; import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome; import org.hl7.fhir.r5.utils.FHIRLexer; import org.hl7.fhir.r5.utils.FHIRPathEngine; @@ -173,6 +175,10 @@ import org.hl7.fhir.utilities.xml.SchematronWriter.Section; */ public class ProfileUtilities extends TranslatingUtilities { + private static final List INHERITED_ED_URLS = Arrays.asList( + "http://hl7.org/fhir/tools/StructureDefinition/elementdefinition-binding-style", + "http://hl7.org/fhir/tools/StructureDefinition/elementdefinition-extension-style"); + public static class SourcedChildDefinitions { private StructureDefinition source; private List list; @@ -688,6 +694,7 @@ public class ProfileUtilities extends TranslatingUtilities { checkDifferential(derived.getDifferential().getElement(), typeName(derived.getType()), derived.getUrl()); checkDifferentialBaseType(derived); + copyInheritedExtensions(base, derived); // so we have two lists - the base list, and the differential list // the differential list is only allowed to include things that are in the base list, but // is allowed to include them multiple times - thereby slicing them @@ -723,6 +730,13 @@ public class ProfileUtilities extends TranslatingUtilities { ElementDefinition outcome = updateURLs(url, webUrl, e.copy()); e.setUserData(GENERATED_IN_SNAPSHOT, outcome); derived.getSnapshot().addElement(outcome); + if (walksInto(diff.getElement(), e)) { + if (e.getType().size() > 1) { + throw new DefinitionException("Unsupported scenario: specialization walks into multiple types at "+e.getId()); + } else { + addInheritedElementsForSpecialization(derived.getSnapshot(), outcome, outcome.getTypeFirstRep().getWorkingCode(), outcome.getPath(), url, webUrl); + } + } } } } @@ -851,6 +865,42 @@ public class ProfileUtilities extends TranslatingUtilities { } } + + private void copyInheritedExtensions(StructureDefinition base, StructureDefinition derived) { + for (Extension ext : base.getExtension()) { + if (Utilities.existsInList(ext.getUrl(), INHERITED_ED_URLS) && !derived.hasExtension(ext.getUrl())) { + derived.getExtension().add(ext.copy()); + } + } + + } + + private void addInheritedElementsForSpecialization(StructureDefinitionSnapshotComponent snapshot, ElementDefinition focus, String type, String path, String url, String weburl) { + StructureDefinition sd = context.fetchTypeDefinition(type); + if (sd != null) { + addInheritedElementsForSpecialization(snapshot, focus, sd.getBaseDefinition(), path, url, weburl); + for (ElementDefinition ed : sd.getSnapshot().getElement()) { + if (ed.getPath().contains(".")) { + ElementDefinition outcome = updateURLs(url, weburl, ed.copy()); + outcome.setPath(outcome.getPath().replace(sd.getType(), path)); + snapshot.getElement().add(outcome); + } else { + focus.getConstraint().addAll(ed.getConstraint()); + for (Extension ext : ed.getExtension()) { + if (Utilities.existsInList(ext.getUrl(), INHERITED_ED_URLS) && !focus.hasExtension(ext.getUrl())) { + focus.getExtension().add(ext.copy()); + } + } + } + } + } + } + + private boolean walksInto(List list, ElementDefinition ed) { + int i = list.indexOf(ed); + return (i < list.size() - 1) && list.get(i + 1).getPath().startsWith(ed.getPath()+"."); + } + private void fixTypeOfResourceId(StructureDefinition base) { if (base.getKind() == StructureDefinitionKind.RESOURCE && (base.getFhirVersion() == null || VersionUtilities.isR4Plus(base.getFhirVersion().toCode()))) { fixTypeOfResourceId(base.getSnapshot().getElement()); @@ -2935,6 +2985,11 @@ public class ProfileUtilities extends TranslatingUtilities { boolean isExtension = checkExtensionDoco(base); + for (Extension ext : source.getExtension()) { + if (Utilities.existsInList(ext.getUrl(), INHERITED_ED_URLS) && !dest.hasExtension(ext.getUrl())) { + dest.getExtension().add(ext.copy()); + } + } // Before applying changes, apply them to what's in the profile StructureDefinition profile = null; if (base.hasSliceName()) @@ -4234,6 +4289,8 @@ public class ProfileUtilities extends TranslatingUtilities { } else if (hasDef && element.getType().size() > 1) { if (allAreReference(element.getType())) { row.setIcon("icon_reference.png", HierarchicalTableGenerator.TEXT_ICON_REFERENCE); + } else if (element.hasExtension(ToolingExtensions.EXT_JSON_PRIMITIVE_CHOICE)) { + row.setIcon("icon_choice.gif", HierarchicalTableGenerator.TEXT_ICON_CHOICE); } else { row.setIcon("icon_choice.gif", HierarchicalTableGenerator.TEXT_ICON_CHOICE); typesRow = row; @@ -4901,6 +4958,18 @@ public class ProfileUtilities extends TranslatingUtilities { c.getPieces().add(piece); c.getPieces().add(gen.new Piece(null, " is prefixed to the value before validation", null)); } + + if (definition.hasExtension(ToolingExtensions.EXT_EXTENSION_STYLE)) { + if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); } + String es = definition.getExtensionString(ToolingExtensions.EXT_EXTENSION_STYLE); + if ("named-elements".equals(es)) { + if (rc.hasLink(KnownLinkType.JSON_NAMES)) { + c.getPieces().add(gen.new Piece(rc.getLink(KnownLinkType.JSON_NAMES), "This element can be extended by named JSON elements", null)); + } else { + c.getPieces().add(gen.new Piece(ToolingExtensions.WEB_EXTENSION_STYLE, "This element can be extended by named JSON elements", null)); + } + } + } if (definition.hasExtension(ToolingExtensions.EXT_ID_EXPECTATION)) { String ide = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_ID_EXPECTATION); if (ide.equals("optional")) { @@ -4935,26 +5004,44 @@ public class ProfileUtilities extends TranslatingUtilities { if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); } String code = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_JSON_EMPTY); if ("present".equals(code)) { - c.getPieces().add(gen.new Piece(null, "This element is present as a JSON Array even when there are no items in the instance", null)); + c.getPieces().add(gen.new Piece(null, "JSON: This element is present as a JSON Array even when there are no items in the instance", null)); } else { - c.getPieces().add(gen.new Piece(null, "This element may be present as a JSON Array even when there are no items in the instance", null)); + c.getPieces().add(gen.new Piece(null, "JSON: This element may be present as a JSON Array even when there are no items in the instance", null)); } } + String jn = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_JSON_NAME); + if (!Utilities.noString(jn)) { + if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); } + if (definition.getPath().contains(".")) { + c.getPieces().add(gen.new Piece(null, translate("sd.table", "JSON Property Name")+": ", null).addStyle("font-weight:bold")); + c.getPieces().add(gen.new Piece(null, jn, null)); + } else { + c.getPieces().add(gen.new Piece(null, translate("sd.table", "JSON Property Name for Type")+": ", null).addStyle("font-weight:bold")); + Piece piece = gen.new Piece("code"); + piece.addHtml(new XhtmlNode(NodeType.Text).setContent(jn)); + c.getPieces().add(piece); + } + } + + if (ToolingExtensions.readBoolExtension(definition, ToolingExtensions.EXT_JSON_PRIMITIVE_CHOICE)) { + if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); } + c.getPieces().add(gen.new Piece(null, "JSON: The type of this element is inferred from the JSON type in the instance", null)); + } if (ToolingExtensions.readBoolExtension(definition, ToolingExtensions.EXT_JSON_NULLABLE)) { if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); } - c.getPieces().add(gen.new Piece(null, "This object can be represented as null in the JSON structure (which counts as 'present' for cardinality purposes)", null)); + c.getPieces().add(gen.new Piece(null, "JSON: This object can be represented as null in the JSON structure (which counts as 'present' for cardinality purposes)", null)); } if (definition.hasExtension(ToolingExtensions.EXT_JSON_PROP_KEY)) { if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); } String code = ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_JSON_EMPTY); - c.getPieces().add(gen.new Piece(null, "Represented as a single JSON Object with named properties using the value of the "+code+" child as the key", null)); + c.getPieces().add(gen.new Piece(null, "JSON: Represented as a single JSON Object with named properties using the value of the "+code+" child as the key", null)); } if (definition.hasExtension(ToolingExtensions.EXT_TYPE_SPEC)) { for (Extension e : definition.getExtensionsByUrl(ToolingExtensions.EXT_TYPE_SPEC)) { if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); } String cond = ToolingExtensions.readStringExtension(e, "condition"); String type = ToolingExtensions.readStringExtension(e, "type"); - c.getPieces().add(gen.new Piece(null, "If ", null)); + c.getPieces().add(gen.new Piece(null, "JSON: If ", null)); Piece piece = gen.new Piece("code"); piece.addHtml(new XhtmlNode(NodeType.Text).setContent(cond)); c.getPieces().add(piece); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java index 6a34f7860..158b42a3c 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/ContextUtilities.java @@ -22,6 +22,7 @@ import org.hl7.fhir.r5.model.NamingSystem.NamingSystemIdentifierType; import org.hl7.fhir.r5.model.NamingSystem.NamingSystemUniqueIdComponent; import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.r5.utils.XVerExtensionManager; import org.hl7.fhir.r5.model.Identifier; import org.hl7.fhir.r5.model.NamingSystem; @@ -342,5 +343,16 @@ public class ContextUtilities implements ProfileKnowledgeProvider { return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE; } + public StructureDefinition fetchByJsonName(String key) { + for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) { + ElementDefinition ed = sd.getSnapshot().getElementFirstRep(); + if (sd.getKind() == StructureDefinitionKind.LOGICAL && ed != null && ed.hasExtension(ToolingExtensions.EXT_JSON_NAME) && + key.equals(ToolingExtensions.readStringExtension(ed, ToolingExtensions.EXT_JSON_NAME))) { + return sd; + } + } + return null; + } + } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java index bc3996390..0efac0a70 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java @@ -71,6 +71,7 @@ import org.hl7.fhir.r5.terminologies.CodeSystemUtilities; import org.hl7.fhir.r5.terminologies.JurisdictionUtilities; import org.hl7.fhir.r5.terminologies.TerminologyClient; import org.hl7.fhir.r5.utils.validation.IResourceValidator; +import org.hl7.fhir.r5.utils.R5Hacker; import org.hl7.fhir.r5.utils.XVerExtensionManager; import org.hl7.fhir.utilities.CSFileInputStream; import org.hl7.fhir.utilities.TextFile; @@ -112,9 +113,9 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon FileInputStream f = new FileInputStream(filename); try { if (loader != null) { - return (CanonicalResource) loader.loadResource(f, true); + return R5Hacker.fixR5BrokenResource((CanonicalResource) loader.loadResource(f, true)); } else { - return (CanonicalResource) new JsonParser().parse(f); + return R5Hacker.fixR5BrokenResource((CanonicalResource) new JsonParser().parse(f)); } } finally { f.close(); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/JsonParser.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/JsonParser.java index 60a364a44..83f05d481 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/JsonParser.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/JsonParser.java @@ -47,6 +47,7 @@ import java.util.Set; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.r5.conformance.ProfileUtilities; +import org.hl7.fhir.r5.context.ContextUtilities; import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.elementmodel.Element.SpecialElement; import org.hl7.fhir.r5.formats.IParser.OutputStyle; @@ -58,12 +59,14 @@ import org.hl7.fhir.r5.model.Extension; import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.utils.FHIRPathEngine; import org.hl7.fhir.r5.utils.ToolingExtensions; +import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.StringPair; import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.i18n.I18nConstants; import org.hl7.fhir.utilities.json.JsonTrackingParser; import org.hl7.fhir.utilities.json.JsonTrackingParser.LocationData; +import org.hl7.fhir.utilities.json.JsonUtilities; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; import org.hl7.fhir.utilities.xhtml.XhtmlParser; @@ -208,7 +211,13 @@ public class JsonParser extends ParserBase { if (policy != ValidationPolicy.NONE) { for (Entry e : object.entrySet()) { if (!processed.contains(e.getKey())) { - logError(line(e.getValue()), col(e.getValue()), path, IssueType.STRUCTURE, context.formatMessage(I18nConstants.UNRECOGNISED_PROPERTY_, e.getKey()), IssueSeverity.ERROR); + StructureDefinition sd = element.getProperty().isLogical() ? new ContextUtilities(context).fetchByJsonName(e.getKey()) : null; + if (sd != null) { + Property property = new Property(context, sd.getSnapshot().getElementFirstRep(), sd, element.getProperty().getUtils()); + parseChildItem(path, object, element, null, property); + } else { + logError(line(e.getValue()), col(e.getValue()), path, IssueType.STRUCTURE, context.formatMessage(I18nConstants.UNRECOGNISED_PROPERTY_, e.getKey()), IssueSeverity.ERROR); + } } } } @@ -216,25 +225,63 @@ public class JsonParser extends ParserBase { public void parseChildItem(String path, JsonObject object, Element context, Set processed, Property property) { if (property.isChoice() || property.getDefinition().getPath().endsWith("data[x]")) { - for (TypeRefComponent type : property.getDefinition().getType()) { - String eName = property.getName().substring(0, property.getName().length()-3) + Utilities.capitalize(type.getWorkingCode()); - if (!isPrimitive(type.getWorkingCode()) && object.has(eName)) { - parseChildComplex(path, object, context, processed, property, eName); - break; - } else if (isPrimitive(type.getWorkingCode()) && (object.has(eName) || object.has("_"+eName))) { - parseChildPrimitive(object, context, processed, property, path, eName); - break; + if (property.isJsonPrimitiveChoice()) { + if (object.has(property.getJsonName())) { + JsonElement je = object.get(property.getJsonName()); + if (processed != null) processed.add(property.getJsonName()); + String type = getTypeFromJsonType(je); + if (type == null) { + logError(line(je), col(je), path, IssueType.STRUCTURE, this.context.formatMessage(I18nConstants.UNRECOGNISED_PROPERTY_TYPE, describeType(je), property.getName(), property.typeSummary()), IssueSeverity.ERROR); + } else if (property.hasType(type)) { + Property np = new Property(property.getContext(), property.getDefinition(), property.getStructure(), property.getUtils(), type); + parseChildPrimitive(object, context, processed, np, path, property.getName()); + } else { + logError(line(je), col(je), path, IssueType.STRUCTURE, this.context.formatMessage(I18nConstants.UNRECOGNISED_PROPERTY_TYPE_WRONG, describeType(je), property.getName(), type, property.typeSummary()), IssueSeverity.ERROR); + } + } + } else { + for (TypeRefComponent type : property.getDefinition().getType()) { + String eName = property.getJsonName().substring(0, property.getName().length()-3) + Utilities.capitalize(type.getWorkingCode()); + if (!isPrimitive(type.getWorkingCode()) && object.has(eName)) { + parseChildComplex(path, object, context, processed, property, eName); + break; + } else if (isPrimitive(type.getWorkingCode()) && (object.has(eName) || object.has("_"+eName))) { + parseChildPrimitive(object, context, processed, property, path, eName); + break; + } } } } else if (property.isPrimitive(property.getType(null))) { - parseChildPrimitive(object, context, processed, property, path, property.getName()); - } else if (object.has(property.getName())) { - parseChildComplex(path, object, context, processed, property, property.getName()); + parseChildPrimitive(object, context, processed, property, path, property.getJsonName()); + } else if (object.has(property.getJsonName())) { + parseChildComplex(path, object, context, processed, property, property.getJsonName()); + } + } + + private String getTypeFromJsonType(JsonElement je) { + if (je.isJsonPrimitive()) { + JsonPrimitive p = je.getAsJsonPrimitive(); + if (p.isString()) { + return "string"; + } else if (p.isBoolean()) { + return "boolean"; + } else { + String s = p.getAsString(); + if (Utilities.isInteger(s)) { + return "integer"; + } else { + return "decimal"; + } + } + } else { + return null; } } private void parseChildComplex(String path, JsonObject object, Element element, Set processed, Property property, String name) throws FHIRException { - processed.add(name); + if (processed != null) { + processed.add(name); + } String npath = path+"."+property.getName(); String fpath = element.getPath()+"."+property.getName(); JsonElement e = object.get(name); @@ -256,18 +303,18 @@ public class JsonParser extends ParserBase { String code = property.getJsonKeyProperty(); List properties = property.getChildProperties(element.getName(), null); if (properties.size() != 2) { - logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.OBJECT_CANNOT_BE_KEYED_ARRAY_CHILD_COUNT), IssueSeverity.ERROR); + logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.OBJECT_CANNOT_BE_KEYED_ARRAY_CHILD_COUNT, propNames(properties)), IssueSeverity.ERROR); } else { Property propK = properties.get(0); Property propV = properties.get(1); if (!propK.getName().equals(code)) { - logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.OBJECT_CANNOT_BE_KEYED_ARRAY_PROP_NAME), IssueSeverity.ERROR); + logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.OBJECT_CANNOT_BE_KEYED_ARRAY_PROP_NAME, propNames(properties)), IssueSeverity.ERROR); } else if (!propK.isPrimitive()) { - logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.OBJECT_CANNOT_BE_KEYED_ARRAY_PROP_TYPE), IssueSeverity.ERROR); + logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.OBJECT_CANNOT_BE_KEYED_ARRAY_PROP_TYPE, propNames(properties), propK.typeSummary()), IssueSeverity.ERROR); } else if (propV.isList()) { - logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.OBJECT_CANNOT_BE_KEYED_ARRAY_NO_LIST), IssueSeverity.ERROR); - } else if (propV.isChoice()) { - logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.OBJECT_CANNOT_BE_KEYED_ARRAY_NO_CHOICE), IssueSeverity.ERROR); + logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.OBJECT_CANNOT_BE_KEYED_ARRAY_NO_LIST, propV.getName()), IssueSeverity.ERROR); + } else if (propV.isChoice() && propV.getName().endsWith("[x]")) { + logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.OBJECT_CANNOT_BE_KEYED_ARRAY_NO_CHOICE, propV.getName()), IssueSeverity.ERROR); } else if (!(e instanceof JsonObject)) { logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.THIS_PROPERTY_MUST_BE_AN_OBJECT_NOT_, describe(e)), IssueSeverity.ERROR); } else { @@ -288,15 +335,32 @@ public class JsonParser extends ParserBase { n.getChildren().add(nKey); nKey.setValue(pv.getKey()); - // handle the value - String npathV = npathArr+"."+propV.getName(); - String fpathV = fpathArr+"."+propV.getName(); - if (propV.isPrimitive(propV.getType(null))) { - parseChildPrimitiveInstance(n, propV, propV.getName(), npathV, fpathV, pv.getValue(), null); - } else if (pv.getValue() instanceof JsonObject || pv.getValue() instanceof JsonNull) { - parseChildComplexInstance(npathV, fpathV, n, propV, propV.getName(), pv.getValue()); - } else { - logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.THIS_PROPERTY_MUST_BE_AN_OBJECT_NOT_, describe(pv.getValue())), IssueSeverity.ERROR); + + boolean ok = true; + Property pvl = propV; + if (propV.isJsonPrimitiveChoice()) { + ok = false; + String type = getTypeFromJsonType(pv.getValue()); + if (type == null) { + logError(line(pv.getValue()), col(pv.getValue()), path, IssueType.STRUCTURE, this.context.formatMessage(I18nConstants.UNRECOGNISED_PROPERTY_TYPE, describeType(pv.getValue()), propV.getName(), propV.typeSummary()), IssueSeverity.ERROR); + } else if (propV.hasType(type)) { + pvl = new Property(propV.getContext(), propV.getDefinition(), propV.getStructure(), propV.getUtils(), type); + ok = true; + } else { + logError(line(pv.getValue()), col(pv.getValue()), path, IssueType.STRUCTURE, this.context.formatMessage(I18nConstants.UNRECOGNISED_PROPERTY_TYPE_WRONG, describeType(pv.getValue()), propV.getName(), type, propV.typeSummary()), IssueSeverity.ERROR); + } + } + if (ok) { + // handle the value + String npathV = npathArr+"."+pvl.getName(); + String fpathV = fpathArr+"."+pvl.getName(); + if (propV.isPrimitive(pvl.getType(null))) { + parseChildPrimitiveInstance(n, pvl, pvl.getName(), npathV, fpathV, pv.getValue(), null); + } else if (pv.getValue() instanceof JsonObject || pv.getValue() instanceof JsonNull) { + parseChildComplexInstance(npathV, fpathV, n, pvl, pvl.getName(), pv.getValue()); + } else { + logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.THIS_PROPERTY_MUST_BE_AN_OBJECT_NOT_, describe(pv.getValue())), IssueSeverity.ERROR); + } } i++; } @@ -304,22 +368,18 @@ public class JsonParser extends ParserBase { } } else { if (property.isList()) { - logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.THIS_PROPERTY_MUST_BE_AN_ARRAY_NOT_, describeType(e), name, path), IssueSeverity.ERROR); + logError(line(e), col(e), npath, IssueType.INVALID, context.formatMessage(I18nConstants.THIS_PROPERTY_MUST_BE_AN_ARRAY_NOT_, describe(e), name, path), IssueSeverity.ERROR); } parseChildComplexInstance(npath, fpath, element, property, name, e); } } - private String describeType(JsonElement e) { - if (e.isJsonArray()) - return "an Array"; - if (e.isJsonObject()) - return "an Object"; - if (e.isJsonPrimitive()) - return "a primitive property"; - if (e.isJsonNull()) - return "a Null"; - return null; + private Object propNames(List properties) { + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(); + for (Property p: properties) { + b.append(p.getName()); + } + return b.toString(); } private void parseChildComplexInstance(String npath, String fpath, Element element, Property property, String name, JsonElement e) throws FHIRException { @@ -379,15 +439,41 @@ public class JsonParser extends ParserBase { private String describe(JsonElement e) { if (e instanceof JsonArray) { - return "an array"; + return "an Array"; } if (e instanceof JsonObject) { - return "an object"; + return "an Object"; + } + if (e instanceof JsonNull) { + return "a Null"; + } + if (e instanceof JsonPrimitive) { + return "a Primitive property"; + } + return null; + } + + private String describeType(JsonElement e) { + if (e instanceof JsonArray) { + return "array"; + } + if (e instanceof JsonObject) { + return "object"; } if (e instanceof JsonNull) { return "null"; } - return "a primitive property"; + if (e instanceof JsonPrimitive) { + JsonPrimitive p = (JsonPrimitive) e; + if (p.isString()) { + return "string"; + } else if (p.isBoolean()) { + return "boolean"; + } else if (p.isNumber()) { + return "number"; + } + } + return "??"; } private void parseChildPrimitive(JsonObject object, Element element, Set processed, Property property, String path, String name) throws FHIRException { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Property.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Property.java index 7cc8b2e85..00efb531f 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Property.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/elementmodel/Property.java @@ -51,6 +51,7 @@ import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.TypeDetails; import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.r5.utils.TypesUtilities; +import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.StringPair; import org.hl7.fhir.utilities.Utilities; @@ -59,8 +60,8 @@ public class Property { private IWorkerContext context; private ElementDefinition definition; private StructureDefinition structure; - private Boolean canBePrimitive; - private ProfileUtilities profileUtilities; + private ProfileUtilities profileUtilities; + private TypeRefComponent type; public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure, ProfileUtilities profileUtilities) { this.context = context; @@ -70,6 +71,18 @@ public class Property { } + public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure, ProfileUtilities profileUtilities, String type) { + this.context = context; + this.definition = definition; + this.structure = structure; + this.profileUtilities = profileUtilities; + for (TypeRefComponent tr : definition.getType()) { + if (tr.getWorkingCode().equals(type)) { + this.type = tr; + } + } + } + public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure) { this(context, definition, structure, new ProfileUtilities(context, null, null)); } @@ -78,6 +91,14 @@ public class Property { return definition.getPath().substring(definition.getPath().lastIndexOf(".")+1); } + public String getJsonName() { + if (definition.hasExtension(ToolingExtensions.EXT_JSON_NAME)) { + return ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_JSON_NAME); + } else { + return getName(); + } + } + public String getXmlName() { if (definition.hasExtension(ToolingExtensions.EXT_XML_NAME)) { return ToolingExtensions.readStringExtension(definition, ToolingExtensions.EXT_XML_NAME); @@ -101,7 +122,9 @@ public class Property { } public String getType() { - if (definition.getType().size() == 0) + if (type != null) { + return type.getWorkingCode(); + } else if (definition.getType().size() == 0) return null; else if (definition.getType().size() > 1) { String tn = definition.getType().get(0).getWorkingCode(); @@ -115,7 +138,10 @@ public class Property { } public String getType(String elementName) { - if (!definition.getPath().contains(".")) + if (type != null) { + return type.getWorkingCode(); + } + if (!definition.getPath().contains(".")) return definition.getPath(); ElementDefinition ed = definition; if (definition.hasContentReference()) { @@ -175,9 +201,18 @@ public class Property { } public boolean hasType(String elementName) { - if (definition.getType().size() == 0) + if (type != null) { + return false; // ? + } else if (definition.getType().size() == 0) { return false; - else if (definition.getType().size() > 1) { + } else if (isJsonPrimitiveChoice()) { + for (TypeRefComponent tr : definition.getType()) { + if (elementName.equals(tr.getWorkingCode())) { + return true; + } + } + return false; + } else if (definition.getType().size() > 1) { String t = definition.getType().get(0).getCode(); boolean all = true; for (TypeRefComponent tr : definition.getType()) { @@ -188,7 +223,7 @@ public class Property { return true; String tail = definition.getPath().substring(definition.getPath().lastIndexOf(".")+1); if (tail.endsWith("[x]") && elementName.startsWith(tail.substring(0, tail.length()-3))) { - String name = elementName.substring(tail.length()-3); +// String name = elementName.substring(tail.length()-3); return true; } else return false; @@ -230,7 +265,10 @@ public class Property { } public boolean isResource() { - if (definition.getType().size() > 0) { + if (type != null) { + String tc = type.getCode(); + return (("Resource".equals(tc) || "DomainResource".equals(tc)) || Utilities.existsInList(tc, context.getResourceNames())); + } else if (definition.getType().size() > 0) { String tc = definition.getType().get(0).getCode(); return definition.getType().size() == 1 && (("Resource".equals(tc) || "DomainResource".equals(tc)) || Utilities.existsInList(tc, context.getResourceNames())); } @@ -268,7 +306,6 @@ public class Property { // if (canBePrimitive!= null) // return canBePrimitive; - canBePrimitive = false; if (structure.getKind() != StructureDefinitionKind.LOGICAL) return false; if (!hasType(name)) @@ -282,7 +319,6 @@ public class Property { return false; for (ElementDefinition ed : sd.getSnapshot().getElement()) { if (ed.getPath().equals(sd.getId()+".value") && ed.getType().size() == 1 && isPrimitive(ed.getType().get(0).getCode())) { - canBePrimitive = true; return true; } } @@ -290,6 +326,9 @@ public class Property { } public boolean isChoice() { + if (type != null) { + return true; + } if (definition.getType().size() <= 1) return false; String tn = definition.getType().get(0).getCode(); @@ -532,4 +571,26 @@ public class Property { } + public boolean isLogical() { + return structure.getKind() == StructureDefinitionKind.LOGICAL; + } + + + public ProfileUtilities getUtils() { + return profileUtilities; + } + + public boolean isJsonPrimitiveChoice() { + return ToolingExtensions.readBoolExtension(definition, ToolingExtensions.EXT_JSON_PRIMITIVE_CHOICE); + } + + public Object typeSummary() { + CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder(" | "); + for (TypeRefComponent t : definition.getType()) { + b.append(t.getCode()); + } + return b.toString(); + } + + } \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java index d31982eaf..9d99a600c 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/CodeSystemRenderer.java @@ -20,6 +20,7 @@ import org.hl7.fhir.r5.model.Enumeration; import org.hl7.fhir.r5.model.Extension; import org.hl7.fhir.r5.model.Resource; import org.hl7.fhir.r5.renderers.utils.RenderingContext; +import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType; import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext; import org.hl7.fhir.r5.terminologies.CodeSystemUtilities; import org.hl7.fhir.r5.terminologies.CodeSystemUtilities.CodeSystemNavigator; @@ -468,7 +469,7 @@ public class CodeSystemRenderer extends TerminologyRenderer { first = false; XhtmlNode span = td.span(null, mapping.comp.hasRelationship() ? mapping.comp.getRelationship().toCode() : ""); span.addText(getCharForRelationship(mapping.comp)); - a = td.ah(getContext().getSpecificationLink()+m.getLink()+"#"+makeAnchor(mapping.group.getTarget(), mapping.comp.getCode())); + a = td.ah(getContext().getLink(KnownLinkType.SPEC)+m.getLink()+"#"+makeAnchor(mapping.group.getTarget(), mapping.comp.getCode())); a.addText(mapping.comp.getCode()); if (!Utilities.noString(mapping.comp.getComment())) td.i().tx("("+mapping.comp.getComment()+")"); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java index 5cd96699c..644aee8c9 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/OperationDefinitionRenderer.java @@ -11,6 +11,7 @@ import org.hl7.fhir.r5.model.OperationDefinition.OperationDefinitionParameterCom import org.hl7.fhir.r5.model.Resource; import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.renderers.utils.RenderingContext; +import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType; import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext; import org.hl7.fhir.r5.utils.EOperationOutcome; import org.hl7.fhir.r5.utils.ToolingExtensions; @@ -123,7 +124,7 @@ public class OperationDefinitionRenderer extends TerminologyRenderer { if (p.hasSearchType()) { td.br(); td.tx("("); - td.ah( context.getSpecificationLink() == null ? "search.html#"+p.getSearchType().toCode() : Utilities.pathURL(context.getSpecificationLink(), "search.html#"+p.getSearchType().toCode())).tx(p.getSearchType().toCode()); + td.ah( context.getLink(KnownLinkType.SPEC) == null ? "search.html#"+p.getSearchType().toCode() : Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "search.html#"+p.getSearchType().toCode())).tx(p.getSearchType().toCode()); td.tx(")"); } td = tr.td(); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/PatientRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/PatientRenderer.java index 9098f3e9d..49133f06e 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/PatientRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/PatientRenderer.java @@ -795,7 +795,7 @@ public class PatientRenderer extends ResourceRenderer { PropertyWrapper a = r.getChildByName("photo"); for (BaseWrapper v : a.getValues()) { Attachment att = (Attachment) v.getBase(); - if (att.getContentType().startsWith("image/") && + if (att.hasContentType() && att.getContentType().startsWith("image/") && att.getData() != null && (!context.isInlineGraphics() || (att.getData().length > 0 && att.getData().length < MAX_IMAGE_LENGTH))) { return true; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java index bfbbeed75..ce696f24a 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireRenderer.java @@ -24,6 +24,7 @@ import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent; import org.hl7.fhir.r5.renderers.utils.RenderingContext; +import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType; import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome; import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.utilities.Utilities; @@ -68,8 +69,8 @@ public class QuestionnaireRenderer extends TerminologyRenderer { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree="+q.getId(), !forResource); model.setAlternating(true); - model.setDocoImg(context.getSpecificationLink() +"help16.png"); - model.setDocoRef(context.getSpecificationLink()+"formats.html#table"); + model.setDocoImg(context.getLink(KnownLinkType.SPEC) +"help16.png"); + model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"formats.html#table"); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0)); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0)); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Cardinality"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0)); @@ -131,7 +132,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer { li.tx(opt.getValue().primitiveValue()); } else if (opt.getValue() instanceof Coding) { Coding c = (Coding) opt.getValue(); - String link = c.hasSystem() ? new ContextUtilities(context.getWorker()).getLinkForUrl(context.getSpecificationLink(), c.getSystem()) : null; + String link = c.hasSystem() ? new ContextUtilities(context.getWorker()).getLinkForUrl(context.getLink(KnownLinkType.SPEC), c.getSystem()) : null; if (link == null) { li.tx(c.getSystem()+"#"+c.getCode()); } else { @@ -213,7 +214,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer { } private String getSpecLink(String path) { - return Utilities.pathURL(context.getSpecificationLink(), path); + return Utilities.pathURL(context.getLink(KnownLinkType.SPEC), path); } private String getSDCLink(String path) { @@ -234,9 +235,9 @@ public class QuestionnaireRenderer extends TerminologyRenderer { r.getCells().add(gen.new Cell(null, null, (i.getRequired() ? "1" : "0")+".."+(i.getRepeats() ? "*" : "1"), null, null)); if (i.getTypeElement().hasExtension(EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL)) { String t = i.getTypeElement().getExtensionString(EXT_QUESTIONNAIRE_ITEM_TYPE_ORIGINAL); - r.getCells().add(gen.new Cell(null, context.getSpecificationLink()+"codesystem-item-type.html#item-type-"+t, t, null, null)); + r.getCells().add(gen.new Cell(null, context.getLink(KnownLinkType.SPEC)+"codesystem-item-type.html#item-type-"+t, t, null, null)); } else { - r.getCells().add(gen.new Cell(null, context.getSpecificationLink()+"codesystem-item-type.html#item-type-"+i.getType().toCode(), i.getType().toCode(), null, null)); + r.getCells().add(gen.new Cell(null, context.getLink(KnownLinkType.SPEC)+"codesystem-item-type.html#item-type-"+i.getType().toCode(), i.getType().toCode(), null, null)); } if (hasFlags) { @@ -244,7 +245,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer { Cell flags = gen.new Cell(); r.getCells().add(flags); if (i.getReadOnly()) { - flags.addPiece(gen.new Piece(Utilities.pathURL(context.getSpecificationLink(), "questionnaire-definitions.html#Questionnaire.item.readOnly"), null, "Is Readonly").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-readonly.png")))); + flags.addPiece(gen.new Piece(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "questionnaire-definitions.html#Questionnaire.item.readOnly"), null, "Is Readonly").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-readonly.png")))); } if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-isSubject")) { flags.addPiece(gen.new Piece(getSDCLink("StructureDefinition-sdc-questionnaire-isSubject.html"), null, "Can change the subject of the questionnaire").addHtml(new XhtmlNode(NodeType.Element, "img").attribute("alt", "icon").attribute("src", Utilities.path(context.getLocalPrefix(), "icon-qi-subject.png")))); @@ -433,8 +434,8 @@ public class QuestionnaireRenderer extends TerminologyRenderer { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree="+q.getId(), true); model.setAlternating(true); - model.setDocoImg(context.getSpecificationLink() +"help16.png"); - model.setDocoRef(context.getSpecificationLink()+"formats.html#table"); + model.setDocoImg(context.getLink(KnownLinkType.SPEC) +"help16.png"); + model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"formats.html#table"); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0)); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Description & Constraints"), translate("sd.hint", "Additional information about the item"), null, 0)); @@ -683,7 +684,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer { } if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_HIDDEN)) { hasFlag = true; - flags.ah(Utilities.pathURL(context.getSpecificationLink(), "extension-questionnaire-hidden.html"), "Is a hidden item").img(Utilities.path(context.getLocalPrefix(), "icon-qi-hidden.png"), "icon"); + flags.ah(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "extension-questionnaire-hidden.html"), "Is a hidden item").img(Utilities.path(context.getLocalPrefix(), "icon-qi-hidden.png"), "icon"); d.style("background-color: #eeeeee"); } if (ToolingExtensions.readBoolExtension(i, ToolingExtensions.EXT_Q_OTP_DISP)) { @@ -836,7 +837,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer { private boolean renderLinks(XhtmlNode x, Questionnaire q) { x.para().tx("Try this questionnaire out:"); XhtmlNode ul = x.ul(); - ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getSelfLink(), "package.tgz")+"&q="+q.getId()+".json").tx("NLM Forms Library"); + ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getLink(KnownLinkType.SELF), "package.tgz")+"&q="+q.getId()+".json").tx("NLM Forms Library"); return false; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireResponseRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireResponseRenderer.java index b5c679323..7c9c7f001 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireResponseRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/QuestionnaireResponseRenderer.java @@ -15,6 +15,7 @@ import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper; import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper; import org.hl7.fhir.r5.renderers.utils.RenderingContext; +import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell; @@ -62,8 +63,8 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree="+qr.getId(), false); model.setAlternating(true); - model.setDocoImg(context.getSpecificationLink() +"help16.png"); - model.setDocoRef(context.getSpecificationLink()+"formats.html#table"); + model.setDocoImg(context.getLink(KnownLinkType.SPEC) +"help16.png"); + model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"formats.html#table"); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0)); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0)); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Definition"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0)); @@ -85,8 +86,8 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer { HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree="+q.getId(), true); model.setAlternating(true); - model.setDocoImg(context.getSpecificationLink() +"help16.png"); - model.setDocoRef(context.getSpecificationLink()+"formats.html#table"); + model.setDocoImg(context.getLink(KnownLinkType.SPEC) +"help16.png"); + model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"formats.html#table"); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "LinkId"), translate("sd.hint", "The linkId for the item"), null, 0)); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Text"), translate("sd.hint", "Text for the item"), null, 0)); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("sd.head", "Definition"), translate("sd.hint", "Minimum and Maximum # of times the the itemcan appear in the instance"), null, 0)); @@ -432,7 +433,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer { // } // if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse-hidden")) { // hasFlag = true; -// flags.ah(Utilities.pathURL(context.getSpecificationLink(), "extension-QuestionnaireResponse-hidden.html"), "Is a hidden item").img(Utilities.path(context.getLocalPrefix(), "icon-qi-hidden.png")); +// flags.ah(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "extension-QuestionnaireResponse-hidden.html"), "Is a hidden item").img(Utilities.path(context.getLocalPrefix(), "icon-qi-hidden.png")); // d.style("background-color: #eeeeee"); // } // if (ToolingExtensions.readBoolExtension(i, "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-QuestionnaireResponse-optionalDisplay")) { @@ -584,14 +585,14 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer { private boolean renderLinks(XhtmlNode x, QuestionnaireResponse q) { x.para().tx("Try this QuestionnaireResponse out:"); XhtmlNode ul = x.ul(); - ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getSelfLink(), "package.tgz")+"&q="+q.getId()+".json").tx("NLM Forms Library"); + ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getLink(KnownLinkType.SELF), "package.tgz")+"&q="+q.getId()+".json").tx("NLM Forms Library"); return false; } private boolean renderLinks(XhtmlNode x, ResourceWrapper q) { x.para().tx("Try this QuestionnaireResponse out:"); XhtmlNode ul = x.ul(); - ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getSelfLink(), "package.tgz")+"&q="+q.getId()+".json").tx("NLM Forms Library"); + ul.li().ah("http://todo.nlm.gov/path?mode=ig&src="+Utilities.pathURL(context.getLink(KnownLinkType.SELF), "package.tgz")+"&q="+q.getId()+".json").tx("NLM Forms Library"); return false; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SearchParameterRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SearchParameterRenderer.java index 4d98241a6..446a1c1af 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SearchParameterRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/SearchParameterRenderer.java @@ -16,6 +16,7 @@ import org.hl7.fhir.r5.model.SearchParameter.SearchParameterComponentComponent; import org.hl7.fhir.r5.model.StringType; import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.renderers.utils.RenderingContext; +import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType; import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext; import org.hl7.fhir.r5.utils.EOperationOutcome; import org.hl7.fhir.utilities.Utilities; @@ -73,7 +74,7 @@ public class SearchParameterRenderer extends TerminologyRenderer { tr.td().tx(Utilities.pluralize("Target Resources", spd.getTarget().size())); td = tr.td(); if (isAllConcreteResources(spd.getTarget())) { - td.ah(Utilities.pathURL(context.getSpecificationLink(), "resourcelist.html")).tx("All Resources"); + td.ah(Utilities.pathURL(context.getLink(KnownLinkType.SPEC), "resourcelist.html")).tx("All Resources"); } else { for (CodeType t : spd.getTarget()) { StructureDefinition sd = context.getWorker().fetchTypeDefinition(t.toString()); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java index 97b3a63c8..dfdfba03f 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/StructureDefinitionRenderer.java @@ -10,6 +10,7 @@ import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.renderers.utils.BaseWrappers.ResourceWrapper; import org.hl7.fhir.r5.renderers.utils.RenderingContext; +import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType; import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext; import org.hl7.fhir.utilities.xhtml.XhtmlNode; @@ -28,7 +29,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer { } public boolean render(XhtmlNode x, StructureDefinition sd) throws FHIRFormatError, DefinitionException, IOException { - x.getChildNodes().add(context.getProfileUtilities().generateTable(context.getDefinitionsTarget(), sd, true, context.getDestDir(), false, sd.getId(), false, context.getSpecificationLink(), "", sd.getKind() == StructureDefinitionKind.LOGICAL, false, null, false, false, context, "")); + x.getChildNodes().add(context.getProfileUtilities().generateTable(context.getDefinitionsTarget(), sd, true, context.getDestDir(), false, sd.getId(), false, context.getLink(KnownLinkType.SPEC), "", sd.getKind() == StructureDefinitionKind.LOGICAL, false, null, false, false, context, "")); return true; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/RenderingContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/RenderingContext.java index ab59b006d..8384312d8 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/RenderingContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/utils/RenderingContext.java @@ -6,8 +6,10 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.time.format.FormatStyle; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.TimeZone; import org.hl7.fhir.exceptions.FHIRException; @@ -91,6 +93,12 @@ public class RenderingContext { LINKS } + public enum KnownLinkType { + SELF, // absolute link to where the content is to be found (only used in a few circumstances when making external references to tools) + SPEC, // version specific link to core specification + JSON_NAMES + + } private IWorkerContext worker; private MarkDownProcessor markdown; private ResourceRendererMode mode; @@ -101,8 +109,6 @@ public class RenderingContext { private String lang; private String localPrefix; // relative link within local context - private String specificationLink; - private String selfLink; // absolute link to where the content is to be found (only used in a few circumstances when making external references to tools) private int headerLevelContext; private boolean canonicalUrlsAsLinks; private boolean pretty; @@ -136,6 +142,7 @@ public class RenderingContext { private boolean copyButton; private ProfileKnowledgeProvider pkp; + private Map links = new HashMap<>(); /** * * @param context - access to all related resources that might be needed @@ -149,7 +156,7 @@ public class RenderingContext { this.worker = worker; this.markdown = markdown; this.lang = lang; - this.specificationLink = specLink; + this.links.put(KnownLinkType.SPEC, specLink); this.localPrefix = localPrefix; this.mode = mode; if (terminologyServiceOptions != null) { @@ -159,7 +166,7 @@ public class RenderingContext { this.locale = new Locale.Builder().setLanguageTag("en-US").build(); } public RenderingContext copy() { - RenderingContext res = new RenderingContext(worker, markdown, terminologyServiceOptions, specificationLink, localPrefix, lang, mode); + RenderingContext res = new RenderingContext(worker, markdown, terminologyServiceOptions, getLink(KnownLinkType.SPEC), localPrefix, lang, mode); res.resolver = resolver; res.templateProvider = templateProvider; @@ -184,7 +191,7 @@ public class RenderingContext { res.addGeneratedNarrativeHeader = addGeneratedNarrativeHeader; res.questionnaireMode = questionnaireMode; res.header = header; - res.selfLink = selfLink; + res.links.putAll(links); res.inlineGraphics = inlineGraphics; res.timeZoneId = timeZoneId; res.dateTimeFormat = dateTimeFormat; @@ -241,10 +248,6 @@ public class RenderingContext { return lang; } - public String getSpecificationLink() { - return specificationLink; - } - public String getLocalPrefix() { return localPrefix; } @@ -419,21 +422,12 @@ public class RenderingContext { return this; } - public String getSelfLink() { - return selfLink; - } - - public RenderingContext setSelfLink(String selfLink) { - this.selfLink = selfLink; - return this; - } - public String fixReference(String ref) { if (!Utilities.isAbsoluteUrl(ref)) { return (localPrefix == null ? "" : localPrefix)+ref; } if (ref.startsWith("http://hl7.org/fhir") && !ref.substring(20).contains("/")) { - return specificationLink+ref.substring(20); + return getLink(KnownLinkType.SPEC)+ref.substring(20); } return ref; } @@ -617,5 +611,16 @@ public class RenderingContext { return pkp; } + public boolean hasLink(KnownLinkType link) { + return links.containsKey(link); + } + public String getLink(KnownLinkType link) { + return links.get(link); + } + public void addLink(KnownLinkType self, String targetOutput) { + // TODO Auto-generated method stub + + } + } \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java index 6d4034780..a9423b7cb 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/terminologies/ValueSetCheckerSimple.java @@ -63,6 +63,7 @@ import org.hl7.fhir.r5.model.ValueSet.ConceptSetFilterComponent; import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent; import org.hl7.fhir.r5.terminologies.ValueSetChecker.ValidationProcessInfo; import org.hl7.fhir.r5.terminologies.ValueSetExpander.TerminologyServiceErrorClass; +import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome; import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier; import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier.ValidationContextResourceProxy; @@ -207,7 +208,17 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe String system = code.hasSystem() ? code.getSystem() : getValueSetSystemOrNull(); if (options.getValueSetMode() != ValueSetMode.CHECK_MEMERSHIP_ONLY) { if (system == null && !code.hasDisplay()) { // dealing with just a plain code (enum) - system = systemForCodeInValueSet(code.getCode()); + List problems = new ArrayList<>(); + system = systemForCodeInValueSet(code.getCode(), problems); + if (system == null) { + if (problems.size() == 0) { + throw new Error("Unable to resolve systems but no reason why"); // this is an error in the java code + } else if (problems.size() == 1) { + return new ValidationResult(IssueSeverity.ERROR, problems.get(0)); + } else { + return new ValidationResult(IssueSeverity.ERROR, problems.toString()); + } + } } if (!code.hasSystem()) { if (options.isGuessSystem() && system == null && Utilities.isAbsoluteUrl(code.getCode())) { @@ -453,36 +464,6 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe } } - private String getValueSetSystem() throws FHIRException { - if (valueset == null) { - throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__NO_VALUE_SET)); - } - if (valueset.getCompose().getInclude().size() == 0) { - if (!valueset.hasExpansion() || valueset.getExpansion().getContains().size() == 0) { - throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_NO_INCLUDES_OR_EXPANSION)); - } else { - String cs = valueset.getExpansion().getContains().get(0).getSystem(); - if (cs != null && checkSystem(valueset.getExpansion().getContains(), cs)) { - return cs; - } else { - throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_EXPANSION_HAS_MULTIPLE_SYSTEMS)); - } - } - } - for (ConceptSetComponent inc : valueset.getCompose().getInclude()) { - if (inc.hasValueSet()) { - throw new FHIRException(context.formatMessagePlural(inc.getValueSet().size(), I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_IMPORTS)); - } - if (!inc.hasSystem()) { - throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_NO_SYSTEM)); - } - } - if (valueset.getCompose().getInclude().size() == 1) { - return valueset.getCompose().getInclude().get(0).getSystem(); - } - - return null; - } private String getValueSetSystemOrNull() throws FHIRException { if (valueset == null) { @@ -561,36 +542,41 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe } - private String systemForCodeInValueSet(String code) { + private String systemForCodeInValueSet(String code, List problems) { Set sys = new HashSet<>(); - if (!scanForCodeInValueSet(code, sys)) { + if (!scanForCodeInValueSet(code, sys, problems)) { return null; } if (sys.size() != 1) { + problems.add(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_MULTIPLE_MATCHES, sys.toString())); return null; } else { return sys.iterator().next(); } } - private boolean scanForCodeInValueSet(String code, Set sys) { + private boolean scanForCodeInValueSet(String code, Set sys, List problems) { if (valueset.hasCompose()) { - // not sure what to do with the -// if (valueset.getCompose().hasExclude()) { -// return false; -// } + // ignore excludes - they can't make any difference + if (!valueset.getCompose().hasInclude() && !valueset.getExpansion().hasContains()) { + problems.add(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_NO_INCLUDES_OR_EXPANSION, valueset.getVersionedUrl())); + } + + int i = 0; for (ConceptSetComponent vsi : valueset.getCompose().getInclude()) { if (vsi.hasValueSet()) { for (CanonicalType u : vsi.getValueSet()) { - if (!checkForCodeInValueSet(code, u.getValue(), sys)) { + if (!checkForCodeInValueSet(code, u.getValue(), sys, problems)) { return false; } } } else if (!vsi.hasSystem()) { + problems.add(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_NO_SYSTEM, valueset.getVersionedUrl(), i)); return false; } if (vsi.hasSystem()) { if (vsi.hasFilter()) { + problems.add(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_NO_SYSTEM, valueset.getVersionedUrl(), i, vsi.getSystem())); return false; } CodeSystem cs = resolveCodeSystem(vsi.getSystem(), vsi.getVersion()); @@ -617,35 +603,45 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe } } } else { - return false; + // we'll try to expand this one then + ValueSetExpansionOutcome vse = context.expandVS(vsi, false, false); + if (vse.isOk()) { + if (!checkSystems(vse.getValueset().getExpansion().getContains(), code, sys, problems)) { + return false; + } + } else { + problems.add(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_UNKNOWN_SYSTEM, valueset.getVersionedUrl(), i, vsi.getSystem(), vse.getAllErrors().toString())); + return false; + } } } + i++; } } else if (valueset.hasExpansion()) { // Retrieve a list of all systems associated with this code in the expansion - if (!checkSystems(valueset.getExpansion().getContains(), code, sys)) { + if (!checkSystems(valueset.getExpansion().getContains(), code, sys, problems)) { return false; } } return true; } - private boolean checkForCodeInValueSet(String code, String uri, Set sys) { + private boolean checkForCodeInValueSet(String code, String uri, Set sys, List problems) { ValueSetCheckerSimple vs = getVs(uri); - return vs.scanForCodeInValueSet(code, sys); + return vs.scanForCodeInValueSet(code, sys, problems); } /* * Recursively go through all codes in the expansion and for any coding that matches the specified code, add the system for that coding * to the passed list. */ - private boolean checkSystems(List contains, String code, Set systems) { + private boolean checkSystems(List contains, String code, Set systems, List problems) { for (ValueSetExpansionContainsComponent c: contains) { if (c.getCode().equals(code)) { systems.add(c.getSystem()); } if (c.hasContains()) - checkSystems(c.getContains(), code, systems); + checkSystems(c.getContains(), code, systems, problems); } return true; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java index 8e034338d..08b3ead30 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java @@ -19,6 +19,7 @@ import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.context.SimpleWorkerContext; import org.hl7.fhir.r5.context.TerminologyCache; import org.hl7.fhir.r5.model.Parameters; +import org.hl7.fhir.r5.utils.R5Hacker; import org.hl7.fhir.utilities.CSFile; import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.ToolGlobalSettings; @@ -117,6 +118,7 @@ public class TestingUtilities extends BaseTestingUtilities { System.out.println("Loading THO: "+utg.name()+"#"+utg.version()); fcontext.loadFromPackage(utg, new TestPackageLoader(new String[]{"CodeSystem", "ValueSet"})); } + R5Hacker.fixR5BrokenResources(fcontext); return fcontext; } catch (Exception e) { e.printStackTrace(); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/R5Hacker.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/R5Hacker.java new file mode 100644 index 000000000..7db230057 --- /dev/null +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/R5Hacker.java @@ -0,0 +1,74 @@ +package org.hl7.fhir.r5.utils; + +import org.hl7.fhir.r5.context.IWorkerContext; +import org.hl7.fhir.r5.model.CanonicalResource; +import org.hl7.fhir.r5.model.ElementDefinition; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.Enumerations.BindingStrength; + +public class R5Hacker { + + public static void fixR5BrokenResources(IWorkerContext context) { + for (StructureDefinition sd : context.fetchResourcesByType(StructureDefinition.class)) { + fixSD(sd); + } + } + + + private static void fixSD(StructureDefinition sd) { + if ("5.0.0-ballot".equals(sd.getVersion()) && "ElementDefinition".equals(sd.getType())) { + for (ElementDefinition ed : sd.getDifferential().getElement()) { + hackEDR5BallotError(ed); + } + for (ElementDefinition ed : sd.getSnapshot().getElement()) { + hackEDR5BallotError(ed); + } + } + if ("5.0.0-ballot".equals(sd.getVersion()) && "Base".equals(sd.getType())) { + for (ElementDefinition ed : sd.getDifferential().getElement()) { + hackBaseR5BallotError(ed); + } + for (ElementDefinition ed : sd.getSnapshot().getElement()) { + hackBaseR5BallotError(ed); + } + } + if ("5.0.0-ballot".equals(sd.getVersion()) && "Bundle".equals(sd.getType())) { + for (ElementDefinition ed : sd.getDifferential().getElement()) { + hackBundleR5BallotError(ed); + } + for (ElementDefinition ed : sd.getSnapshot().getElement()) { + hackBundleR5BallotError(ed); + } + } + if ("5.0.0-ballot".equals(sd.getVersion()) && "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype".equals(sd.getUrl())) { + sd.getContextFirstRep().setExpression("ElementDefinition"); + } + } + + + private static void hackBaseR5BallotError(ElementDefinition ed) { + ed.getConstraint().clear(); + } + + private static void hackBundleR5BallotError(ElementDefinition ed) { + if (ed.getPath().equals("Bundle.link.relation")) { + ToolingExtensions.removeExtension(ed.getBinding(), ToolingExtensions.EXT_BINDING_NAME); + } + } + + private static void hackEDR5BallotError(ElementDefinition ed) { + if (ed.getPath().equals("ElementDefinition.type.code")) { + ed.getBinding().setStrength(BindingStrength.EXTENSIBLE); + } + } + + + public static CanonicalResource fixR5BrokenResource(CanonicalResource cr) { + if (cr instanceof StructureDefinition) { + StructureDefinition sd = (StructureDefinition) cr; + fixSD(sd); + } + return cr; + } + +} diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java index 71de59075..b7fd007c2 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java @@ -119,7 +119,6 @@ public class ToolingExtensions { public static final String EXT_RESOURCE_IMPLEMENTS = "http://hl7.org/fhir/StructureDefinition/structuredefinition-implements"; public static final String EXT_XML_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-type"; public static final String EXT_XML_NAME = "http://hl7.org/fhir/StructureDefinition/elementdefinition-xml-name"; - public static final String EXT_BINDING_STYLE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-binding-style"; public static final String EXT_EXPLICIT_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"; public static final String EXT_IGP_RESOURCES = "http://hl7.org/fhir/StructureDefinition/igpublisher-folder-resource"; @@ -138,6 +137,9 @@ public class ToolingExtensions { public static final String EXT_IGP_RESOURCE_INFO = "http://hl7.org/fhir/tools/StructureDefinition/resource-information"; public static final String EXT_IGP_LOADVERSION = "http://hl7.org/fhir/StructureDefinition/igpublisher-loadversion"; public static final String EXT_LIST_PACKAGE = "http://hl7.org/fhir/StructureDefinition/list-packageId"; + public static final String EXT_JSON_NAME = "http://hl7.org/fhir/tools/StructureDefinition/elementdefinition-json-name"; + public static final String EXT_BINDING_STYLE = "http://hl7.org/fhir/tools/StructureDefinition/elementdefinition-binding-style"; + public static final String EXT_EXTENSION_STYLE = "http://hl7.org/fhir/tools/StructureDefinition/elementdefinition-extension-style"; // validated // private static final String EXT_OID = "http://hl7.org/fhir/StructureDefinition/valueset-oid"; @@ -220,6 +222,7 @@ public class ToolingExtensions { public static final String EXT_IMPLIED_PREFIX = "http://hl7.org/fhir/tools/StructureDefinition/implied-string-prefix"; public static final String EXT_DATE_FORMAT = "http://hl7.org/fhir/tools/StructureDefinition/elementdefinition-date-format"; public static final String EXT_ID_EXPECTATION = "http://hl7.org/fhir/tools/StructureDefinition/id-expectation"; + public static final String EXT_JSON_PRIMITIVE_CHOICE = "http://hl7.org/fhir/tools/StructureDefinition/json-primitive-choice"; // unregistered? - don't know what these are used for @@ -233,6 +236,11 @@ 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_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/branches/master/format-extensions.html#extension-related-extensions"; + ; + // specific extension helpers public static Extension makeIssueSource(Source source) { @@ -989,5 +997,23 @@ public class ToolingExtensions { } + public static boolean hasExtensions(ElementDefinition d, String... urls) { + for (String url : urls) { + if (d.hasExtension(url)) { + return true; + } + } + return false; + } + + public static int countExtensions(ElementDefinition d, String... urls) { + int res = 0; + for (String url : urls) { + if (d.hasExtension(url)) { + res++; + } + } + return res; + } } \ No newline at end of file diff --git a/org.hl7.fhir.report/pom.xml b/org.hl7.fhir.report/pom.xml index 2c6edb58c..b79e64824 100644 --- a/org.hl7.fhir.report/pom.xml +++ b/org.hl7.fhir.report/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.utilities/pom.xml b/org.hl7.fhir.utilities/pom.xml index f66076b91..7f8dfdfa0 100644 --- a/org.hl7.fhir.utilities/pom.xml +++ b/org.hl7.fhir.utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java index 78bbb95f8..dca1ee77e 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nConstants.java @@ -78,7 +78,7 @@ public class I18nConstants { public static final String DOES_NOT_MATCH_SLICE_ = "Does_not_match_slice_"; public static final String DUPLICATE_ID = "DUPLICATE_ID"; public static final String DUPLICATE_RESOURCE_ = "Duplicate_Resource_"; - public static final String DUPLICATE_RESOURCE_VERSION = "DUPLICATE_RESOURCE_VERSION"; +// public static final String DUPLICATE_RESOURCE_VERSION = "DUPLICATE_RESOURCE_VERSION"; public static final String ELEMENT_CANNOT_BE_NULL = "ELEMENT_CANNOT_BE_NULL"; public static final String ELEMENT_ID__NULL__ON_ = "element_id__null__on_"; public static final String ELEMENT_MUST_HAVE_SOME_CONTENT = "Element_must_have_some_content"; @@ -131,7 +131,7 @@ public class I18nConstants { public static final String EXTENSION_EXT_VERSION_NOCHANGE = "Extension_EXT_Version_NoChange"; public static final String EXTENSION_PROF_TYPE = "Extension_PROF_Type"; public static final String FHIRPATH_ALIAS_COLLECTION = "FHIRPATH_ALIAS_COLLECTION"; - public static final String FHIRPATH_BAD_DATE = "FHIRPATH_BAD_DATE"; +// public static final String FHIRPATH_BAD_DATE = "FHIRPATH_BAD_DATE"; public static final String FHIRPATH_CANNOT_USE = "FHIRPATH_CANNOT_USE"; public static final String FHIRPATH_CANT_COMPARE = "FHIRPATH_CANT_COMPARE"; public static final String FHIRPATH_CHECK_FAILED = "FHIRPATH_CHECK_FAILED"; @@ -152,7 +152,7 @@ public class I18nConstants { public static final String FHIRPATH_DISCRIMINATOR_RESOLVE_NOT_REFERENCE = "FHIRPATH_DISCRIMINATOR_RESOLVE_NOT_REFERENCE"; public static final String FHIRPATH_DISCRIMINATOR_RESOLVE_NO_TYPE = "FHIRPATH_DISCRIMINATOR_RESOLVE_NO_TYPE"; public static final String FHIRPATH_DISCRIMINATOR_THIS_CANNOT_FIND = "FHIRPATH_DISCRIMINATOR_THIS_CANNOT_FIND"; - public static final String FHIRPATH_DISCRIMINATOR_TYPE_MULTIPLE = "FHIRPATH_DISCRIMINATOR_TYPE_MULTIPLE"; +// public static final String FHIRPATH_DISCRIMINATOR_TYPE_MULTIPLE = "FHIRPATH_DISCRIMINATOR_TYPE_MULTIPLE"; public static final String FHIRPATH_DISCRIMINATOR_TYPE_NONE = "FHIRPATH_DISCRIMINATOR_TYPE_NONE"; public static final String FHIRPATH_FOCUS_PLURAL = "FHIRPATH_FOCUS_PLURAL"; public static final String FHIRPATH_HO_HOST_SERVICES = "FHIRPATH_HO_HOST_SERVICES"; @@ -195,7 +195,7 @@ public class I18nConstants { public static final String ILLEGAL_PATH__IN_DIFFERENTIAL_IN__NO_UNICODE_WHITESPACE = "Illegal_path__in_differential_in__no_unicode_whitespace"; public static final String INTERNAL_ERROR___TYPE_NOT_KNOWN_ = "Internal_error___type_not_known_"; public static final String INTERNAL_INT_BAD_TYPE = "Internal_INT_Bad_Type"; - public static final String INTERNAL_RECURSION_DETECTION_FIND_LOOP_PATH_RECURSION____CHECK_PATHS_ARE_VALID_FOR_PATH_ = "Internal_recursion_detection_find_loop_path_recursion____check_paths_are_valid_for_path_"; +// public static final String INTERNAL_RECURSION_DETECTION_FIND_LOOP_PATH_RECURSION____CHECK_PATHS_ARE_VALID_FOR_PATH_ = "Internal_recursion_detection_find_loop_path_recursion____check_paths_are_valid_for_path_"; public static final String INV_FAILED = "INV_FAILED"; public static final String INVALID_SLICING__THERE_IS_MORE_THAN_ONE_TYPE_SLICE_AT__BUT_ONE_OF_THEM__HAS_MIN__1_SO_THE_OTHER_SLICES_CANNOT_EXIST = "Invalid_slicing__there_is_more_than_one_type_slice_at__but_one_of_them__has_min__1_so_the_other_slices_cannot_exist"; public static final String LANGUAGE_XHTML_LANG_DIFFERENT1 = "Language_XHTML_Lang_Different1"; @@ -210,7 +210,7 @@ public class I18nConstants { public static final String MEASURE_MR_GRP_NO_WRONG_CODE = "MEASURE_MR_GRP_NO_WRONG_CODE"; public static final String MEASURE_MR_GRP_POP_COUNT_MISMATCH = "MEASURE_MR_GRP_POP_COUNT_MISMATCH"; public static final String MEASURE_MR_GRP_POP_DUPL_CODE = "MEASURE_MR_GRP_POP_DUPL_CODE"; - public static final String MEASURE_MR_GRP_POP_MISSING_BY_CODE = "MEASURE_MR_GRP_POP_MISSING_BY_CODE"; +// public static final String MEASURE_MR_GRP_POP_MISSING_BY_CODE = "MEASURE_MR_GRP_POP_MISSING_BY_CODE"; public static final String MEASURE_MR_GRP_POP_NO_CODE = "MEASURE_MR_GRP_POP_NO_CODE"; public static final String MEASURE_MR_GRP_POP_NO_COUNT = "MEASURE_MR_GRP_POP_NO_COUNT"; public static final String MEASURE_MR_GRP_POP_NO_SUBJECTS = "MEASURE_MR_GRP_POP_NO_SUBJECTS"; @@ -227,7 +227,7 @@ public class I18nConstants { public static final String MEASURE_MR_SCORE_UNIT_REQUIRED = "MEASURE_MR_SCORE_UNIT_REQUIRED"; public static final String MEASURE_MR_SCORE_VALUE_INVALID_01 = "MEASURE_MR_SCORE_VALUE_INVALID_01"; public static final String MEASURE_MR_SCORE_VALUE_REQUIRED = "MEASURE_MR_SCORE_VALUE_REQUIRED"; - public static final String MEASURE_M_CQL_NOT_FOUND = "MEASURE_M_CQL_NOT_FOUND"; +// public static final String MEASURE_M_CQL_NOT_FOUND = "MEASURE_M_CQL_NOT_FOUND"; public static final String MEASURE_M_CRITERIA_CQL_ELM_NOT_VALID = "MEASURE_M_CRITERIA_CQL_ELM_NOT_VALID"; public static final String MEASURE_M_CRITERIA_CQL_ERROR = "MEASURE_M_CRITERIA_CQL_ERROR"; public static final String MEASURE_M_CRITERIA_CQL_LIB_DUPL = "MEASURE_M_CRITERIA_CQL_LIB_DUPL"; @@ -240,7 +240,7 @@ public class I18nConstants { public static final String MEASURE_M_GROUP_CODE = "MEASURE_M_GROUP_CODE"; public static final String MEASURE_M_GROUP_POP = "MEASURE_M_GROUP_POP"; public static final String MEASURE_M_GROUP_POP_NO_CODE = "MEASURE_M_GROUP_POP_NO_CODE"; - public static final String MEASURE_M_GROUP_STRATA = "MEASURE_M_GROUP_STRATA"; +// public static final String MEASURE_M_GROUP_STRATA = "MEASURE_M_GROUP_STRATA"; public static final String MEASURE_M_GROUP_STRATA_COMP_NO_CODE = "MEASURE_M_GROUP_STRATA_COMP_NO_CODE"; public static final String MEASURE_M_GROUP_STRATA_NO_CODE = "MEASURE_M_GROUP_STRATA_NO_CODE"; public static final String MEASURE_M_LIB_UNKNOWN = "MEASURE_M_LIB_UNKNOWN"; @@ -261,7 +261,7 @@ public class I18nConstants { public static final String NOT_DONE_YET_VALIDATORHOSTSERVICESRESOLVEFUNCTION_ = "Not_done_yet_ValidatorHostServicesresolveFunction_"; public static final String NOT_DONE_YET__RESOLVE__LOCALLY_2 = "Not_done_yet__resolve__locally_2"; public static final String NOT_HANDLED_YET_SORTELEMENTS_ = "Not_handled_yet_sortElements_"; - public static final String NOT_SUPPORTED_YET = "Not_supported_yet"; +// public static final String NOT_SUPPORTED_YET = "Not_supported_yet"; public static final String NOT_THE_RIGHT_KIND_OF_STRUCTURE_TO_GENERATE_SCHEMATRONS_FOR = "not_the_right_kind_of_structure_to_generate_schematrons_for"; public static final String NO_BASE_PROFILE_PROVIDED = "no_base_profile_provided"; public static final String NO_DERIVED_STRUCTURE_PROVIDED = "no_derived_structure_provided"; @@ -316,7 +316,7 @@ public class I18nConstants { public static final String QUESTIONNAIRE_QR_ITEM_NOOPTIONSSTRING = "Questionnaire_QR_Item_NoOptionsString"; public static final String QUESTIONNAIRE_QR_ITEM_NOOPTIONSTIME = "Questionnaire_QR_Item_NoOptionsTime"; public static final String QUESTIONNAIRE_QR_ITEM_NOSTRING = "Questionnaire_QR_Item_NoString"; - public static final String QUESTIONNAIRE_QR_ITEM_NOTENABLED = "Questionnaire_QR_Item_NotEnabled"; +// public static final String QUESTIONNAIRE_QR_ITEM_NOTENABLED = "Questionnaire_QR_Item_NotEnabled"; public static final String QUESTIONNAIRE_QR_ITEM_NOTENABLED2 = "Questionnaire_QR_Item_NotEnabled2"; public static final String QUESTIONNAIRE_QR_ITEM_NOTFOUND = "Questionnaire_QR_Item_NotFound"; public static final String QUESTIONNAIRE_QR_ITEM_NOTIME = "Questionnaire_QR_Item_NoTime"; @@ -372,7 +372,7 @@ public class I18nConstants { public static final String SD_ED_TYPE_PROFILE_NOT_MODIFIER = "SD_ED_TYPE_PROFILE_NOT_MODIFIER"; public static final String SD_ED_TYPE_PROFILE_WRONG_TARGET = "SD_ED_TYPE_PROFILE_WRONG_TARGET"; public static final String SD_ED_TYPE_NO_TARGET_PROFILE = "SD_ED_TYPE_NO_TARGET_PROFILE"; - public static final String SD_ED_SHOULD_BIND = "SD_ED_SHOULD_BIND"; +// public static final String SD_ED_SHOULD_BIND = "SD_ED_SHOULD_BIND"; public static final String SD_ED_SHOULD_BIND_WITH_VS = "SD_ED_SHOULD_BIND_WITH_VS"; public static final String SD_ED_BIND_UNKNOWN_VS = "SD_ED_BIND_UNKNOWN_VS"; public static final String SD_ED_BIND_NOT_VS = "SD_ED_BIND_NOT_VS"; @@ -414,7 +414,7 @@ public class I18nConstants { public static final String TERMINOLOGY_TX_CONFIRM_2_CC = "Terminology_TX_Confirm_2_CC"; public static final String TERMINOLOGY_TX_CONFIRM_3_CC = "Terminology_TX_Confirm_3_CC"; public static final String TERMINOLOGY_TX_CONFIRM_4a = "Terminology_TX_Confirm_4a"; - public static final String TERMINOLOGY_TX_CONFIRM_4b = "Terminology_TX_Confirm_4b"; +// public static final String TERMINOLOGY_TX_CONFIRM_4b = "Terminology_TX_Confirm_4b"; public static final String TERMINOLOGY_TX_CONFIRM_5 = "Terminology_TX_Confirm_5"; public static final String TERMINOLOGY_TX_CONFIRM_6 = "Terminology_TX_Confirm_6"; public static final String TERMINOLOGY_TX_DISPLAY_WRONG = "Terminology_TX_Display_Wrong"; @@ -560,9 +560,11 @@ public class I18nConstants { public static final String UNABLE_TO_RESOLVE_SLICE_MATCHING__SLICE_MATCHING_BY_VALUE_SET_NOT_DONE = "Unable_to_resolve_slice_matching__slice_matching_by_value_set_not_done"; public static final String UNABLE_TO_RESOLVE_SYSTEM__NO_VALUE_SET = "Unable_to_resolve_system__no_value_set"; public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_EXPANSION_HAS_MULTIPLE_SYSTEMS = "Unable_to_resolve_system__value_set_expansion_has_multiple_systems"; - public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_EXCLUDES = "Unable_to_resolve_system__value_set_has_excludes"; public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_IMPORTS = "Unable_to_resolve_system__value_set_has_imports"; + public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_MULTIPLE_MATCHES = "Unable_to_resolve_system__value_set_has_multiple_matches"; public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_NO_SYSTEM = "Unable_to_resolve_system__value_set_has_include_with_no_system"; + public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_UNKNOWN_SYSTEM = "Unable_to_resolve_system__value_set_has_include_with_unknown_system"; +// public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_FILTER = "Unable_to_resolve_system__value_set_has_include_with_filter"; public static final String UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_NO_INCLUDES_OR_EXPANSION = "Unable_to_resolve_system__value_set_has_no_includes_or_expansion"; public static final String UNABLE_TO_RESOLVE_VALUE_SET_ = "Unable_to_resolve_value_Set_"; public static final String UNABLE_TO_VALIDATE_CODE_WITHOUT_USING_SERVER = "Unable_to_validate_code_without_using_server"; @@ -581,6 +583,8 @@ public class I18nConstants { public static final String UNRECOGNISED_EXTENSION_CONTEXT_ = "Unrecognised_extension_context_"; public static final String UNRECOGNISED_PREDICATE_ = "Unrecognised_predicate_"; public static final String UNRECOGNISED_PROPERTY_ = "Unrecognised_property_"; + public static final String UNRECOGNISED_PROPERTY_TYPE = "UNRECOGNISED_PROPERTY_TYPE"; + public static final String UNRECOGNISED_PROPERTY_TYPE_WRONG = "UNRECOGNISED_PROPERTY_TYPE_WRONG"; public static final String UNSUPPORTED_CODEABLECONCEPT_PATTERN__EXTENSIONS_ARE_NOT_ALLOWED__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_CodeableConcept_pattern__extensions_are_not_allowed__for_discriminator_for_slice_"; public static final String UNSUPPORTED_CODEABLECONCEPT_PATTERN__MUST_HAVE_AT_LEAST_ONE_CODING__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_CodeableConcept_pattern__must_have_at_least_one_coding__for_discriminator_for_slice_"; public static final String UNSUPPORTED_CODEABLECONCEPT_PATTERN__USING_TEXT__FOR_DISCRIMINATOR_FOR_SLICE_ = "Unsupported_CodeableConcept_pattern__using_text__for_discriminator_for_slice_"; @@ -669,7 +673,7 @@ public class I18nConstants { public static final String XHTML_XHTML_NS_INVALID = "XHTML_XHTML_NS_InValid"; public static final String XML_ATTR_VALUE_INVALID = "xml_attr_value_invalid"; public static final String XML_ENCODING_INVALID = "xml_encoding_invalid"; - public static final String XML_STATED_ENCODING_INVALID = "xml_stated_encoding_invalid"; +// public static final String XML_STATED_ENCODING_INVALID = "xml_stated_encoding_invalid"; public static final String _DT_FIXED_WRONG = "_DT_Fixed_Wrong"; public static final String _HAS_CHILDREN__AND_MULTIPLE_TYPES__IN_PROFILE_ = "_has_children__and_multiple_types__in_profile_"; public static final String _HAS_CHILDREN__FOR_TYPE__IN_PROFILE__BUT_CANT_FIND_TYPE = "_has_children__for_type__in_profile__but_cant_find_type"; diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonUtilities.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonUtilities.java index 47f8674a7..c66df9667 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonUtilities.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/json/JsonUtilities.java @@ -179,4 +179,8 @@ public class JsonUtilities { return odt.toInstant(); } } + + public static void setProperty(JsonObject json, String name, String value) { + json.addProperty(name, value); + } } \ No newline at end of file diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages.properties b/org.hl7.fhir.utilities/src/main/resources/Messages.properties index 5a9fa49ca..6b503de3d 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages.properties @@ -395,12 +395,12 @@ This_property_must_be_an_object_not_ = This property must be an object, not {0} This_property_must_be_an_simple_value_not_ = This property must be an simple value, not {0} ({1} at {2}) This_property_must_be__not_ = The property {2} must be {0}, not {1} (at {3}) This_property_must_be_an_Array_not_ = The property {1} must be a JSON Array, not {0} (at {2}) -OBJECT_CANNOT_BE_KEYED_ARRAY_CHILD_COUNT = This object cannot be an keyed Array in Json because it does not have two children in the definitions -OBJECT_CANNOT_BE_KEYED_ARRAY_PROP_NAME = This object is defined as a keyed Array in Json but the definition does not name the first child element as the key -OBJECT_CANNOT_BE_KEYED_ARRAY_PROP_TYPE = This object is defined as a keyed Array in Json but the key property named in the definitions is not a primitive type -OBJECT_CANNOT_BE_KEYED_ARRAY_NO_CHOICE = This object is defined as a keyed Array in Json but the value property named in the definitions is a choice - this is not supported -OBJECT_CANNOT_BE_KEYED_ARRAY_NO_LIST = This object is defined as a keyed Array in Json but the value property named in the definitions is a list - this is not supported -Unrecognised_property_ = Unrecognized property ''@{0}'' +OBJECT_CANNOT_BE_KEYED_ARRAY_CHILD_COUNT = This object cannot be an keyed Array in Json because it does not have two children in the definitions (children = {0}) +OBJECT_CANNOT_BE_KEYED_ARRAY_PROP_NAME = This object is defined as a keyed Array in Json but the definition does not name the first child element as the key (children = {0}) +OBJECT_CANNOT_BE_KEYED_ARRAY_PROP_TYPE = This object is defined as a keyed Array in Json but the key property named in the definitions is not a primitive type (children = {0}, type = {1}) +OBJECT_CANNOT_BE_KEYED_ARRAY_NO_CHOICE = This object is defined as a keyed Array in Json but the value property named in the definitions is a choice - this is not supported (value property = {0}) +OBJECT_CANNOT_BE_KEYED_ARRAY_NO_LIST = This object is defined as a keyed Array in Json but the value property named in the definitions is a list - this is not supported (value property = {0}) +Unrecognised_property_ = Unrecognized property ''{0}'' Object_must_have_some_content = Object must have some content Error_parsing_JSON_ = Error parsing JSON: {0} Node_type__is_not_allowed = Node type {0} is not allowed @@ -462,11 +462,12 @@ None_of_the_provided_codes_are_in_the_value_set_ = None of the provided codes ar Coding_has_no_system__cannot_validate = Coding has no system - cannot validate Unable_to_handle_system__concept_filter_with_op__ = Unable to handle system {0} concept filter with op = {1} Unable_to_handle_system__filter_with_property__ = Unable to handle system {0} filter with property = {1} -Unable_to_resolve_system__value_set_has_include_with_no_system = Unable to resolve system - value set has include with no system +Unable_to_resolve_system__value_set_has_include_with_no_system = Unable to resolve system - value set {0} include #{1} has no system +Unable_to_resolve_system__value_set_has_include_with_unknown_system = Unable to resolve system - value set {0} include #{1} has system {2} which is unknown, and the server return error {3} +Unable_to_resolve_system__value_set_has_include_with_filter = Unable to resolve system - value set {0} include #{1} has a filter on system {2} Unable_to_resolve_system__value_set_has_imports = Unable to resolve system - value set has imports -Unable_to_resolve_system__value_set_expansion_has_multiple_systems = Unable to resolve system - value set expansion has multiple systems -Unable_to_resolve_system__value_set_has_no_includes_or_expansion = Unable to resolve system - value set has no includes or expansion -Unable_to_resolve_system__value_set_has_excludes = Unable to resolve system - value set has excludes +Unable_to_resolve_system__value_set_has_multiple_matches = Unable to resolve system - value set expansion has multiple matches: {0} +Unable_to_resolve_system__value_set_has_no_includes_or_expansion = Unable to resolve system - value set {0} has no includes or expansion Unable_to_resolve_system__no_value_set = Unable to resolve system - no value set This_base_property_must_be_an_Array_not_ = This base property must be an Array, not {0} This_property_must_be_an_Array_not_ = This property must be an Array, not {0} @@ -520,7 +521,8 @@ MEASURE_M_CRITERIA_CQL_NO_ELM = Error in {0}: No compiled version of CQL found MEASURE_M_CRITERIA_CQL_ELM_NOT_VALID = = Error in {0}: Compiled version of CQL is not valid MEASURE_M_CRITERIA_CQL_NOT_FOUND = The function {1} does not exist in the library {0} XHTML_URL_EMPTY = URL is empty -XHTML_URL_INVALID_CHARS_PLURAL = URL contains {0} Invalid Characters ({1}) +XHTML_URL_INVALID_CHARS_PLURAL_one = URL contains Invalid Character ({1}) +XHTML_URL_INVALID_CHARS_PLURAL_other = URL contains {0} Invalid Characters ({1}) TERMINOLOGY_TX_SYSTEM_HTTPS = The system URL ''{0}'' wrongly starts with https: not http: CODESYSTEM_CS_NO_VS_NOTCOMPLETE = Review the All Codes Value Set - incomplete CodeSystems generally should not have an all codes value set specified TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE = if identifier.system is ''urn:ietf:rfc:3986'', then the identifier.value must be a full URI (e.g. start with a scheme) @@ -572,9 +574,13 @@ FHIRPATH_UNKNOWN_NAME = Error evaluating FHIRPath expression: The name {0} is no FHIRPATH_UNKNOWN_CONSTANT = Error evaluating FHIRPath expression: Invalid FHIR Constant {0} FHIRPATH_CANNOT_USE = Error evaluating FHIRPath expression: Cannot use {0} in this context because {1} FHIRPATH_CANT_COMPARE = Error evaluating FHIRPath expression: Unable to compare values of type {0} and {1} -FHIRPATH_LEFT_VALUE_PLURAL = Error evaluating FHIRPath expression: left operand to {1} can only have 1 value, but has {0} values +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_LEFT_VALUE_PLURAL_one = +FHIRPATH_LEFT_VALUE_PLURAL_other = Error evaluating FHIRPath expression: left operand to {1} can only have 1 value, but has {0} values FHIRPATH_LEFT_VALUE_WRONG_TYPE = Error evaluating FHIRPath expression: left operand to {0} has the wrong type {1} -FHIRPATH_RIGHT_VALUE_PLURAL = Error evaluating FHIRPath expression: right operand to {1} can only have 1 value, but has {0} values +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_RIGHT_VALUE_PLURAL_one = +FHIRPATH_RIGHT_VALUE_PLURAL_other = Error evaluating FHIRPath expression: right operand to {1} can only have 1 value, but has {0} values FHIRPATH_RIGHT_VALUE_WRONG_TYPE = Error evaluating FHIRPath expression: right operand to {0} has the wrong type {1} FHIRPATH_OP_INCOMPATIBLE = Error evaluating FHIRPath expression {0}: left and right operand have incompatible or illegal types ({1}, {2}) FHIRPATH_HO_HOST_SERVICES = Internal Error evaluating FHIRPath expression: No host services are provided ({0}) @@ -592,9 +598,13 @@ FHIRPATH_NO_TYPE = Error evaluating FHIRPath expression: The type ''{0}'' is unk FHIRPATH_DISCRIMINATOR_NAME_ALREADY_SLICED = Error in discriminator at {0}: found a sliced element while resolving the fixed value for one of the slices FHIRPATH_DISCRIMINATOR_THIS_CANNOT_FIND = Problem with use of resolve() - profile {0} on {1} could not be resolved FHIRPATH_DISCRIMINATOR_RESOLVE_NO_TYPE = illegal use of resolve() in discriminator - no type on element {0} -FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL = Illegal use of resolve() in discriminator - {0} possible types on {1} (can only be one) +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL_one = +FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL_other = Illegal use of resolve() in discriminator - {0} possible types on {1} (can only be one) FHIRPATH_DISCRIMINATOR_RESOLVE_NOT_REFERENCE = illegal use of resolve() in discriminator - type on {0} is not Reference {1} -FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL = illegal use of resolve() in discriminator - {0} possible target type profiles on {1} (can only be one) +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL_one = +FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL_other = illegal use of resolve() in discriminator - {0} possible target type profiles on {1} (can only be one) FHIRPATH_RESOLVE_DISCRIMINATOR_CANT_FIND = Problem with use of resolve() - profile {0} on {1} could not be resolved FHIRPATH_DISCRIMINATOR_TYPE_NONE = illegal use of ofType() in discriminator - no type on element {0} FHIRPATH_DISCRIMINATOR_TYPE_MULTIPLE = illegal use of ofType() in discriminator - Multiple possible types on {0} @@ -605,8 +615,12 @@ FHIRPATH_DISCRIMINATOR_BAD_SYNTAX_CONST = illegal expression syntax in discrimin FHIRPATH_DISCRIMINATOR_CANT_FIND = Unable to resolve discriminator in definitions: {0} in profile {1} on element {2}, looking in profile {3} FHIRPATH_DISCRIMINATOR_CANT_FIND_EXTENSION = Unable to resolve discriminator {0} on {2} found in the definitions because the extension {1} wasn''t found in the profile {3} FHIRPATH_DISCRIMINATOR_NOTYPE = Error in discriminator at {0}: no children, no type -FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL = Error in discriminator at {1}: no children, {0} types -FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL = Error in discriminator at {1}: no children, {0} type profiles +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL_one = +FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL_other = Error in discriminator at {1}: no children, {0} types +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL_one = +FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL_other = Error in discriminator at {1}: no children, {0} type profiles FHIRPATH_UNABLE_BOOLEAN = Unable to evaluate as a boolean: {0} XHTML_XHTML_DOCTYPE_ILLEGAL = Malformed XHTML: Found a DocType declaration, and these are not allowed (XXE security vulnerability protection) PACKAGE_VERSION_MISMATCH = FHIR Version mismatch in package {0}: version is {2} but must be {1} (path: {3}) @@ -616,7 +630,9 @@ SD_MUST_HAVE_DERIVATION = StructureDefinition {0} must have a derivation, since VALIDATION_VAL_PROFILE_OTHER_VERSION = Profile is for a different version of FHIR ({0}) so has been ignored VALIDATION_VAL_PROFILE_THIS_VERSION_OK = Profile for this version of FHIR - all OK VALIDATION_VAL_PROFILE_THIS_VERSION_OTHER = Profile is for this version of FHIR, but is an invalid type {0} -BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_PLURAL = {0} profiles found for {1} resource. More than one is not supported at this time. (Type {2}: {3}) +#The following error cannot occur for a single item. _one case left intentionally blank. +#BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_PLURAL_one = +BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_PLURAL_other = {0} profiles found for {1} resource. More than one is not supported at this time. (Type {2}: {3}) RENDER_BUNDLE_HEADER_ROOT = Bundle {0} of type {1} RENDER_BUNDLE_HEADER_ENTRY = Entry {0} RENDER_BUNDLE_HEADER_ENTRY_URL = Entry {0} - Full URL = {1} @@ -648,7 +664,9 @@ FHIRPATH_BAD_DATE = Unable to parse Date {0} FHIRPATH_NUMERICAL_ONLY = Error evaluating FHIRPath expression: The function {0} can only be used on integer, decimal or Quantity but found {1} FHIRPATH_DECIMAL_ONLY = Error evaluating FHIRPath expression: The function {0} can only be used on a decimal but found {1} FHIRPATH_CONTINUOUS_ONLY= Error evaluating FHIRPath expression: The function {0} can only be used on a decimal or date type but found {1} -FHIRPATH_FOCUS_PLURAL = Error evaluating FHIRPath expression: focus for {0} can only have one value, but has {0} values +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_FOCUS_PLURAL_one = +FHIRPATH_FOCUS_PLURAL_other = Error evaluating FHIRPath expression: focus for {0} can only have one value, but has {0} values REFERENCE_REF_SUSPICIOUS = The syntax of the reference ''{0}'' looks incorrect, and it should be checked TYPE_SPECIFIC_CHECKS_DT_QTY_NO_ANNOTATIONS = UCUM Codes that contain human readable annotations like {0} can be misleading. Best Practice is not to use annotations in the UCUM code, and rather to make sure that Quantity.unit is correctly human readable XHTML_XHTML_ELEMENT_ILLEGAL_IN_PARA = Illegal element name inside in a paragraph in the XHTML (''{0}'') @@ -764,5 +782,9 @@ TYPE_SPECIFIER_ABSTRACT_TYPE = The Type specifier {1} specified an abstract typ TYPE_SPECIFIER_NM_ILLEGAL_TYPE = No Type specifier matched, and the underlying type {0} is not valid TYPE_SPECIFIER_NM_ABSTRACT_TYPE = No Type specifier matched, and the underlying type {0} is not abstract ELEMENT_CANNOT_BE_NULL = The element is not allowed to be 'null' -MULTIPLE_LOGICAL_MODELS_PLURAL={0} Logical Models found in supplied profiles, so unable to parse logical model (can only be one, found {1}) +#The following error cannot occur for a single item. _one case left intentionally blank. +MULTIPLE_LOGICAL_MODELS_PLURAL_one= +MULTIPLE_LOGICAL_MODELS_PLURAL_other={0} Logical Models found in supplied profiles, so unable to parse logical model (can only be one, found {1}) +UNRECOGNISED_PROPERTY_TYPE = Invalid JSON type {0} for the element {1}; valid types = {2} +UNRECOGNISED_PROPERTY_TYPE_WRONG = Invalid type {2} for the element {1}; valid types = {3}, JSON type = {0} diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages_de.properties b/org.hl7.fhir.utilities/src/main/resources/Messages_de.properties index 9b2200d42..2aab7b8ff 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages_de.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages_de.properties @@ -445,4 +445,33 @@ Unable_to_resolve_system__no_value_set=System nicht aufl\u00f6sbar - kein ValueS This_base_property_must_be_an_Array_not_a_=Diese Basis Property muss ein Array sein, nicht ein {0} This_property_must_be_an_Array_not_a_=Diese Eigenschaft muss ein Array sein, nicht ein {0} documentmsg = (document) +XHTML_URL_INVALID_CHARS_PLURAL_one = REPARIERE MICH +XHTML_URL_INVALID_CHARS_PLURAL_other = REPARIERE MICH +#The following error cannot occur for a single item. _one case left intentionally blank. +#BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_PLURAL_one = REPARIERE MICH +BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_PLURAL_other = REPARIERE MICH +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_LEFT_VALUE_PLURAL_one = +FHIRPATH_LEFT_VALUE_PLURAL_other = REPARIERE MICH +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_RIGHT_VALUE_PLURAL_one = +FHIRPATH_RIGHT_VALUE_PLURAL_other = REPARIERE MICH +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL_one = +FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL_other = REPARIERE MICH +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL_one = +FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL_other = REPARIERE MICH +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL_one = +FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL_other = REPARIERE MICH +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL_one = +FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL_other = REPARIERE MICH +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_FOCUS_PLURAL_one = +FHIRPATH_FOCUS_PLURAL_other = REPARIERE MICH +#The following error cannot occur for a single item. _one case left intentionally blank. +MULTIPLE_LOGICAL_MODELS_PLURAL_one= +MULTIPLE_LOGICAL_MODELS_PLURAL_other= REPARIERE MICH diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages_nl.properties b/org.hl7.fhir.utilities/src/main/resources/Messages_nl.properties index e5621ec18..e9b5ab9ed 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages_nl.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages_nl.properties @@ -504,7 +504,8 @@ MEASURE_M_CRITERIA_CQL_NO_ELM = Fout in {0}: Geen gecompileerde versie van CQL g MEASURE_M_CRITERIA_CQL_ELM_NOT_VALID = = Fout in {0}: Gecompileerde versie van CQL is niet geldig MEASURE_M_CRITERIA_CQL_NOT_FOUND = De functie {1} bestaat niet in de bibliotheek {0} XHTML_URL_EMPTY = URL is leeg -XHTML_URL_INVALID_CHARS_PLURAL = URL bevat ongeldige tekens ({1}) +XHTML_URL_INVALID_CHARS_PLURAL_one = REPAREER MIJ +XHTML_URL_INVALID_CHARS_PLURAL_other = URL bevat ongeldige tekens ({1}) TERMINOLOGY_TX_SYSTEM_HTTPS = De system URL ''{0}'' begint onterecht met https: in plaats van http: CODESYSTEM_CS_NO_VS_NOTCOMPLETE = Review de ''alle codes'' ValueSet - incomplete CodeSystems moeten generiek geen waardelijst voor ''alle codes'' specificeren TYPE_SPECIFIC_CHECKS_DT_IDENTIFIER_IETF_SYSTEM_VALUE = als identifier.system ''urn:ietf:rfc:3986'' is, dan moet de identifier.value een volledige URI zijn (dus beginnen met een scheme) @@ -552,9 +553,13 @@ FHIRPATH_UNKNOWN_NAME = Fout bij evalueren FHIRPath expressie: De naam {0} is ni FHIRPATH_UNKNOWN_CONSTANT = Fout bij evalueren FHIRPath expressie: Ongeldige FHIR constante {0} FHIRPATH_CANNOT_USE = Fout bij evalueren FHIRPath expressie: Kan {0} niet gebruiken in deze context omdat {1} FHIRPATH_CANT_COMPARE = Fout bij evalueren FHIRPath expressie: Kan geen waarden vergelijken van type {0} en {1} -FHIRPATH_LEFT_VALUE_PLURAL = Fout bij evalueren FHIRPath expressie: linker operandus van {1} heeft meer dan een waarde +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_LEFT_VALUE_PLURAL_one = +FHIRPATH_LEFT_VALUE_PLURAL_other = Fout bij evalueren FHIRPath expressie: linker operandus van {1} heeft meer dan een waarde FHIRPATH_LEFT_VALUE_WRONG_TYPE = Fout bij evalueren FHIRPath expressie: linker operandus van {0} heeft het verkeerde type {1} -FHIRPATH_RIGHT_VALUE_PLURAL = Fout bij evalueren FHIRPath expressie: rechter operandus van {1} heeft meer dan een waarde +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_RIGHT_VALUE_PLURAL_one = +FHIRPATH_RIGHT_VALUE_PLURAL_other = Fout bij evalueren FHIRPath expressie: rechter operandus van {1} heeft meer dan een waarde FHIRPATH_RIGHT_VALUE_WRONG_TYPE = Fout bij evalueren FHIRPath expressie: rechter operandus van {0} heeft het verkeerde type {1} FHIRPATH_OP_INCOMPATIBLE = Fout bij evalueren FHIRPath expressie {0}: linker en rechter operandus hebben incompatibele of ongeldige typen ({1}, {2}) FHIRPATH_HO_HOST_SERVICES = Interne fout bij evalueren FHIRPath expressie: er zijn geen host services gespecificeerd ({0}) @@ -571,9 +576,13 @@ FHIRPATH_NO_TYPE = Fout bij evalueren FHIRPath expressie: Het type ''{0}'' is on FHIRPATH_DISCRIMINATOR_NAME_ALREADY_SLICED = Fout in discriminator bij {0}: sliced element gevonden bij opzoeken van de vaste waarde voor een van de slices FHIRPATH_DISCRIMINATOR_THIS_CANNOT_FIND = Probleem in gebruik van resolve() - profiel {0} op {1} is niet gevonden FHIRPATH_DISCRIMINATOR_RESOLVE_NO_TYPE = onjuist gebruik van resolve() in discriminator - geen type op element {0} -FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES = onjuist gebruik van resolve() in discriminator - Meerdere mogelijke typen op {0} +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL_one = +FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL_other = onjuist gebruik van resolve() in discriminator - Meerdere mogelijke typen op {0} FHIRPATH_DISCRIMINATOR_RESOLVE_NOT_REFERENCE = onjuist gebruik van resolve() in discriminator - Type op {0} is niet Reference {1} -FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL = onjuist gebruik van resolve() in discriminator - Meerdere mogelijke doelprofielen op {1} +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL_one = +FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL_other = onjuist gebruik van resolve() in discriminator - Meerdere mogelijke doelprofielen op {1} FHIRPATH_RESOLVE_DISCRIMINATOR_CANT_FIND = Probleem met gebruik van resolve() - profiel {0} op {1} is niet gevonden FHIRPATH_DISCRIMINATOR_TYPE_NONE = onjuist gebruik van ofType() in discriminator - geen type op element {0} FHIRPATH_DISCRIMINATOR_TYPE_MULTIPLE = onjuist gebruik van ofType() in discriminator - Meerdere mogelijke typen op {0} @@ -583,8 +592,12 @@ FHIRPATH_DISCRIMINATOR_BAD_SYNTAX_GROUP = onjuiste expressiesyntax in discrimina FHIRPATH_DISCRIMINATOR_BAD_SYNTAX_CONST = onjuiste expressiesyntax in discriminator (const) FHIRPATH_DISCRIMINATOR_CANT_FIND = Kan discriminator niet vinden in definities: {0} FHIRPATH_DISCRIMINATOR_NOTYPE = Fout in discriminator bij {0}: geen onderliggende elementen, geen type -FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL = Fout in discriminator bij {1}: geen onderliggende elementen, meerdere typen -FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL = Fout in discriminator bij {1}: geen onderliggende elementen, meerdere typeprofielen +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL_one = +FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL_other = Fout in discriminator bij {1}: geen onderliggende elementen, meerdere typen +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL_one = +FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL_other = Fout in discriminator bij {1}: geen onderliggende elementen, meerdere typeprofielen FHIRPATH_UNABLE_BOOLEAN = Kan niet verwerken als een boolean: {0} XHTML_XHTML_DOCTYPE_ILLEGAL = Misvormde XHTML: DocType declaratie gevonden en deze zijn niet toegestaan (bescherming tegen XXE veiligheidsrisico) PACKAGE_VERSION_MISMATCH = FHIR-versie incorrect in package {0}: versie is {2} moet moet zijn {1} (pad: {3}) @@ -594,7 +607,9 @@ SD_MUST_HAVE_DERIVATION = StructureDefinition {0} moet een derivation bevatten, VALIDATION_VAL_PROFILE_OTHER_VERSION = Profiel is voor een andere versie van FHIR ({0}) dus wordt genegeerd VALIDATION_VAL_PROFILE_THIS_VERSION_OK = Profiel voor deze versie van FHIR - alles in orde VALIDATION_VAL_PROFILE_THIS_VERSION_OTHER = Profiel is voor deze versie van FHIR, maar heeft een onjuist type {0} -BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_PLURAL = Meerdere profielen gevonden voor contained resource. Dit wordt momenteel niet ondersteund. (Type {2}: {3}) +#The following error cannot occur for a single item. _one case left intentionally blank. +#BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_PLURAL_one = +BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_PLURAL_other = Meerdere profielen gevonden voor contained resource. Dit wordt momenteel niet ondersteund. (Type {2}: {3}) RENDER_BUNDLE_HEADER_ROOT = Bundle {0} van type {1} RENDER_BUNDLE_HEADER_ENTRY = Entry {0} RENDER_BUNDLE_HEADER_ENTRY_URL = Entry {0} - Full URL = {1} @@ -621,7 +636,9 @@ TERMINOLOGY_TX_SYSTEM_WRONG_BUILD = De codesysteemverwijzing {0} is incorrect - FHIRPATH_BAD_DATE = Kan Date {0} niet verwerken FHIRPATH_NUMERICAL_ONLY = Fout bij evalueren FHIRPath expressie: De functie {0} kan alleen worden gebruikt met integer, decimal of Quantity maar gevonden {1} FHIRPATH_DECIMAL_ONLY = Fout bij evalueren FHIRPath expressie: De functie {0} kan alleen worden gebruikt met decimal maar gevonden {1} -FHIRPATH_FOCUS_PLURAL = Fout bij evalueren FHIRPath expressie: focus voor {1} heeft meer dan een waarde +#The following error cannot occur for a single item. _one case left intentionally blank. +FHIRPATH_FOCUS_PLURAL_one = +FHIRPATH_FOCUS_PLURAL_other = Fout bij evalueren FHIRPath expressie: focus voor {1} heeft meer dan een waarde REFERENCE_REF_SUSPICIOUS = De syntax van de reference ''{0}'' oogt incorrect en moeten worden gecontroleerd TYPE_SPECIFIC_CHECKS_DT_QTY_NO_ANNOTATIONS = UCUM-codes met menselijk leesbare annotaties zoals {0} kunnen misleidend zijn. Aanbevolen is om geen annotaties in de UCUM-code te gebruiken en in plaats daarvan te zorgen dat Quantity.unit goed leesbaar is XHTML_XHTML_ELEMENT_ILLEGAL_IN_PARA = Ongeldige elementnaam binnen een paragraph in de XHTML (''{0}'') @@ -667,4 +684,6 @@ BUNDLE_SEARCH_ENTRY_WRONG_RESOURCE_TYPE_OUTCOME = Dit is geen OperationOutcome ( BUNDLE_SEARCH_ENTRY_WRONG_RESOURCE_TYPE_NO_MODE = Dit is geen overeenkomstig resourcetype voor de opgegeven zoekactie (is een search.mode nodig?) ({0} verwacht {1}) BUNDLE_SEARCH_NO_MODE = SearchSet bundles zouden search.mode op de entries moeten hebben INV_FAILED = Regel {0} mislukt - +#The following error cannot occur for a single item. _one case left intentionally blank. +MULTIPLE_LOGICAL_MODELS_PLURAL_one= +MULTIPLE_LOGICAL_MODELS_PLURAL_other= REPAREER MIJ diff --git a/org.hl7.fhir.validation.cli/pom.xml b/org.hl7.fhir.validation.cli/pom.xml index cb566ea25..8c4b2028a 100644 --- a/org.hl7.fhir.validation.cli/pom.xml +++ b/org.hl7.fhir.validation.cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.validation/pom.xml b/org.hl7.fhir.validation/pom.xml index 2276bc2e4..e288a2e3c 100644 --- a/org.hl7.fhir.validation/pom.xml +++ b/org.hl7.fhir.validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT ../pom.xml diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java index 595098f77..a84e783b5 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java @@ -322,7 +322,7 @@ public class BaseValidator implements IValidationContextResourceLoader { protected boolean hintPL(List errors, IssueType type, int line, int col, String path, boolean thePass, int num, String theMessage, Object... theMessageArguments) { if (!thePass && doingHints()) { - String message = context.formatMessagePL(num, theMessage, theMessageArguments); + String message = context.formatMessagePlural(num, theMessage, theMessageArguments); addValidationMessage(errors, type, line, col, path, message, IssueSeverity.INFORMATION, theMessage); } return thePass; @@ -387,9 +387,9 @@ public class BaseValidator implements IValidationContextResourceLoader { return thePass; } - protected boolean rulePL(List errors, IssueType type, int line, int col, String path, boolean thePass, int num, String theMessage, Object... theMessageArguments) { + protected boolean rulePlural(List errors, IssueType type, int line, int col, String path, boolean thePass, int num, String theMessage, Object... theMessageArguments) { if (!thePass && doingErrors()) { - String message = context.formatMessagePL(num, theMessage, theMessageArguments); + String message = context.formatMessagePlural(num, theMessage, theMessageArguments); addValidationMessage(errors, type, line, col, path, message, IssueSeverity.ERROR, theMessage); } return thePass; @@ -454,9 +454,9 @@ public class BaseValidator implements IValidationContextResourceLoader { return thePass; } - protected boolean rulePL(List errors, IssueType type, String path, boolean thePass, int num, String theMessage, Object... theMessageArguments) { + protected boolean rulePlural(List errors, IssueType type, String path, boolean thePass, int num, String theMessage, Object... theMessageArguments) { if (!thePass && doingErrors()) { - String message = context.formatMessagePL(num, theMessage, theMessageArguments); + String message = context.formatMessagePlural(num, theMessage, theMessageArguments); addValidationMessage(errors, type, -1, -1, path, message, IssueSeverity.ERROR, theMessage); } return thePass; @@ -530,9 +530,9 @@ public class BaseValidator implements IValidationContextResourceLoader { } - protected boolean warningPL(List errors, IssueType type, int line, int col, String path, boolean thePass, int num, String msg, Object... theMessageArguments) { + protected boolean warningPlural(List errors, IssueType type, int line, int col, String path, boolean thePass, int num, String msg, Object... theMessageArguments) { if (!thePass && doingWarnings()) { - String nmsg = context.formatMessagePL(num, msg, theMessageArguments); + String nmsg = context.formatMessagePlural(num, msg, theMessageArguments); IssueSeverity severity = IssueSeverity.WARNING; addValidationMessage(errors, type, line, col, path, nmsg, severity, msg); } diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index 2f5264d44..3a2d91ccf 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -669,7 +669,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat } } if (logicals.size() > 0) { - if (rulePL(errors, IssueType.BUSINESSRULE, "Configuration", logicals.size() == 1, logicals.size(), I18nConstants.MULTIPLE_LOGICAL_MODELS_PLURAL, ResourceUtilities.listUrls(logicals))) { + if (rulePlural(errors, IssueType.BUSINESSRULE, "Configuration", logicals.size() == 1, logicals.size(), I18nConstants.MULTIPLE_LOGICAL_MODELS_PLURAL, ResourceUtilities.listUrls(logicals))) { parser.setLogical(logicals.get(0)); } } @@ -2824,7 +2824,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat if (invalidChars.isEmpty()) { return null; } else { - return context.formatMessagePL(c, I18nConstants.XHTML_URL_INVALID_CHARS_PLURAL, invalidChars.toString()); + return context.formatMessagePlural(c, I18nConstants.XHTML_URL_INVALID_CHARS_PLURAL, invalidChars.toString()); } } } @@ -4242,7 +4242,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat throw new DefinitionException(context.formatMessage(I18nConstants.DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_NO_TYPES, discriminator, ed.getId(), profile.getUrl())); } } else if (criteriaElement.getType().size() > 1) { - throw new DefinitionException(context.formatMessagePL(criteriaElement.getType().size(), I18nConstants.DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_MULTIPLE_TYPES_PLURAL, discriminator, ed.getId(), profile.getUrl(), criteriaElement.typeSummary())); + throw new DefinitionException(context.formatMessagePlural(criteriaElement.getType().size(), I18nConstants.DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_MULTIPLE_TYPES_PLURAL, discriminator, ed.getId(), profile.getUrl(), criteriaElement.typeSummary())); } else throw new DefinitionException(context.formatMessage(I18nConstants.DISCRIMINATOR__IS_BASED_ON_TYPE_BUT_SLICE__IN__HAS_NO_TYPES, discriminator, ed.getId(), profile.getUrl())); if (discriminator.isEmpty()) { @@ -4255,7 +4255,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat throw new DefinitionException(context.formatMessage(I18nConstants.PROFILE_BASED_DISCRIMINATORS_MUST_HAVE_A_TYPE__IN_PROFILE_, criteriaElement.getId(), profile.getUrl())); } if (criteriaElement.getType().size() != 1) { - throw new DefinitionException(context.formatMessagePL(criteriaElement.getType().size(), I18nConstants.PROFILE_BASED_DISCRIMINATORS_MUST_HAVE_ONLY_ONE_TYPE__IN_PROFILE_PLURAL, criteriaElement.getId(), profile.getUrl())); + throw new DefinitionException(context.formatMessagePlural(criteriaElement.getType().size(), I18nConstants.PROFILE_BASED_DISCRIMINATORS_MUST_HAVE_ONLY_ONE_TYPE__IN_PROFILE_PLURAL, criteriaElement.getId(), profile.getUrl())); } List list = discriminator.endsWith(".resolve()") || discriminator.equals("resolve()") ? criteriaElement.getType().get(0).getTargetProfile() : criteriaElement.getType().get(0).getProfile(); if (list.size() == 0) { @@ -4293,7 +4293,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat anyFound = true; } if (!anyFound) { - throw new DefinitionException(context.formatMessagePL(slicer.getSlicing().getDiscriminator().size(), I18nConstants.Could_not_match_discriminator_for_slice_in_profile_PLURAL, discriminators, ed.getId(), profile.getUrl(), discriminators)); + throw new DefinitionException(context.formatMessagePlural(slicer.getSlicing().getDiscriminator().size(), I18nConstants.Could_not_match_discriminator_for_slice_in_profile_PLURAL, discriminators, ed.getId(), profile.getUrl(), discriminators)); } try { @@ -5095,7 +5095,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat for (CanonicalType u : typeForResource.getProfile()) { b.append(u.asStringValue()); } - ok = rulePL(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), + ok = rulePlural(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), false, typeForResource.getProfile().size(), I18nConstants.BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_PLURAL, special.toHuman(), typeForResource.getCode(), b.toString()) && ok; } } @@ -5112,7 +5112,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat false, I18nConstants.BUNDLE_BUNDLE_ENTRY_TYPE2, resourceName, types.get(0)) && ok; } else { - ok = rulePL(errors, IssueType.INFORMATIONAL, element.line(), element.col(), stack.getLiteralPath(), + ok = rulePlural(errors, IssueType.INFORMATIONAL, element.line(), element.col(), stack.getLiteralPath(), false, types.size(), I18nConstants.BUNDLE_BUNDLE_ENTRY_TYPE3_PLURAL, resourceName, types) && ok; } } @@ -5522,7 +5522,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat } } } else { - warningPL(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.getPath(), false, goodProfiles.size(), I18nConstants.VALIDATION_VAL_PROFILE_MULTIPLEMATCHES_PLURAL, ResourceUtilities.listStrings(goodProfiles.keySet())); + warningPlural(errors, IssueType.STRUCTURE, ei.line(), ei.col(), ei.getPath(), false, goodProfiles.size(), I18nConstants.VALIDATION_VAL_PROFILE_MULTIPLEMATCHES_PLURAL, ResourceUtilities.listStrings(goodProfiles.keySet())); for (String m : goodProfiles.keySet()) { p = this.context.fetchResource(StructureDefinition.class, m); for (ValidationMessage message : goodProfiles.get(m)) { @@ -5664,7 +5664,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat hintPL(errors, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count >= ed.getMin(), count, I18nConstants.VALIDATION_VAL_PROFILE_NOCHECKMIN_PLURAL, profile.getUrl(), ed.getPath(), ed.getId(), ed.getSliceName(),ed.getLabel(), stack.getLiteralPath(), Integer.toString(ed.getMin())); else { if (count < ed.getMin()) { - ok = rulePL(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), false, count, I18nConstants.VALIDATION_VAL_PROFILE_MINIMUM_PLURAL, profile.getUrl(), ed.getPath(), ed.getId(), ed.getSliceName(),ed.getLabel(), stack.getLiteralPath(), Integer.toString(ed.getMin())) && ok; + ok = rulePlural(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), false, count, I18nConstants.VALIDATION_VAL_PROFILE_MINIMUM_PLURAL, profile.getUrl(), ed.getPath(), ed.getId(), ed.getSliceName(),ed.getLabel(), stack.getLiteralPath(), Integer.toString(ed.getMin())) && ok; } } } @@ -5672,7 +5672,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat if (problematicPaths.contains(ed.getPath())) hintPL(errors, IssueType.NOTSUPPORTED, element.line(), element.col(), stack.getLiteralPath(), count <= Integer.parseInt(ed.getMax()), count, I18nConstants.VALIDATION_VAL_PROFILE_NOCHECKMAX_PLURAL, profile.getUrl(), ed.getPath(), ed.getId(), ed.getSliceName(),ed.getLabel(), stack.getLiteralPath(), ed.getMax()); else if (count > Integer.parseInt(ed.getMax())) { - ok = rulePL(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), false, count, I18nConstants.VALIDATION_VAL_PROFILE_MAXIMUM_PLURAL, profile.getUrl(), ed.getPath(), ed.getId(), ed.getSliceName(),ed.getLabel(), stack.getLiteralPath(), ed.getMax(), Integer.toString(count)) && ok; + ok = rulePlural(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), false, count, I18nConstants.VALIDATION_VAL_PROFILE_MAXIMUM_PLURAL, profile.getUrl(), ed.getPath(), ed.getId(), ed.getSliceName(),ed.getLabel(), stack.getLiteralPath(), ed.getMax(), Integer.toString(count)) && ok; } } } diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/QuestionnaireValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/QuestionnaireValidator.java index 3d74ad67f..4df18f705 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/QuestionnaireValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/type/QuestionnaireValidator.java @@ -402,7 +402,7 @@ public class QuestionnaireValidator extends BaseValidator { private boolean validateQuestionnaireResponseItem(ValidatorHostContext hostcontext, QuestionnaireWithContext qsrc, QuestionnaireItemComponent qItem, List errors, List elements, NodeStack stack, boolean inProgress, Element questionnaireResponseRoot, QStack qstack) { boolean ok = true; if (elements.size() > 1) { - ok = rulePL(errors, IssueType.INVALID, elements.get(1).getElement().line(), elements.get(1).getElement().col(), stack.getLiteralPath(), qItem.getRepeats(), elements.size(), I18nConstants.QUESTIONNAIRE_QR_ITEM_ONLYONEI_PLURAL, qItem.getLinkId()) && ok; + ok = rulePlural(errors, IssueType.INVALID, elements.get(1).getElement().line(), elements.get(1).getElement().col(), stack.getLiteralPath(), qItem.getRepeats(), elements.size(), I18nConstants.QUESTIONNAIRE_QR_ITEM_ONLYONEI_PLURAL, qItem.getLinkId()) && ok; } for (ElementWithIndex element : elements) { NodeStack ns = stack.push(element.getElement(), element.getIndex(), null, null); @@ -519,7 +519,7 @@ public class QuestionnaireValidator extends BaseValidator { return (s); } - ok.see(rulePL(errors, IssueType.STRUCTURE, values.get(0).line(), values.get(0).col(), ns.getLiteralPath(), false, types.length, I18nConstants.QUESTIONNAIRE_QR_ITEM_WRONGTYPE_PLURAL, l.toString())); + ok.see(rulePlural(errors, IssueType.STRUCTURE, values.get(0).line(), values.get(0).col(), ns.getLiteralPath(), false, types.length, I18nConstants.QUESTIONNAIRE_QR_ITEM_WRONGTYPE_PLURAL, l.toString())); } return null; } diff --git a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/5.0.0/v2-0360|2.7.cache b/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/5.0.0/v2-0360|2.7.cache deleted file mode 100644 index a54af93b9..000000000 --- a/org.hl7.fhir.validation/src/test/resources/txCache/org.hl7.fhir.validation/5.0.0/v2-0360|2.7.cache +++ /dev/null @@ -1,12 +0,0 @@ -------------------------------------------------------------------------------------- -{"code" : { - "system" : "http://terminology.hl7.org/CodeSystem/v2-0360|2.7", - "code" : "BS", - "display" : "Bachelor of Science" -}, "valueSet" :null, "lang":"null", "useServer":"true", "useClient":"true", "guessSystem":"false", "valueSetMode":"ALL_CHECKS", "versionFlexible":"true"}#### -v: { - "display" : "Bachelor of Science", - "code" : "BS", - "system" : "http://terminology.hl7.org/CodeSystem/v2-0360|2.7" -} -------------------------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 395dc99c4..c4bd1e5dc 100644 --- a/pom.xml +++ b/pom.xml @@ -14,12 +14,12 @@ HAPI FHIR --> org.hl7.fhir.core - 5.6.75-SNAPSHOT + 5.6.76-SNAPSHOT pom 5.4.0 - 1.1.121-SNAPSHOT + 1.1.122-SNAPSHOT 5.7.1 1.8.2 3.0.0-M5