From 02b6e80b6d8b61ebb6beca9bbe55af2c1715eaf8 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Fri, 22 Mar 2024 22:49:31 +1100 Subject: [PATCH] refactor language handling in R5 renderers --- .../fhir/dstu2/utils/ProfileUtilities.java | 5 +- .../dstu2016may/utils/ProfileUtilities.java | 5 +- .../dstu3/conformance/ProfileUtilities.java | 13 +-- .../fhir/r4/conformance/ProfileUtilities.java | 13 +-- .../comparison/CanonicalResourceComparer.java | 3 +- .../CapabilityStatementComparer.java | 3 +- .../r4b/comparison/CodeSystemComparer.java | 3 +- .../fhir/r4b/comparison/ProfileComparer.java | 4 +- .../fhir/r4b/comparison/ValueSetComparer.java | 5 +- .../r4b/conformance/ProfileUtilities.java | 13 +-- .../r4b/renderers/QuestionnaireRenderer.java | 5 +- .../QuestionnaireResponseRenderer.java | 5 +- .../comparison/CanonicalResourceComparer.java | 3 +- .../CapabilityStatementComparer.java | 3 +- .../r5/comparison/CodeSystemComparer.java | 3 +- .../StructureDefinitionComparer.java | 4 +- .../fhir/r5/comparison/ValueSetComparer.java | 5 +- .../profile/ProfilePathProcessor.java | 20 ++++ .../conformance/profile/ProfileUtilities.java | 3 +- .../fhir/r5/context/BaseWorkerContext.java | 52 ---------- .../hl7/fhir/r5/context/IWorkerContext.java | 4 +- .../hl7/fhir/r5/renderers/BundleRenderer.java | 48 ++++----- .../fhir/r5/renderers/CodeSystemRenderer.java | 38 +++---- .../r5/renderers/QuestionnaireRenderer.java | 4 +- .../QuestionnaireResponseRenderer.java | 4 +- .../org/hl7/fhir/r5/renderers/Renderer.java | 52 ++++------ .../fhir/r5/renderers/ResourceRenderer.java | 2 +- .../StructureDefinitionRenderer.java | 20 ++-- .../r5/renderers/TerminologyRenderer.java | 14 +-- .../fhir/r5/renderers/ValueSetRenderer.java | 2 +- .../r5/renderers/utils/RenderingContext.java | 6 +- .../fhir/r5/utils/TranslatingUtilities.java | 62 ------------ .../org/hl7/fhir/utilities/i18n/I18nBase.java | 16 +-- .../utilities/i18n/RenderingI18nContext.java | 99 +++++++++++++++++++ .../xhtml/HierarchicalTableGenerator.java | 56 ++++++----- .../hl7/fhir/utilities/xhtml/XhtmlNode.java | 47 +++++++++ .../src/main/resources/Messages.properties | 21 ---- .../src/main/resources/Messages_de.properties | 16 --- .../src/main/resources/Messages_es.properties | 16 --- .../src/main/resources/Messages_ja.properties | 21 ---- .../src/main/resources/Messages_nl.properties | 16 --- .../resources/rendering-phrases.properties | 83 ++++++++++++++++ .../resources/rendering-phrases_de.properties | 17 ++++ .../resources/rendering-phrases_es.properties | 17 ++++ .../resources/rendering-phrases_ja.properties | 22 +++++ .../resources/rendering-phrases_nl.properties | 17 ++++ .../generator/InstanceGenerator.java | 57 +++++++++++ pom.xml | 2 +- 48 files changed, 560 insertions(+), 389 deletions(-) delete mode 100644 org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TranslatingUtilities.java create mode 100644 org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java create mode 100644 org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties create mode 100644 org.hl7.fhir.utilities/src/main/resources/rendering-phrases_de.properties create mode 100644 org.hl7.fhir.utilities/src/main/resources/rendering-phrases_es.properties create mode 100644 org.hl7.fhir.utilities/src/main/resources/rendering-phrases_ja.properties create mode 100644 org.hl7.fhir.utilities/src/main/resources/rendering-phrases_nl.properties create mode 100644 org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/generator/InstanceGenerator.java diff --git a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/utils/ProfileUtilities.java b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/utils/ProfileUtilities.java index ee861cc83..5701beccc 100644 --- a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/utils/ProfileUtilities.java +++ b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/utils/ProfileUtilities.java @@ -70,6 +70,7 @@ import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -1281,7 +1282,7 @@ public class ProfileUtilities { public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics); TableModel model = gen.initNormalTable(corePath, false, true, ed.getId(), false, TableGenerationMode.XML); boolean deep = false; @@ -1566,7 +1567,7 @@ public class ProfileUtilities { boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, Set outputTracker) throws IOException, FHIRException { assert (diff != snapshot);// check it's ok to get rid of one of these - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics); TableModel model = gen.initNormalTable(corePath, false, true, profile.getId() + (diff ? "d" : "s"), false, TableGenerationMode.XML); List list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); diff --git a/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/ProfileUtilities.java b/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/ProfileUtilities.java index 6c5375015..35530de7b 100644 --- a/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/ProfileUtilities.java +++ b/org.hl7.fhir.dstu2016may/src/main/java/org/hl7/fhir/dstu2016may/utils/ProfileUtilities.java @@ -71,6 +71,7 @@ import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -1283,7 +1284,7 @@ public class ProfileUtilities { public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics); TableModel model = gen.initNormalTable(corePath, false, true, ed.getId(), false, TableGenerationMode.XML); boolean deep = false; @@ -1565,7 +1566,7 @@ public class ProfileUtilities { boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, boolean logicalModel, Set outputTracker) throws IOException, FHIRException { assert (diff != snapshot);// check it's ok to get rid of one of these - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics); TableModel model = gen.initNormalTable(corePath, false, true, profile.getId() + (diff ? "d" : "s"), false, TableGenerationMode.XML); List list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); diff --git a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java index 665f07f06..945274c62 100644 --- a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/conformance/ProfileUtilities.java @@ -96,6 +96,7 @@ import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.Source; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator; @@ -1620,8 +1621,7 @@ public class ProfileUtilities extends TranslatingUtilities { } public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics); TableModel model = gen.initNormalTable(corePath, false, true, ed.getId(), false, TableGenerationMode.XML); boolean deep = false; @@ -1989,8 +1989,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set outputTracker) throws IOException, FHIRException { assert(diff != snapshot);// check it's ok to get rid of one of these - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics); TableModel model = gen.initNormalTable(corePath, false, true, profile.getId()+(diff ? "d" : "s"), false, TableGenerationMode.XML); List list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); List profiles = new ArrayList(); @@ -2005,8 +2004,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics); TableModel model = gen.initGridTable(corePath, profile.getId()); List list = profile.getSnapshot().getElement(); List profiles = new ArrayList(); @@ -3482,8 +3480,7 @@ public class ProfileUtilities extends TranslatingUtilities { } public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, false); TableModel model = initSpanningTable(gen, "", false, profile.getId()); Set processed = new HashSet(); SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix); diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java index 981b00a61..42718a344 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/conformance/ProfileUtilities.java @@ -103,6 +103,7 @@ import org.hl7.fhir.utilities.FhirPublication; import org.hl7.fhir.utilities.TerminologyServiceOptions; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.VersionUtilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.Source; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator; @@ -2386,8 +2387,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true); TableModel model = gen.initNormalTable(corePath, false, true, ed.getId(), false, TableGenerationMode.XML); boolean deep = false; @@ -2792,8 +2792,7 @@ public class ProfileUtilities extends TranslatingUtilities { boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set outputTracker) throws IOException, FHIRException { assert (diff != snapshot);// check it's ok to get rid of one of these - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true); TableModel model = gen.initNormalTable(corePath, false, true, profile.getId() + (diff ? "d" : "s"), false, TableGenerationMode.XML); List list = diff ? profile.getDifferential().getElement() : profile.getSnapshot().getElement(); @@ -2817,8 +2816,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true); TableModel model = gen.initGridTable(corePath, profile.getId()); List list = profile.getSnapshot().getElement(); List profiles = new ArrayList(); @@ -4969,8 +4967,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, false, true); TableModel model = initSpanningTable(gen, "", false, profile.getId()); Set processed = new HashSet(); SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix); diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CanonicalResourceComparer.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CanonicalResourceComparer.java index 510778e04..b6f07255a 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CanonicalResourceComparer.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CanonicalResourceComparer.java @@ -19,6 +19,7 @@ import org.hl7.fhir.r4b.model.Coding; import org.hl7.fhir.r4b.model.PrimitiveType; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -291,7 +292,7 @@ public abstract class CanonicalResourceComparer extends ResourceComparer { public XhtmlNode renderMetadata(CanonicalResourceComparison comparison, String id, String prefix) throws FHIRException, IOException { // columns: code, display (left|right), properties (left|right) - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false); TableModel model = gen.new TableModel(id, true); model.setAlternating(true); model.getTitles().add(gen.new Title(null, null, "Name", "Property Name", null, 100)); diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CapabilityStatementComparer.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CapabilityStatementComparer.java index 7fcbbe547..5551e3a03 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CapabilityStatementComparer.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CapabilityStatementComparer.java @@ -34,6 +34,7 @@ import org.hl7.fhir.r4b.model.PrimitiveType; import org.hl7.fhir.r4b.model.Resource; import org.hl7.fhir.r4b.model.StructureDefinition; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -867,7 +868,7 @@ public class CapabilityStatementComparer extends CanonicalResourceComparer { // comments public XhtmlNode renderStatements(CapabilityStatementComparison comparison, String id, String prefix) throws FHIRException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false); TableModel model = gen.new TableModel(id, true); model.setAlternating(true); model.getTitles().add(gen.new Title(null, null, "Type", "The type of item", null, 100)); diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CodeSystemComparer.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CodeSystemComparer.java index 4b50180fa..b56c1ca64 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CodeSystemComparer.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/CodeSystemComparer.java @@ -16,6 +16,7 @@ import org.hl7.fhir.r4b.model.CodeSystem.ConceptDefinitionDesignationComponent; import org.hl7.fhir.r4b.model.CodeSystem.ConceptPropertyComponent; import org.hl7.fhir.r4b.model.CodeSystem.PropertyComponent; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -348,7 +349,7 @@ public class CodeSystemComparer extends CanonicalResourceComparer { public XhtmlNode renderConcepts(CodeSystemComparison comparison, String id, String prefix) throws FHIRException, IOException { // columns: code, display (left|right), properties (left|right) - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false); TableModel model = gen.new TableModel(id, true); model.setAlternating(true); model.getTitles().add(gen.new Title(null, null, "Code", "The code for the concept", null, 100)); diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/ProfileComparer.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/ProfileComparer.java index b9c4184f8..7cebd264c 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/ProfileComparer.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/ProfileComparer.java @@ -33,6 +33,7 @@ import org.hl7.fhir.r4b.model.ValueSet; import org.hl7.fhir.r4b.utils.DefinitionNavigator; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator; @@ -1027,8 +1028,7 @@ public class ProfileComparer extends CanonicalResourceComparer { public XhtmlNode renderStructure(ProfileComparison comp, String id, String prefix, String corePath) throws FHIRException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false, true); - gen.setTranslator(session.getContextRight().translator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false, true); TableModel model = gen.initComparisonTable(corePath, id); genElementComp(null /* oome back to this later */, gen, model.getRows(), comp.combined, corePath, prefix, null, true); diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/ValueSetComparer.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/ValueSetComparer.java index 1b7e0cb1e..0afdfec7e 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/ValueSetComparer.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/comparison/ValueSetComparer.java @@ -19,6 +19,7 @@ import org.hl7.fhir.r4b.model.ValueSet.ValueSetComposeComponent; import org.hl7.fhir.r4b.model.ValueSet.ValueSetExpansionContainsComponent; import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -577,7 +578,7 @@ public class ValueSetComparer extends CanonicalResourceComparer { } public XhtmlNode renderCompose(ValueSetComparison csc, String id, String prefix) throws FHIRException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "comparison"), false); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "comparison"), false); TableModel model = gen.new TableModel(id, true); model.setAlternating(true); model.getTitles().add(gen.new Title(null, null, "Item", "The type of item being compared", null, 100)); @@ -778,7 +779,7 @@ public class ValueSetComparer extends CanonicalResourceComparer { boolean hasAbstract = findAbstract(csc.getExpansion()); boolean hasInactive = findInactive(csc.getExpansion()); - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "comparison"), false); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "comparison"), false); TableModel model = gen.new TableModel(id, true); model.setAlternating(true); if (hasSystem) { diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/conformance/ProfileUtilities.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/conformance/ProfileUtilities.java index 892fadaad..007469b98 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/conformance/ProfileUtilities.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/conformance/ProfileUtilities.java @@ -121,6 +121,7 @@ import org.hl7.fhir.utilities.MarkDownProcessor; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.i18n.I18nConstants; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -3874,8 +3875,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set outputTracker, RenderingContext rc) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true); TableModel model = gen.initNormalTable(corePath, false, true, ed.getId() + (full ? "f" : "n"), true, TableGenerationMode.XHTML); @@ -4443,8 +4443,7 @@ public class ProfileUtilities extends TranslatingUtilities { boolean logicalModel, boolean allInvariants, Set outputTracker, boolean active, boolean mustSupport, RenderingContext rc) throws IOException, FHIRException { assert (diff != snapshot);// check it's ok to get rid of one of these - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true); TableModel model = gen.initNormalTable(corePath, false, true, profile.getId() + (diff ? "d" : "s"), active, active ? TableGenerationMode.XHTML : TableGenerationMode.XML); List list = new ArrayList<>(); @@ -4545,8 +4544,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, inlineGraphics, true); TableModel model = gen.initGridTable(corePath, profile.getId()); List list = profile.getSnapshot().getElement(); List profiles = new ArrayList(); @@ -7116,8 +7114,7 @@ public class ProfileUtilities extends TranslatingUtilities { public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), imageFolder, false, true); TableModel model = initSpanningTable(gen, "", false, profile.getId()); Set processed = new HashSet(); SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix); diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/QuestionnaireRenderer.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/QuestionnaireRenderer.java index 641008b8e..b5a0488cd 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/QuestionnaireRenderer.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/QuestionnaireRenderer.java @@ -29,6 +29,7 @@ import org.hl7.fhir.r4b.renderers.utils.RenderingContext; import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome; import org.hl7.fhir.r4b.utils.ToolingExtensions; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator; import org.hl7.fhir.utilities.xhtml.NodeType; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell; @@ -74,7 +75,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer { if (doOpts) { x.b().tx("Structure"); } - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree=" + q.getId(), !forResource); model.setAlternating(true); @@ -511,7 +512,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer { } private boolean renderLogic(XhtmlNode x, Questionnaire q) throws FHIRException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree=" + q.getId(), true); model.setAlternating(true); diff --git a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/QuestionnaireResponseRenderer.java b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/QuestionnaireResponseRenderer.java index 2085c644f..c20e65358 100644 --- a/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/QuestionnaireResponseRenderer.java +++ b/org.hl7.fhir.r4b/src/main/java/org/hl7/fhir/r4b/renderers/QuestionnaireResponseRenderer.java @@ -30,6 +30,7 @@ import org.hl7.fhir.r4b.renderers.utils.RenderingContext; import org.hl7.fhir.r4b.terminologies.ValueSetExpander.ValueSetExpansionOutcome; import org.hl7.fhir.r4b.utils.ToolingExtensions; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator; import org.hl7.fhir.utilities.xhtml.NodeType; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Cell; @@ -79,7 +80,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer { } public boolean renderTree(XhtmlNode x, ResourceWrapper qr) throws UnsupportedEncodingException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree=" + qr.getId(), false); model.setAlternating(true); @@ -107,7 +108,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer { } public boolean renderTree(XhtmlNode x, QuestionnaireResponse q) throws UnsupportedEncodingException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree=" + q.getId(), true); model.setAlternating(true); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CanonicalResourceComparer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CanonicalResourceComparer.java index 2d7e14654..b3ab7b120 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CanonicalResourceComparer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CanonicalResourceComparer.java @@ -19,6 +19,7 @@ import org.hl7.fhir.r5.model.DataType; import org.hl7.fhir.r5.model.PrimitiveType; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -591,7 +592,7 @@ public abstract class CanonicalResourceComparer extends ResourceComparer { public XhtmlNode renderMetadata(CanonicalResourceComparison comparison, String id, String prefix) throws FHIRException, IOException { // columns: code, display (left|right), properties (left|right) - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false); TableModel model = gen.new TableModel(id, true); model.setAlternating(true); model.getTitles().add(gen.new Title(null, null, "Name", "Property Name", null, 100)); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CapabilityStatementComparer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CapabilityStatementComparer.java index 8a3594345..76184d9d0 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CapabilityStatementComparer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CapabilityStatementComparer.java @@ -30,6 +30,7 @@ import org.hl7.fhir.r5.model.Resource; import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.utils.ToolingExtensions; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -742,7 +743,7 @@ public class CapabilityStatementComparer extends CanonicalResourceComparer { // 6 columns: path | left value | left doco | right value | right doco | comments public XhtmlNode renderStatements(CapabilityStatementComparison comparison, String id, String prefix) throws FHIRException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false); TableModel model = gen.new TableModel(id, true); model.setAlternating(true); model.getTitles().add(gen.new Title(null, null, "Type", "The type of item", null, 100)); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CodeSystemComparer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CodeSystemComparer.java index e345aad0e..4a4a9cd22 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CodeSystemComparer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/CodeSystemComparer.java @@ -17,6 +17,7 @@ import org.hl7.fhir.r5.model.CodeSystem.ConceptDefinitionDesignationComponent; import org.hl7.fhir.r5.model.CodeSystem.ConceptPropertyComponent; import org.hl7.fhir.r5.model.CodeSystem.PropertyComponent; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -519,7 +520,7 @@ public class CodeSystemComparer extends CanonicalResourceComparer { public XhtmlNode renderConcepts(CodeSystemComparison comparison, String id, String prefix) throws FHIRException, IOException { // columns: code, display (left|right), properties (left|right) - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false); TableModel model = gen.new TableModel(id, true); model.setAlternating(true); model.getTitles().add(gen.new Title(null, null, "Code", "The code for the concept", null, 100)); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/StructureDefinitionComparer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/StructureDefinitionComparer.java index c67870811..93cdd9da7 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/StructureDefinitionComparer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/StructureDefinitionComparer.java @@ -42,6 +42,7 @@ import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode; import org.hl7.fhir.r5.utils.DefinitionNavigator; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator; @@ -1251,8 +1252,7 @@ public class StructureDefinitionComparer extends CanonicalResourceComparer imple } public XhtmlNode renderStructure(ProfileComparison comp, String id, String prefix, String corePath) throws FHIRException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "compare"), false, true); - gen.setTranslator(session.getContextRight().translator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "compare"), false, true); TableModel model = gen.initComparisonTable(corePath, id); genElementComp(null /* come back to this later */, gen, model.getRows(), comp.combined, corePath, prefix, null, true); return gen.generate(model, prefix, 0, null); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/ValueSetComparer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/ValueSetComparer.java index 5cba9a5c8..a5f8126a0 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/ValueSetComparer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/comparison/ValueSetComparer.java @@ -18,6 +18,7 @@ import org.hl7.fhir.r5.model.ValueSet.ValueSetComposeComponent; import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent; import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType; @@ -588,7 +589,7 @@ public class ValueSetComparer extends CanonicalResourceComparer { } public XhtmlNode renderCompose(ValueSetComparison csc, String id, String prefix) throws FHIRException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "comparison"), false); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "comparison"), false); TableModel model = gen.new TableModel(id, true); model.setAlternating(true); model.getTitles().add(gen.new Title(null, null, "Item", "The type of item being compared", null, 100)); @@ -779,7 +780,7 @@ public class ValueSetComparer extends CanonicalResourceComparer { boolean hasAbstract = findAbstract(csc.getExpansion()); boolean hasInactive = findInactive(csc.getExpansion()); - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(Utilities.path("[tmp]", "comparison"), false); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(new RenderingI18nContext(), Utilities.path("[tmp]", "comparison"), false); TableModel model = gen.new TableModel(id, true); model.setAlternating(true); if (hasSystem) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfilePathProcessor.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfilePathProcessor.java index 9d35c3098..93f8cf074 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfilePathProcessor.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfilePathProcessor.java @@ -171,6 +171,7 @@ public class ProfilePathProcessor { ElementDefinition currentBase = cursors.base.getElement().get(cursors.baseCursor); String currentBasePath = profileUtilities.fixedPathSource(getContextPathSource(), currentBase.getPath(), getRedirector()); debugProcessPathsIteration(cursors, currentBasePath); + checkDiffAssignedAndCursor(cursors); List diffMatches = profileUtilities.getDiffMatches(getDifferential(), currentBasePath, cursors.diffCursor, getDiffLimit(), getProfileName()); // get a list of matching elements in scope // in the simple case, source is not sliced. @@ -195,6 +196,25 @@ public class ProfilePathProcessor { return res; } + private void checkDiffAssignedAndCursor(ProfilePathProcessorState cursors) { +// int i = 0; +// List list = getDifferential().getElement(); +// for (ElementDefinition ed : list) { +// boolean assigned = ed.hasUserData("derived.pointer"); +// if (i < cursors.diffCursor) { +// if (!assigned) { +// throw new Error("what?"); +// } +// } else if (i > cursors.diffCursor) { +// if (assigned) { +// throw new Error("what!?"); +// } +// } +// i++; +// } + + } + private void debugProcessPathsIteration(ProfilePathProcessorState cursors, String currentBasePath) { if (profileUtilities.isDebug()) { System.out.println(getDebugIndent() + " - " + currentBasePath + ": "+ diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java index fc32484c4..407dcfcb1 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/profile/ProfileUtilities.java @@ -99,7 +99,6 @@ import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent; import org.hl7.fhir.r5.terminologies.expansion.ValueSetExpansionOutcome; import org.hl7.fhir.r5.terminologies.utilities.ValidationResult; import org.hl7.fhir.r5.utils.ToolingExtensions; -import org.hl7.fhir.r5.utils.TranslatingUtilities; import org.hl7.fhir.r5.utils.XVerExtensionManager; import org.hl7.fhir.r5.utils.XVerExtensionManager.XVerExtensionStatus; import org.hl7.fhir.r5.utils.formats.CSVWriter; @@ -136,7 +135,7 @@ import org.hl7.fhir.utilities.xml.SchematronWriter.Section; * @author Grahame * */ -public class ProfileUtilities extends TranslatingUtilities { +public class ProfileUtilities { private static boolean suppressIgnorableExceptions; diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java index efd418337..f81f2ddf7 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/BaseWorkerContext.java @@ -139,7 +139,6 @@ import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier; import org.hl7.fhir.utilities.FhirPublication; import org.hl7.fhir.utilities.TimeTracker; import org.hl7.fhir.utilities.ToolingClientLogger; -import org.hl7.fhir.utilities.TranslationServices; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.i18n.I18nBase; @@ -275,7 +274,6 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte private int expandCodesLimit = 1000; protected ILoggingService logger = new SystemOutLoggingService(); protected Parameters expParameters; - private TranslationServices translator = new NullTranslator(); private Map packages = new HashMap<>(); @Getter @@ -310,7 +308,6 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte protected void copy(BaseWorkerContext other) { synchronized (other.lock) { // tricky, because you need to lock this as well, but it's really not in use yet allResourcesById.putAll(other.allResourcesById); - translator = other.translator; codeSystems.copy(other.codeSystems); valueSets.copy(other.valueSets); maps.copy(other.maps); @@ -2640,55 +2637,6 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte } } - public TranslationServices translator() { - return translator; - } - - public void setTranslator(TranslationServices translator) { - this.translator = translator; - } - - public class NullTranslator implements TranslationServices { - - @Override - public String translate(String context, String value, String targetLang) { - return value; - } - - @Override - public String translate(String context, String value) { - return value; - } - - @Override - public String toStr(float value) { - return null; - } - - @Override - public String toStr(Date value) { - return null; - } - - @Override - public String translateAndFormat(String contest, String lang, String value, Object... args) { - return String.format(value, args); - } - - @Override - public Map translations(String value) { - // TODO Auto-generated method stub - return null; - } - - @Override - public Set listTranslations(String category) { - // TODO Auto-generated method stub - return null; - } - - } - public void reportStatus(JsonObject json) { synchronized (lock) { json.addProperty("codeystem-count", codeSystems.size()); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java index 7a2d4f068..987524b92 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java @@ -72,7 +72,6 @@ import org.hl7.fhir.r5.utils.validation.IResourceValidator; import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier; import org.hl7.fhir.utilities.FhirPublication; import org.hl7.fhir.utilities.TimeTracker; -import org.hl7.fhir.utilities.TranslationServices; import org.hl7.fhir.utilities.npm.BasePackageCacheManager; import org.hl7.fhir.utilities.npm.NpmPackage; import org.hl7.fhir.utilities.validation.ValidationMessage; @@ -388,6 +387,8 @@ public interface IWorkerContext { /** * Access to the contexts internationalised error messages + * + * For rendering internationalization, see RenderingContext * * @param theMessage * @param theMessageArguments @@ -506,7 +507,6 @@ public interface IWorkerContext { // todo: figure these out public Map getNSUrlMap(); - public TranslationServices translator(); public void setLogger(@Nonnull ILoggingService logger); public ILoggingService getLogger(); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java index 85c3239ec..ae0542762 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/BundleRenderer.java @@ -68,7 +68,7 @@ public class BundleRenderer extends ResourceRenderer { // nothing } else { XhtmlNode root = new XhtmlNode(NodeType.Element, "div"); - root.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ROOT, b.getId(), b.get("type").primitiveValue())); + root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ROOT, b.getId(), b.get("type").primitiveValue())); int i = 0; for (BaseWrapper be : entries) { i++; @@ -85,9 +85,9 @@ public class BundleRenderer extends ResourceRenderer { } root.hr(); if (be.has("fullUrl")) { - root.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ENTRY_URL, Integer.toString(i), be.get("fullUrl").primitiveValue())); + root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ENTRY_URL, Integer.toString(i), be.get("fullUrl").primitiveValue())); } else { - root.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ENTRY, Integer.toString(i))); + root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ENTRY, Integer.toString(i))); } // if (be.hasRequest()) // renderRequest(root, be.getRequest()); @@ -96,7 +96,7 @@ public class BundleRenderer extends ResourceRenderer { // if (be.hasResponse()) // renderResponse(root, be.getResponse()); if (be.has("resource")) { - root.para().addText(formatMessage(RENDER_BUNDLE_RESOURCE, be.get("resource").fhirType())); + root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_RESOURCE, be.get("resource").fhirType())); ResourceWrapper rw = be.getChildByName("resource").getAsResource(); XhtmlNode xn = rw.getNarrative(); if (xn == null || xn.isEmpty()) { @@ -286,9 +286,9 @@ public class BundleRenderer extends ResourceRenderer { start = 1; docMode = true; x.hr(); - x.h2().addText(formatMessage(RENDER_BUNDLE_DOCUMENT_CONTENT, b.getId(), b.getType().toCode())); + x.h2().addText(formatMessage(RenderingContext.RENDER_BUNDLE_DOCUMENT_CONTENT, b.getId(), b.getType().toCode())); } else { - x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ROOT, b.getId(), b.getType().toCode())); + x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ROOT, b.getId(), b.getType().toCode())); } int i = 0; for (BundleEntryComponent be : b.getEntry()) { @@ -307,17 +307,17 @@ public class BundleRenderer extends ResourceRenderer { x.hr(); if (docMode) { if (be.hasFullUrl() && be.hasResource()) { - x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_DOC_ENTRY_URD, Integer.toString(i), be.getFullUrl(), be.getResource().fhirType(), be.getResource().getIdBase())); + x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_DOC_ENTRY_URD, Integer.toString(i), be.getFullUrl(), be.getResource().fhirType(), be.getResource().getIdBase())); } else if (be.hasFullUrl()) { - x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_DOC_ENTRY_U, Integer.toString(i), be.getFullUrl())); + x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_DOC_ENTRY_U, Integer.toString(i), be.getFullUrl())); } else if (be.hasResource()) { - x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_DOC_ENTRY_RD, Integer.toString(i), be.getResource().fhirType(), be.getResource().getIdBase())); + x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_DOC_ENTRY_RD, Integer.toString(i), be.getResource().fhirType(), be.getResource().getIdBase())); } } else { if (be.hasFullUrl()) { - x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ENTRY_URL, Integer.toString(i), be.getFullUrl())); + x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ENTRY_URL, Integer.toString(i), be.getFullUrl())); } else { - x.para().addText(formatMessage(RENDER_BUNDLE_HEADER_ENTRY, Integer.toString(i))); + x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_HEADER_ENTRY, Integer.toString(i))); } if (be.hasRequest()) renderRequest(x, be.getRequest()); @@ -328,7 +328,7 @@ public class BundleRenderer extends ResourceRenderer { } if (be.hasResource()) { if (!docMode) { - x.para().addText(formatMessage(RENDER_BUNDLE_RESOURCE, be.getResource().fhirType())); + x.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_RESOURCE, be.getResource().fhirType())); } if (be.hasResource()) { XhtmlNode xn = null; @@ -401,42 +401,42 @@ public class BundleRenderer extends ResourceRenderer { private void renderSearch(XhtmlNode root, BundleEntrySearchComponent search) { StringBuilder b = new StringBuilder(); - b.append(formatMessage(RENDER_BUNDLE_SEARCH)); + b.append(formatMessage(RenderingContext.RENDER_BUNDLE_SEARCH)); if (search.hasMode()) - b.append(formatMessage(RENDER_BUNDLE_SEARCH_MODE, search.getMode().toCode())); + b.append(formatMessage(RenderingContext.RENDER_BUNDLE_SEARCH_MODE, search.getMode().toCode())); if (search.hasScore()) { if (search.hasMode()) b.append(","); - b.append(formatMessage(RENDER_BUNDLE_SEARCH_SCORE, search.getScore())); + b.append(formatMessage(RenderingContext.RENDER_BUNDLE_SEARCH_SCORE, search.getScore())); } root.para().addText(b.toString()); } private void renderResponse(XhtmlNode root, BundleEntryResponseComponent response) { - root.para().addText(formatMessage(RENDER_BUNDLE_RESPONSE)); + root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_RESPONSE)); StringBuilder b = new StringBuilder(); b.append(response.getStatus()+"\r\n"); if (response.hasLocation()) - b.append(formatMessage(RENDER_BUNDLE_LOCATION, response.getLocation())+"\r\n"); + b.append(formatMessage(RenderingContext.RENDER_BUNDLE_LOCATION, response.getLocation())+"\r\n"); if (response.hasEtag()) - b.append(formatMessage(RENDER_BUNDLE_ETAG, response.getEtag())+"\r\n"); + b.append(formatMessage(RenderingContext.RENDER_BUNDLE_ETAG, response.getEtag())+"\r\n"); if (response.hasLastModified()) - b.append(formatMessage(RENDER_BUNDLE_LAST_MOD, response.getEtag())+"\r\n"); + b.append(formatMessage(RenderingContext.RENDER_BUNDLE_LAST_MOD, response.getEtag())+"\r\n"); root.pre().addText(b.toString()); } private void renderRequest(XhtmlNode root, BundleEntryRequestComponent request) { - root.para().addText(formatMessage(RENDER_BUNDLE_REQUEST)); + root.para().addText(formatMessage(RenderingContext.RENDER_BUNDLE_REQUEST)); StringBuilder b = new StringBuilder(); b.append(request.getMethod()+" "+request.getUrl()+"\r\n"); if (request.hasIfNoneMatch()) - b.append(formatMessage(RENDER_BUNDLE_IF_NON_MATCH, request.getIfNoneMatch())+"\r\n"); + b.append(formatMessage(RenderingContext.RENDER_BUNDLE_IF_NON_MATCH, request.getIfNoneMatch())+"\r\n"); if (request.hasIfModifiedSince()) - b.append(formatMessage(RENDER_BUNDLE_IF_MOD, request.getIfModifiedSince())+"\r\n"); + b.append(formatMessage(RenderingContext.RENDER_BUNDLE_IF_MOD, request.getIfModifiedSince())+"\r\n"); if (request.hasIfMatch()) - b.append(formatMessage(RENDER_BUNDLE_IF_MATCH, request.getIfMatch())+"\r\n"); + b.append(formatMessage(RenderingContext.RENDER_BUNDLE_IF_MATCH, request.getIfMatch())+"\r\n"); if (request.hasIfNoneExist()) - b.append(formatMessage(RENDER_BUNDLE_IF_NONE, request.getIfNoneExist())+"\r\n"); + b.append(formatMessage(RenderingContext.RENDER_BUNDLE_IF_NONE, request.getIfNoneExist())+"\r\n"); root.pre().addText(b.toString()); } 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 4052eb711..c27c37a85 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 @@ -82,13 +82,13 @@ public class CodeSystemRenderer extends TerminologyRenderer { private void generateFilters(XhtmlNode x, CodeSystem cs) { if (cs.hasFilter()) { - x.para().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Filters", getContext().getLang())); + x.para().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_FILTERS)); XhtmlNode tbl = x.table("grid"); XhtmlNode tr = tbl.tr(); - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Code", getContext().getLang())); - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Description", getContext().getLang())); - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "operator", getContext().getLang())); - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Value", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_FILTER_CODE)); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_FILTER_DESC)); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_FILTER_OP)); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_FILTER_VALUE)); for (CodeSystemFilterComponent f : cs.getFilter()) { tr = tbl.tr(); renderStatus(f, tr.td()).tx(f.getCode()); @@ -112,20 +112,20 @@ public class CodeSystemRenderer extends TerminologyRenderer { hasDescription = hasDescription || p.hasDescription(); } - x.para().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Properties", getContext().getLang())); - x.para().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "This code system defines the following properties for its concepts", getContext().getLang())); + x.para().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROPS)); + x.para().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROPS_DESC)); XhtmlNode tbl = x.table("grid"); XhtmlNode tr = tbl.tr(); if (hasRendered) { - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Name", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROP_NAME)); } - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Code", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROP_CODE)); if (hasURI) { - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "URI", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROP_URI)); } - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Type", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROP_TYPE)); if (hasDescription) { - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Description", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_PROP_DESC)); } for (PropertyComponent p : cs.getProperty()) { tr = tbl.tr(); @@ -149,10 +149,10 @@ public class CodeSystemRenderer extends TerminologyRenderer { private String sentenceForContent(CodeSystemContentMode mode, CodeSystem cs) { switch (mode) { - case COMPLETE: return context.getContext().formatMessage(I18nConstants.RND_CS_CONTENT_COMPLETE); - case EXAMPLE: return context.getContext().formatMessage(I18nConstants.RND_CS_CONTENT_EXAMPLE); - case FRAGMENT: return context.getContext().formatMessage(I18nConstants.RND_CS_CONTENT_FRAGMENT); - case NOTPRESENT: return context.getContext().formatMessage(I18nConstants.RND_CS_CONTENT_NOTPRESENT); + case COMPLETE: return formatMessage(I18nConstants.RND_CS_CONTENT_COMPLETE); + case EXAMPLE: return formatMessage(I18nConstants.RND_CS_CONTENT_EXAMPLE); + case FRAGMENT: return formatMessage(I18nConstants.RND_CS_CONTENT_FRAGMENT); + case NOTPRESENT: return formatMessage(I18nConstants.RND_CS_CONTENT_NOTPRESENT); case SUPPLEMENT: boolean properties = CodeSystemUtilities.hasProperties(cs); boolean designations = CodeSystemUtilities.hasDesignations(cs); @@ -166,7 +166,7 @@ public class CodeSystemRenderer extends TerminologyRenderer { } else { features = "features"; // ? } - return context.getContext().formatMessage(I18nConstants.RND_CS_CONTENT_SUPPLEMENT, features); + return formatMessage(I18nConstants.RND_CS_CONTENT_SUPPLEMENT, features); default: throw new FHIRException("Unknown CodeSystemContentMode mode"); } @@ -174,7 +174,7 @@ public class CodeSystemRenderer extends TerminologyRenderer { private boolean generateCodeSystemContent(XhtmlNode x, CodeSystem cs, boolean hasExtensions, List maps, boolean props) throws FHIRFormatError, DefinitionException, IOException { if (props) { - x.para().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Concepts", getContext().getLang())); + x.para().b().tx(formatMessage(RenderingContext.RENDER_CODESYSTEM_CONCEPTS)); } XhtmlNode p = x.para(); renderStatus(cs.getUrlElement(), p.param("cs")).code().tx(cs.getUrl()); @@ -463,7 +463,7 @@ public class CodeSystemRenderer extends TerminologyRenderer { td = tr.td(); Boolean b = CodeSystemUtilities.isDeprecated(cs, c, false); if (b != null && b) { - smartAddText(td, getContext().getWorker().translator().translate("xhtml-gen-cs", "Deprecated", getContext().getLang())); + smartAddText(td, formatMessage(RenderingContext.RENDER_CODESYSTEM_DEPRECATED)); hasExtensions = true; if (ToolingExtensions.hasExtension(c, ToolingExtensions.EXT_REPLACED_BY)) { Coding cc = (Coding) ToolingExtensions.getExtension(c, ToolingExtensions.EXT_REPLACED_BY).getValue(); 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 7a9d55bb4..ed9bae64d 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 @@ -70,7 +70,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer { if (doOpts) { x.b().tx("Structure"); } - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree="+q.getId(), context.getRules() == GenerationRules.IG_PUBLISHER); model.setAlternating(true); if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) { @@ -460,7 +460,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer { } private boolean renderLogic(XhtmlNode x, Questionnaire q) throws FHIRException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree="+q.getId(), true); model.setAlternating(true); if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) { 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 4078d8063..88e371b8b 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 @@ -62,7 +62,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer { } public boolean renderTree(XhtmlNode x, ResourceWrapper qr) throws UnsupportedEncodingException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree="+qr.getId(), false); model.setAlternating(true); if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) { @@ -89,7 +89,7 @@ public class QuestionnaireResponseRenderer extends ResourceRenderer { } public boolean renderTree(XhtmlNode x, QuestionnaireResponse q) throws UnsupportedEncodingException, IOException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("qtree="+q.getId(), true); model.setAlternating(true); if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/Renderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/Renderer.java index b555b6867..51ee0ad6b 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/Renderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/Renderer.java @@ -1,13 +1,15 @@ package org.hl7.fhir.r5.renderers; +import java.util.Date; + import org.hl7.fhir.r5.comparison.VersionComparisonAnnotation; import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.model.Base; +import org.hl7.fhir.r5.model.Enumeration; import org.hl7.fhir.r5.renderers.utils.RenderingContext; import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules; import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType; import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode; -import org.hl7.fhir.r5.utils.TranslatingUtilities; import org.hl7.fhir.utilities.MarkDownProcessor; import org.hl7.fhir.utilities.StandardsStatus; import org.hl7.fhir.utilities.Utilities; @@ -33,7 +35,7 @@ import org.hl7.fhir.utilities.xhtml.XhtmlNode; * @author graha * */ -public class Renderer extends TranslatingUtilities { +public class Renderer { protected RenderingContext context; @@ -46,36 +48,8 @@ public class Renderer extends TranslatingUtilities { } - protected static final String RENDER_BUNDLE_HEADER_ROOT = "RENDER_BUNDLE_HEADER_ROOT"; - protected static final String RENDER_BUNDLE_HEADER_ENTRY = "RENDER_BUNDLE_HEADER_ENTRY"; - protected static final String RENDER_BUNDLE_HEADER_ENTRY_URL = "RENDER_BUNDLE_HEADER_ENTRY_URL"; - protected static final String RENDER_BUNDLE_RESOURCE = "RENDER_BUNDLE_RESOURCE"; - protected static final String RENDER_BUNDLE_SEARCH = "RENDER_BUNDLE_SEARCH"; - protected static final String RENDER_BUNDLE_SEARCH_MODE = "RENDER_BUNDLE_SEARCH_MODE"; - protected static final String RENDER_BUNDLE_SEARCH_SCORE = "RENDER_BUNDLE_SEARCH_SCORE"; - protected static final String RENDER_BUNDLE_RESPONSE = "RENDER_BUNDLE_RESPONSE"; - protected static final String RENDER_BUNDLE_LOCATION = "RENDER_BUNDLE_LOCATION"; - protected static final String RENDER_BUNDLE_ETAG = "RENDER_BUNDLE_ETAG"; - protected static final String RENDER_BUNDLE_LAST_MOD = "RENDER_BUNDLE_LAST_MOD"; - protected static final String RENDER_BUNDLE_REQUEST = "RENDER_BUNDLE_REQUEST"; - protected static final String RENDER_BUNDLE_IF_NON_MATCH = "RENDER_BUNDLE_IF_NON_MATCH"; - protected static final String RENDER_BUNDLE_IF_MOD = "RENDER_BUNDLE_IF_MOD"; - protected static final String RENDER_BUNDLE_IF_MATCH = "RENDER_BUNDLE_IF_MATCH"; - protected static final String RENDER_BUNDLE_IF_NONE = "RENDER_BUNDLE_IF_NONE"; - protected static final String RENDER_BUNDLE_DOCUMENT_CONTENT = "RENDER_BUNDLE_DOCUMENT_CONTENT"; - protected static final String RENDER_BUNDLE_HEADER_DOC_ENTRY_URD = "RENDER_BUNDLE_HEADER_DOC_ENTRY_URD"; - protected static final String RENDER_BUNDLE_HEADER_DOC_ENTRY_U = "RENDER_BUNDLE_HEADER_DOC_ENTRY_U"; - protected static final String RENDER_BUNDLE_HEADER_DOC_ENTRY_RD = "RENDER_BUNDLE_HEADER_DOC_ENTRY_RD"; - - /** the plan here is to make this have it's own implementation of messages, rather than using the - * validator messages, for better alignment with publisher I18n strategy - * - * @param theMessage - * @param theMessageArguments - * @return - */ protected String formatMessage(String theMessage, Object... theMessageArguments) { - return context.getWorker().formatMessage(theMessage, theMessageArguments); + return context.formatMessage(theMessage, theMessageArguments); } public void genStandardsStatus(XhtmlNode td, StandardsStatus ss) { @@ -227,4 +201,20 @@ public class Renderer extends TranslatingUtilities { } } + + public String egt(@SuppressWarnings("rawtypes") Enumeration value) { + if (value == null || !value.hasPrimitiveValue()) { + return null; + } else { + return (value == null || !value.hasPrimitiveValue()) ? null : value.asStringValue(); + } + } + + public String toStr(int value) { + return Integer.toString(value); + } + + public String toStr(Date value) { + return value.toString(); + } } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java index 2f2e2419c..e6030d871 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ResourceRenderer.java @@ -525,7 +525,7 @@ public abstract class ResourceRenderer extends DataRenderer { protected void generateCopyright(XhtmlNode x, CanonicalResource cs) { XhtmlNode p = x.para(); - p.b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Copyright Statement:", context.getLang())); + p.b().tx(getContext().formatMessage(RenderingContext.RENDER_RESOURCE_COPYRIGHT)); smartAddText(p, " " + cs.getCopyright()); } 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 76b90df45..64104e043 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 @@ -509,8 +509,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer { } public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, imageFolder, inlineGraphics, true); TableModel model = gen.initGridTable(corePath, profile.getId()); List list = profile.getSnapshot().getElement(); List profiles = new ArrayList(); @@ -549,8 +548,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer { public XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath, boolean logicalModel, boolean allInvariants, Set outputTracker, boolean mustSupport, RenderingContext rc, String anchorPrefix) throws IOException, FHIRException { assert(diff != snapshot);// check it's ok to get rid of one of these - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, imageFolder, inlineGraphics, true); List list; if (diff) @@ -1767,13 +1765,13 @@ public class StructureDefinitionRenderer extends ResourceRenderer { if (e.hasContentReference()) { ElementInStructure ed = getElementByName(profile.getSnapshot().getElement(), e.getContentReference(), profile); if (ed == null) - c.getPieces().add(gen.new Piece(null, translate("sd.table", "Unknown reference to %s", e.getContentReference()), null)); + c.getPieces().add(gen.new Piece(null, "Unknown reference to "+ e.getContentReference(), null)); else { if (ed.getSource() == profile) { - c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getElement().getPath()), null)); + c.getPieces().add(gen.new Piece(null, "See ", null)); c.getPieces().add(gen.new Piece("#"+ed.getElement().getPath(), tail(ed.getElement().getPath()), ed.getElement().getPath())); } else { - c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getElement().getPath()), null)); + c.getPieces().add(gen.new Piece(null, "See ", null)); c.getPieces().add(gen.new Piece(pfx(corePath, ed.getSource().getWebPath())+"#"+ed.getElement().getPath(), tail(ed.getElement().getPath())+" ("+ed.getSource().getTypeName()+")", ed.getElement().getPath())); } } @@ -2741,7 +2739,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer { } private String describeSlice(ElementDefinitionSlicingComponent slicing) { - return translate("sd.table", "%s, %s by %s", slicing.getOrdered() ? translate("sd.table", "Ordered") : translate("sd.table", "Unordered"), describe(slicing.getRules()), commas(slicing.getDiscriminator())); + return formatMessage("%s, %s by %s", slicing.getOrdered() ? translate("sd.table", "Ordered") : translate("sd.table", "Unordered"), describe(slicing.getRules()), commas(slicing.getDiscriminator())); } @@ -2928,8 +2926,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer { public XhtmlNode generateSpanningTable(StructureDefinition profile, String imageFolder, boolean onlyConstraints, String constraintPrefix, Set outputTracker) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, false, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, imageFolder, false, true); TableModel model = initSpanningTable(gen, "", false, profile.getId()); Set processed = new HashSet(); SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix); @@ -3033,8 +3030,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer { } public XhtmlNode generateExtensionTable(String defFile, StructureDefinition ed, String imageFolder, boolean inlineGraphics, boolean full, String corePath, String imagePath, Set outputTracker, RenderingContext rc) throws IOException, FHIRException { - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(imageFolder, inlineGraphics, true); - gen.setTranslator(getTranslator()); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, imageFolder, inlineGraphics, true); TableModel model = gen.initNormalTable(corePath, false, true, ed.getId()+(full ? "f" : "n"), true, TableGenerationMode.XHTML); boolean deep = false; diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/TerminologyRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/TerminologyRenderer.java index a1102871e..8a6b700b9 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/TerminologyRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/TerminologyRenderer.java @@ -211,21 +211,21 @@ public abstract class TerminologyRenderer extends ResourceRenderer { if (hasHierarchy) { tr.td().b().tx("Lvl"); } - tr.td().attribute("style", "white-space:nowrap").b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Code", getContext().getLang())); + tr.td().attribute("style", "white-space:nowrap").b().tx(formatMessage(RenderingContext.RENDER_TX_CODE)); if (hasDisplay) { - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Display", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_TX_DISPLAY)); } if (definitions) { - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Definition", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_TX_DEFINITION)); } if (deprecated) { - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Deprecated", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_TX_DEPRECATED)); } if (comments) { - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Comments", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_TX_COMMENTS)); } if (version) { - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", "Version", getContext().getLang())); + tr.td().b().tx(formatMessage(RenderingContext.RENDER_TX_VERSION)); } if (properties != null) { for (PropertyComponent pc : properties) { @@ -236,7 +236,7 @@ public abstract class TerminologyRenderer extends ResourceRenderer { display = pc.getCode(); } } - tr.td().b().tx(getContext().getWorker().translator().translate("xhtml-gen-cs", display, getContext().getLang())); + tr.td().b().tx(display); } } if (doDesignations) { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java index 84e78d7a6..83b5a6886 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/renderers/ValueSetRenderer.java @@ -1030,7 +1030,7 @@ public class ValueSetRenderer extends TerminologyRenderer { } x.br(); x.tx(s); - HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true); + HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context, context.getDestDir(), context.isInlineGraphics(), true); TableModel model = gen.new TableModel("exp.h="+index, context.getRules() == GenerationRules.IG_PUBLISHER); model.setAlternating(true); model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("vs.exp.header", "Code"), translate("vs.exp.hint", "The code for the item"), null, 0)); 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 71d518714..2a465c95a 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 @@ -24,9 +24,10 @@ import org.hl7.fhir.utilities.MarkDownProcessor; import org.hl7.fhir.utilities.MarkDownProcessor.Dialect; import org.hl7.fhir.utilities.StandardsStatus; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; import org.hl7.fhir.utilities.validation.ValidationOptions; -public class RenderingContext { +public class RenderingContext extends RenderingI18nContext { // provides liquid templates, if they are available for the content public interface ILiquidTemplateProvider { @@ -538,9 +539,8 @@ public class RenderingContext { } } - public RenderingContext setLocale(Locale locale) { + public void setLocale(Locale locale) { this.locale = locale; - return this; } diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TranslatingUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TranslatingUtilities.java deleted file mode 100644 index 093862a20..000000000 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/TranslatingUtilities.java +++ /dev/null @@ -1,62 +0,0 @@ -package org.hl7.fhir.r5.utils; - -/* - Copyright (c) 2011+, HL7, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of HL7 nor the names of its contributors may be used to - endorse or promote products derived from this software without specific - prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - - */ - - - - -import org.hl7.fhir.r5.model.Enumeration; -import org.hl7.fhir.r5.model.PrimitiveType; - -public class TranslatingUtilities extends org.hl7.fhir.utilities.TranslatingUtilities { - - public interface TranslationServices extends org.hl7.fhir.utilities.TranslationServices { - String gt(@SuppressWarnings("rawtypes") PrimitiveType value); - String egt(@SuppressWarnings("rawtypes") Enumeration value); - } - - public String gt(@SuppressWarnings("rawtypes") PrimitiveType value) { - if (value == null || !value.hasPrimitiveValue()) { - return null; - } else { - return hasTranslator() ? ((TranslationServices) getTranslator()).gt(value) : value.asStringValue(); - } - } - - public String egt(@SuppressWarnings("rawtypes") Enumeration value) { - if (value == null || !value.hasPrimitiveValue()) { - return null; - } else { - return (value == null || !value.hasPrimitiveValue()) ? null : hasTranslator() ? ((TranslationServices) getTranslator()).egt(value) : value.asStringValue(); - } - } - - -} \ No newline at end of file diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nBase.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nBase.java index 246ea1f91..592723666 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nBase.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/I18nBase.java @@ -21,7 +21,7 @@ public abstract class I18nBase { public static final String PLURAL_SUFFIX = "PLURAL"; public static final String KEY_DELIMITER = "_"; private Locale locale; - private ResourceBundle i18nMessages; + private ResourceBundle messages; private PluralRules pluralRules; private boolean warnAboutMissingMessages = true; @@ -42,7 +42,7 @@ public abstract class I18nBase { * Verifies if a {@link ResourceBundle} has been loaded for the current {@link Locale}. If not, it triggers a load. */ private void checkResourceBundleIsLoaded() { - if (i18nMessages == null) { + if (messages == null) { setValidationMessageLanguage(getLocale()); } } @@ -74,7 +74,7 @@ public abstract class I18nBase { } protected boolean messageKeyExistsForLocale(String message) { - return i18nMessages.containsKey(message); + return messages.containsKey(message); } @@ -113,9 +113,9 @@ public abstract class I18nBase { String message = theMessage; if (messageExistsForLocale(theMessage, (theMessageArguments != null && theMessageArguments.length > 0))) { if (Objects.nonNull(theMessageArguments) && theMessageArguments.length > 0) { - message = MessageFormat.format(i18nMessages.getString(theMessage).trim(), theMessageArguments); + message = MessageFormat.format(messages.getString(theMessage).trim(), theMessageArguments); } else { - message = i18nMessages.getString(theMessage).trim(); + message = messages.getString(theMessage).trim(); } } return message; @@ -152,7 +152,11 @@ public abstract class I18nBase { * @param locale {@link Locale} to load resources for. */ public void setValidationMessageLanguage(Locale locale) { - i18nMessages = ResourceBundle.getBundle("Messages", locale); + messages = ResourceBundle.getBundle(getMessagesSourceFileName(), locale); + } + + protected String getMessagesSourceFileName() { + return "Messages"; } public void setPluralRules(Locale locale) { diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java new file mode 100644 index 000000000..c98a7cb75 --- /dev/null +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/i18n/RenderingI18nContext.java @@ -0,0 +1,99 @@ +package org.hl7.fhir.utilities.i18n; + +public class RenderingI18nContext extends I18nBase { + + public static final String RENDER_BUNDLE_HEADER_ROOT = "RENDER_BUNDLE_HEADER_ROOT"; + public static final String RENDER_BUNDLE_HEADER_ENTRY = "RENDER_BUNDLE_HEADER_ENTRY"; + public static final String RENDER_BUNDLE_HEADER_ENTRY_URL = "RENDER_BUNDLE_HEADER_ENTRY_URL"; + public static final String RENDER_BUNDLE_RESOURCE = "RENDER_BUNDLE_RESOURCE"; + public static final String RENDER_BUNDLE_SEARCH = "RENDER_BUNDLE_SEARCH"; + public static final String RENDER_BUNDLE_SEARCH_MODE = "RENDER_BUNDLE_SEARCH_MODE"; + public static final String RENDER_BUNDLE_SEARCH_SCORE = "RENDER_BUNDLE_SEARCH_SCORE"; + public static final String RENDER_BUNDLE_RESPONSE = "RENDER_BUNDLE_RESPONSE"; + public static final String RENDER_BUNDLE_LOCATION = "RENDER_BUNDLE_LOCATION"; + public static final String RENDER_BUNDLE_ETAG = "RENDER_BUNDLE_ETAG"; + public static final String RENDER_BUNDLE_LAST_MOD = "RENDER_BUNDLE_LAST_MOD"; + public static final String RENDER_BUNDLE_REQUEST = "RENDER_BUNDLE_REQUEST"; + public static final String RENDER_BUNDLE_IF_NON_MATCH = "RENDER_BUNDLE_IF_NON_MATCH"; + public static final String RENDER_BUNDLE_IF_MOD = "RENDER_BUNDLE_IF_MOD"; + public static final String RENDER_BUNDLE_IF_MATCH = "RENDER_BUNDLE_IF_MATCH"; + public static final String RENDER_BUNDLE_IF_NONE = "RENDER_BUNDLE_IF_NONE"; + public static final String RENDER_BUNDLE_DOCUMENT_CONTENT = "RENDER_BUNDLE_DOCUMENT_CONTENT"; + public static final String RENDER_BUNDLE_HEADER_DOC_ENTRY_URD = "RENDER_BUNDLE_HEADER_DOC_ENTRY_URD"; + public static final String RENDER_BUNDLE_HEADER_DOC_ENTRY_U = "RENDER_BUNDLE_HEADER_DOC_ENTRY_U"; + public static final String RENDER_BUNDLE_HEADER_DOC_ENTRY_RD = "RENDER_BUNDLE_HEADER_DOC_ENTRY_RD"; + + public static final String SD_HEAD_NAME = "SD_HEAD_NAME"; + public static final String SD_HEAD_NAME_DESC = "SD_HEAD_NAME_DESC"; + public static final String SD_HEAD_FLAGS = "SD_HEAD_FLAGS"; + public static final String SD_HEAD_FLAGS_DESC = "SD_HEAD_FLAGS_DESC"; + public static final String SD_HEAD_CARD = "SD_HEAD_CARD"; + public static final String SD_HEAD_CARD_DESC = "SD_HEAD_CARD_DESC"; + public static final String SD_HEAD_TYPE = "SD_HEAD_TYPE"; + public static final String SD_HEAD_TYPE_DESC = "SD_HEAD_TYPE_DESC"; + public static final String SD_HEAD_DESC = "SD_HEAD_DESC"; + public static final String SD_HEAD_DESC_DESC = "SD_HEAD_DESC_DESC"; + + public static final String SD_COMP_HEAD_NAME = "SD_COMP_HEAD_NAME"; + public static final String SD_COMP_HEAD_NAME_DESC = "SD_COMP_HEAD_NAME_DESC"; + public static final String SD_COMP_HEAD_FLAGS_L = "SD_COMP_HEAD_FLAGS_L"; + public static final String SD_COMP_HEAD_FLAGS_L_DESC ="SD_COMP_HEAD_FLAGS_L_DESC"; + public static final String SD_COMP_HEAD_CARD_L = "SD_COMP_HEAD_CARD_L"; + public static final String SD_COMP_HEAD_CARD_L_DESC ="SD_COMP_HEAD_CARD_L_DESC"; + public static final String SD_COMP_HEAD_TYPE_L = "SD_COMP_HEAD_TYPE_L"; + public static final String SD_COMP_HEAD_TYPE_L_DESC ="SD_COMP_HEAD_TYPE_L_DESC"; + public static final String SD_COMP_HEAD_DESC_L = "SD_COMP_HEAD_DESC_L"; + public static final String SD_COMP_HEAD_DESC_L_DESC ="SD_COMP_HEAD_DESC_L_DESC"; + public static final String SD_COMP_HEAD_FLAGS_R = "SD_COMP_HEAD_FLAGS_R"; + public static final String SD_COMP_HEAD_FLAGS_R_DESC ="SD_COMP_HEAD_FLAGS_R_DESC"; + public static final String SD_COMP_HEAD_CARD_R = "SD_COMP_HEAD_CARD_R"; + public static final String SD_COMP_HEAD_CARD_R_DESC ="SD_COMP_HEAD_CARD_R_DESC"; + public static final String SD_COMP_HEAD_TYPE_R = "SD_COMP_HEAD_TYPE_R"; + public static final String SD_COMP_HEAD_TYPE_R_DESC ="SD_COMP_HEAD_TYPE_R_DESC"; + public static final String SD_COMP_HEAD_DESC_R = "SD_COMP_HEAD_DESC_R"; + public static final String SD_COMP_HEAD_DESC_R_DESC ="SD_COMP_HEAD_DESC_R_DESC"; + public static final String SD_COMP_HEAD_COMP = "SD_COMP_HEAD_COMP"; + public static final String SD_COMP_HEAD_COMP_DESC = "SD_COMP_HEAD_COMP_DESC"; + + public static final String SD_GRID_HEAD_NAME = "SD_GRID_HEAD_NAME"; + public static final String SD_GRID_HEAD_NAME_DESC = "SD_GRID_HEAD_NAME_DESC"; + public static final String SD_GRID_HEAD_CARD = "SD_GRID_HEAD_CARD"; + public static final String SD_GRID_HEAD_CARD_DESC = "SD_GRID_HEAD_CARD_DESC"; + public static final String SD_GRID_HEAD_TYPE = "SD_GRID_HEAD_TYPE"; + public static final String SD_GRID_HEAD_TYPE_DESC = "SD_GRID_HEAD_TYPE_DESC"; + public static final String SD_GRID_HEAD_DESC = "SD_GRID_HEAD_DESC"; + public static final String SD_GRID_HEAD_DESC_DESC = "SD_GRID_HEAD_DESC_DESC"; + + public static final String SD_LEGEND = "SD_LEGEND"; + public static final String SD_DOCO = "SD_DOCO"; + + public static final String RENDER_RESOURCE_COPYRIGHT = "RENDER_RESOURCE_COPYRIGHT"; + + public static final String RENDER_CODESYSTEM_FILTERS = "RENDER_CODESYSTEM_FILTERS"; + public static final String RENDER_CODESYSTEM_FILTER_CODE = "RENDER_CODESYSTEM_FILTER_CODE"; + public static final String RENDER_CODESYSTEM_FILTER_DESC = "RENDER_CODESYSTEM_FILTER_DESC"; + public static final String RENDER_CODESYSTEM_FILTER_OP = "RENDER_CODESYSTEM_FILTER_OP"; + public static final String RENDER_CODESYSTEM_FILTER_VALUE = "RENDER_CODESYSTEM_FILTER_VALUE"; + + public static final String RENDER_CODESYSTEM_PROPS = "RENDER_CODESYSTEM_PROPS"; + public static final String RENDER_CODESYSTEM_PROPS_DESC = "RENDER_CODESYSTEM_PROPS_DESC"; + public static final String RENDER_CODESYSTEM_PROP_NAME = "RENDER_CODESYSTEM_PROP_NAME"; + public static final String RENDER_CODESYSTEM_PROP_CODE = "RENDER_CODESYSTEM_PROP_CODE"; + public static final String RENDER_CODESYSTEM_PROP_URI = "RENDER_CODESYSTEM_PROP_CODE"; + public static final String RENDER_CODESYSTEM_PROP_TYPE = "RENDER_CODESYSTEM_PROP_CODE"; + public static final String RENDER_CODESYSTEM_PROP_DESC = "RENDER_CODESYSTEM_PROP_DESC"; + public static final String RENDER_CODESYSTEM_CONCEPTS = "RENDER_CODESYSTEM_CONCEPTS"; + public static final String RENDER_CODESYSTEM_DEPRECATED = "RENDER_CODESYSTEM_DEPRECATED"; + + + public static final String RENDER_TX_CODE = "RENDER_TX_CODE"; + public static final String RENDER_TX_DISPLAY = "RENDER_TX_DISPLAY"; + public static final String RENDER_TX_DEFINITION = "RENDER_TX_DEFINITION"; + public static final String RENDER_TX_DEPRECATED = "RENDER_TX_DEPRECATED"; + public static final String RENDER_TX_COMMENTS = "RENDER_TX_COMMENTS"; + public static final String RENDER_TX_VERSION = "RENDER_TX_VERSION"; + + protected String getMessagesSourceFileName() { + return "rendering-phrases"; + } +} diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java index f098002cf..0bced86fb 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/HierarchicalTableGenerator.java @@ -85,11 +85,11 @@ import org.commonmark.renderer.html.HtmlRenderer; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; import org.hl7.fhir.utilities.TextFile; -import org.hl7.fhir.utilities.TranslatingUtilities; import org.hl7.fhir.utilities.Utilities; +import org.hl7.fhir.utilities.i18n.RenderingI18nContext; -public class HierarchicalTableGenerator extends TranslatingUtilities { +public class HierarchicalTableGenerator { public enum TableGenerationMode { XML, XHTML } @@ -626,13 +626,16 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { private boolean inLineGraphics; private TableGenerationMode mode; + private RenderingI18nContext i18n; - public HierarchicalTableGenerator() { + public HierarchicalTableGenerator(RenderingI18nContext i18n) { super(); + this.i18n = i18n; } - public HierarchicalTableGenerator(String dest, boolean inlineGraphics) { + public HierarchicalTableGenerator(RenderingI18nContext i18n, String dest, boolean inlineGraphics) { super(); + this.i18n = i18n; this.dest = dest; this.inLineGraphics = inlineGraphics; this.makeTargets = true; @@ -646,8 +649,9 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { } - public HierarchicalTableGenerator(String dest, boolean inlineGraphics, boolean makeTargets) { + public HierarchicalTableGenerator(RenderingI18nContext i18n, String dest, boolean inlineGraphics, boolean makeTargets) { super(); + this.i18n = i18n; this.dest = dest; this.inLineGraphics = inlineGraphics; this.makeTargets = makeTargets; @@ -666,11 +670,11 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { model.setDocoImg(Utilities.pathURL(prefix, "help16.png")); } model.setDocoRef(Utilities.pathURL("https://build.fhir.org/ig/FHIR/ig-guidance", "readingIgs.html#table-views")); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Flags"), translate("sd.hint", "Information about the use of the element"), null, 0)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Card."), translate("sd.hint", "Minimum and Maximum # of times the the element can appear in the instance"), null, 0)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Type"), translate("sd.hint", "Reference to the type of the element"), null, 100)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Description & Constraints"), translate("sd.hint", "Additional information about the element"), null, 0)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_HEAD_NAME), i18n.formatMessage(RenderingI18nContext.SD_HEAD_NAME_DESC), null, 0)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_HEAD_FLAGS), i18n.formatMessage(RenderingI18nContext.SD_HEAD_FLAGS_DESC), null, 0)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_HEAD_CARD), i18n.formatMessage(RenderingI18nContext.SD_HEAD_CARD_DESC), null, 0)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_HEAD_TYPE), i18n.formatMessage(RenderingI18nContext.SD_HEAD_TYPE_DESC), null, 100)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_HEAD_DESC), i18n.formatMessage(RenderingI18nContext.SD_HEAD_DESC_DESC), null, 0)); if (isLogical) { model.getTitles().add(new Title(null, prefix+"structuredefinition.html#logical", "Implemented As", "How this logical data item is implemented in a concrete resource", null, 0)); } @@ -687,16 +691,16 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { model.setDocoImg(Utilities.pathURL(prefix, "help16.png")); } model.setDocoRef(Utilities.pathURL(prefix, "formats.html#table")); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The logical name of the element"), null, 0)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "L Flags"), translate("sd.hint", "Information about the use of the element - Left Structure"), null, 0).setStyle("border-left: 1px grey solid")); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "L Card."), translate("sd.hint", "Minimum and Maximum # of times the the element can appear in the instance - Left Structure"), null, 0)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "L Type"), translate("sd.hint", "Reference to the type of the element - Left Structure"), null, 100)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "L Description & Constraints"), translate("sd.hint", "Additional information about the element - Left Structure"), null, 0).setStyle("border-right: 1px grey solid")); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "R Flags"), translate("sd.hint", "Information about the use of the element - Left Structure"), null, 0).setStyle("border-left: 1px grey solid")); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "R Card."), translate("sd.hint", "Minimum and Maximum # of times the the element can appear in the instance - Left Structure"), null, 0)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "L Type"), translate("sd.hint", "Reference to the type of the element - Left Structure"), null, 100)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "L Description & Constraints"), translate("sd.hint", "Additional information about the element - Left Structure"), null, 0).setStyle("border-right: 1px grey solid")); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Comments"), translate("sd.hint", "Comments about the comparison"), null, 0)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_NAME), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_NAME_DESC), null, 0)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_FLAGS_L), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_FLAGS_L_DESC), null, 0).setStyle("border-left: 1px grey solid")); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_CARD_L), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_CARD_L_DESC), null, 0)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_TYPE_L), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_TYPE_L_DESC), null, 100)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_DESC_L), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_DESC_L_DESC), null, 0).setStyle("border-right: 1px grey solid")); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_FLAGS_R), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_FLAGS_R_DESC), null, 0).setStyle("border-left: 1px grey solid")); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_CARD_R), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_CARD_R_DESC), null, 0)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_TYPE_R), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_TYPE_R_DESC), null, 100)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_DESC_R), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_DESC_R_DESC), null, 0).setStyle("border-right: 1px grey solid")); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_COMP), i18n.formatMessage(RenderingI18nContext.SD_COMP_HEAD_COMP_DESC), null, 0)); return model; } @@ -704,11 +708,11 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { public TableModel initGridTable(String prefix, String id) { TableModel model = new TableModel(id, false); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_GRID_HEAD_NAME), i18n.formatMessage(RenderingI18nContext.SD_GRID_HEAD_NAME_DESC), null, 0)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_GRID_HEAD_CARD), i18n.formatMessage(RenderingI18nContext.SD_GRID_HEAD_CARD_DESC), null, 0)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_GRID_HEAD_TYPE), i18n.formatMessage(RenderingI18nContext.SD_GRID_HEAD_TYPE_DESC), null, 100)); + model.getTitles().add(new Title(null, model.getDocoRef(), i18n.formatMessage(RenderingI18nContext.SD_GRID_HEAD_DESC), i18n.formatMessage(RenderingI18nContext.SD_GRID_HEAD_DESC_DESC), null, 0)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Name"), translate("sd.hint", "The name of the element (Slice name in brackets). Mouse-over provides definition"), null, 0)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Card."), translate("sd.hint", "Minimum and Maximum # of times the the element can appear in the instance. Super-scripts indicate additional constraints on appearance"), null, 0)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Type"), translate("sd.hint", "Reference to the type of the element"), null, 100)); - model.getTitles().add(new Title(null, model.getDocoRef(), translate("sd.head", "Constraints and Usage"), translate("sd.hint", "Fixed values, length limits, vocabulary bindings and other usage notes"), null, 0)); return model; } @@ -750,10 +754,10 @@ public class HierarchicalTableGenerator extends TranslatingUtilities { tc.setAttribute("class", "hierarchy"); tc.setAttribute("colspan", Integer.toString(model.getTitles().size())); tc.addTag("br"); - XhtmlNode a = tc.addTag("a").setAttribute("title", translate("sd.doco", "Legend for this format")).setAttribute("href", model.getDocoRef()); + XhtmlNode a = tc.addTag("a").setAttribute("title", i18n.formatMessage(RenderingI18nContext.SD_LEGEND)).setAttribute("href", model.getDocoRef()); if (model.getDocoImg() != null) a.addTag("img").setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg()); - a.addText(" "+translate("sd.doco", "Documentation for this format")); + a.addText(" "+i18n.formatMessage(RenderingI18nContext.SD_DOCO)); } return table; } diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java index 95c855cb8..4363eb7bd 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/xhtml/XhtmlNode.java @@ -1043,4 +1043,51 @@ public class XhtmlNode extends XhtmlFluent implements IBaseXhtml { } + + public int compareTo(XhtmlNode other) { + return compare(this, other); + } + + private static int compare(XhtmlNode base, XhtmlNode other) { + if (base == null || other == null) { + return 0; + } else if (base.getNodeType() != other.getNodeType()) { + return base.getNodeType().ordinal() - other.getNodeType().ordinal(); + } else switch (base.getNodeType()) { + case Comment: return base.getContent().compareTo(other.getContent()); + case DocType: return 0; + case Element: + int r = base.getName().compareTo(other.getName()); + if (r != 0) { + return r; + } + case Document: + if (base.getAttributes().size() != other.getAttributes().size()) { + return base.getAttributes().size() - other.getAttributes().size(); + } else { + for (String n : base.getAttributes().keySet()) { + String vb = base.getAttributes().get(n); + String vo = other.getAttributes().get(n); + r = vo == null ? -1 : vb.compareTo(vo); + if (r != 0) { + return r; + } + } + } + if (base.getChildNodes().size() != other.getChildNodes().size()) { + return base.getChildNodes().size() - other.getChildNodes().size(); + } else { + for (int i = 0; i < base.getChildNodes().size(); i++) { + r = compare(base, other); + if (r != 0) { + return r; + } + } + } + return 0; + case Instruction: return 0; + case Text: return base.getContent().compareTo(other.getContent()); + default: return 0; + } + } } \ 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 0c500336f..b2d3b9bc0 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages.properties @@ -663,22 +663,6 @@ 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} -RENDER_BUNDLE_HEADER_ROOT = Bundle {0} of type {1} -RENDER_BUNDLE_HEADER_ENTRY = Entry {0} -RENDER_BUNDLE_HEADER_ENTRY_URL = Entry {0} - fullUrl = {1} -RENDER_BUNDLE_RESOURCE = Resource {0}: -RENDER_BUNDLE_SEARCH = Search: -RENDER_BUNDLE_SEARCH_MODE = Mode = {0} -RENDER_BUNDLE_SEARCH_SCORE = Score = {0} -RENDER_BUNDLE_RESPONSE = Response: -RENDER_BUNDLE_LOCATION = Location = {0} -RENDER_BUNDLE_ETAG = ETag = {0} -RENDER_BUNDLE_LAST_MOD = LastModified = {0} -RENDER_BUNDLE_REQUEST = Request: -RENDER_BUNDLE_IF_NON_MATCH = If-None-Match = {0} -RENDER_BUNDLE_IF_MOD = If-Modified-Since = {0} -RENDER_BUNDLE_IF_MATCH = If-Match = {0} -RENDER_BUNDLE_IF_NONE = If-None-Exist = {0} BUNDLE_RULE_NONE = No Rule BUNDLE_RULE_UNKNOWN = Bundle Rule refers to invalid resource {0} BUNDLE_RULE_INVALID_INDEX = Bundle Rules index is invalid ({0}) @@ -961,11 +945,6 @@ SD_OBGLIGATION_INHERITS_PROFILE_NO_TARGET = Unable to read a value from this ext SD_OBGLIGATION_INHERITS_PROFILE_TARGET_NOT_FOUND = The profile ''{0}'' could not be found SD_OBGLIGATION_INHERITS_PROFILE_NOT_RIGHT_TYPE = The profile ''{0}'' is not marked as an obligation profile SD_OBGLIGATION_INHERITS_PROFILE_NOT_RIGHT_BASE = The profile ''{0}'' has a different base ''{1}'' from that expected ''{2}'' -RND_CS_CONTENT_COMPLETE = This code system defines the following codes: -RND_CS_CONTENT_EXAMPLE = This code system provides some codes that are example only: -RND_CS_CONTENT_FRAGMENT = This code system provides a fragment that includes following codes: -RND_CS_CONTENT_NOTPRESENT = This code system defines codes, but no codes are represented here -RND_CS_CONTENT_SUPPLEMENT = This code system defines {0} on the following codes: QUESTIONNAIRE_Q_UNKNOWN_DERIVATION = The questionnaire ''{0}'' referred to in the derivation could not be found QUESTIONNAIRE_Q_NO_DERIVATION_TYPE = The questionnaire ''{0}'' has no derivation type specified using the ''http://hl7.org/fhir/StructureDefinition/questionnaire-derivationType'' extension, so derivation has not been checked QUESTIONNAIRE_Q_NO_DERIVATION_TYPE_VALUE = The derivation extension has no value 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 8e07ca70b..48e455e0a 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages_de.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages_de.properties @@ -702,22 +702,6 @@ SD_MUST_HAVE_DERIVATION=StructureDefinition {0} muss eine Ableitung haben, da si VALIDATION_VAL_PROFILE_OTHER_VERSION=Profil ist f\u00fcr eine andere Version von FHIR ({0}) und wurde daher ignoriert VALIDATION_VAL_PROFILE_THIS_VERSION_OK=Profil f\u00fcr diese Version von FHIR - alles OK VALIDATION_VAL_PROFILE_THIS_VERSION_OTHER=Profil ist f\u00fcr diese Version von FHIR, aber ist ein ung\u00fcltiger Typ {0} -RENDER_BUNDLE_HEADER_ROOT=Bundle {0} vom Typ {1} -RENDER_BUNDLE_HEADER_ENTRY=Entry {0} -RENDER_BUNDLE_HEADER_ENTRY_URL=Entry {0} - fullUrl = {1} -RENDER_BUNDLE_RESOURCE=Ressource {0}: -RENDER_BUNDLE_SEARCH=Suche: -RENDER_BUNDLE_SEARCH_MODE=Mode = {0} -RENDER_BUNDLE_SEARCH_SCORE=Score = {0} -RENDER_BUNDLE_RESPONSE=Response: -RENDER_BUNDLE_LOCATION=Location = {0} -RENDER_BUNDLE_ETAG=ETag = {0} -RENDER_BUNDLE_LAST_MOD=LastModified = {0} -RENDER_BUNDLE_REQUEST=Request: -RENDER_BUNDLE_IF_NON_MATCH=If-None-Match = {0} -RENDER_BUNDLE_IF_MOD=If-Modified-Since = {0} -RENDER_BUNDLE_IF_MATCH=If-Match = {0} -RENDER_BUNDLE_IF_NONE=If-None-Exist = {0} BUNDLE_RULE_NONE=Keine Regel BUNDLE_RULE_UNKNOWN=Bundle Rule verweist auf ung\u00fcltige Ressource {0} BUNDLE_RULE_INVALID_INDEX=Bundle Rules Index ist ung\u00fcltig ({0}) diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages_es.properties b/org.hl7.fhir.utilities/src/main/resources/Messages_es.properties index a38e01313..46caaeb83 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages_es.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages_es.properties @@ -654,22 +654,6 @@ SD_MUST_HAVE_DERIVATION = El recurso StructureDefinition {0} debe tener una deri VALIDATION_VAL_PROFILE_OTHER_VERSION = El perfil es para una versión diferente de FHIR ({0}) así que fue ignorado VALIDATION_VAL_PROFILE_THIS_VERSION_OK = El perfil es para esta versión de FHIR- Todo OK VALIDATION_VAL_PROFILE_THIS_VERSION_OTHER = El perfil es para esta versión de FHIR, pero es de tipo inválido {0} -RENDER_BUNDLE_HEADER_ROOT = Bundle {0} De tipo {1} -RENDER_BUNDLE_HEADER_ENTRY = Entry {0} -RENDER_BUNDLE_HEADER_ENTRY_URL = Entry {0} - FullURL = {1} -RENDER_BUNDLE_RESOURCE = Recurso {0}: -RENDER_BUNDLE_SEARCH = Búsqueda: -RENDER_BUNDLE_SEARCH_MODE = mode = {0} -RENDER_BUNDLE_SEARCH_SCORE = score = {0} -RENDER_BUNDLE_RESPONSE = Respuesta: -RENDER_BUNDLE_LOCATION = Location = {0} -RENDER_BUNDLE_ETAG = ETag = {0} -RENDER_BUNDLE_LAST_MOD = LastModified = {0} -RENDER_BUNDLE_REQUEST = Request: -RENDER_BUNDLE_IF_NON_MATCH = If-None-Match = {0} -RENDER_BUNDLE_IF_MOD = If-Modified-Since = {0} -RENDER_BUNDLE_IF_MATCH = If-Match = {0} -RENDER_BUNDLE_IF_NONE = If-None-Exist = {0} BUNDLE_RULE_NONE = Sin reglas BUNDLE_RULE_UNKNOWN = LA regla del Bundle refiere a un recurso inválido {0} BUNDLE_RULE_INVALID_INDEX = El indice de la regla de Bundle no es válido ({0}) diff --git a/org.hl7.fhir.utilities/src/main/resources/Messages_ja.properties b/org.hl7.fhir.utilities/src/main/resources/Messages_ja.properties index d728c5483..84e4fe9b0 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages_ja.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages_ja.properties @@ -644,22 +644,6 @@ VALIDATION_VAL_PROFILE_THIS_VERSION_OK = このバージョンのFHIRのプロ VALIDATION_VAL_PROFILE_THIS_VERSION_OTHER = プロファイルはこのバージョンのFHIRのためのものですが、無効な型{0}です BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_one = BUNDLE_BUNDLE_ENTRY_MULTIPLE_PROFILES_other = {0}個のプロファイルが{1}リソースに対して見つかりました。現時点では一つ以上はサポートされていません。(タイプ{2}: {3}) -RENDER_BUNDLE_HEADER_ROOT = タイプ {1} のバンドル {0} -RENDER_BUNDLE_HEADER_ENTRY = エントリ {0} -RENDER_BUNDLE_HEADER_ENTRY_URL = エントリ {0} - fullUrl = {1} -RENDER_BUNDLE_RESOURCE = Resource {0}: -RENDER_BUNDLE_SEARCH = Search: -RENDER_BUNDLE_SEARCH_MODE = Mode = {0} -RENDER_BUNDLE_SEARCH_SCORE = Score = {0} -RENDER_BUNDLE_RESPONSE = Response: -RENDER_BUNDLE_LOCATION = Location = {0} -RENDER_BUNDLE_ETAG = ETag = {0} -RENDER_BUNDLE_LAST_MOD = LastModified = {0} -RENDER_BUNDLE_REQUEST = Request: -RENDER_BUNDLE_IF_NON_MATCH = If-None-Match = {0} -RENDER_BUNDLE_IF_MOD = If-Modified-Since = {0} -RENDER_BUNDLE_IF_MATCH = If-Match = {0} -RENDER_BUNDLE_IF_NONE = If-None-Exist = {0} BUNDLE_RULE_NONE = No Rule BUNDLE_RULE_UNKNOWN = Bundle Ruleは無効なリソース {0} を参照しています BUNDLE_RULE_INVALID_INDEX = Bundle Rulesのインデックスが無効です ({0}) @@ -936,11 +920,6 @@ SD_OBGLIGATION_INHERITS_PROFILE_NO_TARGET = このextensionから値を読み SD_OBGLIGATION_INHERITS_PROFILE_TARGET_NOT_FOUND = プロファイル ''{0}'' が見つかりませんでした SD_OBGLIGATION_INHERITS_PROFILE_NOT_RIGHT_TYPE = プロファイル ''{0}'' はobligationプロファイルとしてマークされていません SD_OBGLIGATION_INHERITS_PROFILE_NOT_RIGHT_BASE = プロファイル ''{0}'' は予期された ''{2}'' ではなく、異なるベース''{1}'' を持っています -RND_CS_CONTENT_COMPLETE = このコードシステム は次のコードたちを定義します: -RND_CS_CONTENT_EXAMPLE = このコードシステム はいくつかの例コードたちを提供します: -RND_CS_CONTENT_FRAGMENT = このコードシステム は以下のコードを含むフラグメントを提供します: -RND_CS_CONTENT_NOTPRESENT = このコードシステム はコードを定義しますが、ここではコードは表現されていません -RND_CS_CONTENT_SUPPLEMENT = このコードシステム は次のコードに {0} を定義します: QUESTIONNAIRE_Q_UNKNOWN_DERIVATION = 派生に参照されるQuestionnaire ''{0}'' が見つかりませんでした QUESTIONNAIRE_Q_NO_DERIVATION_TYPE = Questionnaire ''{0}'' は ''http://hl7.org/fhir/StructureDefinition/questionnaire-derivationType'' 拡張を使用して派生タイプが指定されていないため、派生がチェックされていません QUESTIONNAIRE_Q_NO_DERIVATION_TYPE_VALUE = 派生extensionには値がありません 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 ec0c21b30..9364b35d4 100644 --- a/org.hl7.fhir.utilities/src/main/resources/Messages_nl.properties +++ b/org.hl7.fhir.utilities/src/main/resources/Messages_nl.properties @@ -644,22 +644,6 @@ 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} -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} -RENDER_BUNDLE_RESOURCE = Resource {0}: -RENDER_BUNDLE_SEARCH = Zoeken: -RENDER_BUNDLE_SEARCH_MODE = mode = {0} -RENDER_BUNDLE_SEARCH_SCORE = score = {0} -RENDER_BUNDLE_RESPONSE = Response: -RENDER_BUNDLE_LOCATION = Location = {0} -RENDER_BUNDLE_ETAG = ETag = {0} -RENDER_BUNDLE_LAST_MOD = LastModified = {0} -RENDER_BUNDLE_REQUEST = Request: -RENDER_BUNDLE_IF_NON_MATCH = If-None-Match = {0} -RENDER_BUNDLE_IF_MOD = If-Modified-Since = {0} -RENDER_BUNDLE_IF_MATCH = If-Match = {0} -RENDER_BUNDLE_IF_NONE = If-None-Exist = {0} BUNDLE_RULE_NONE = Geen regel BUNDLE_RULE_UNKNOWN = Bundle-regel wijst naar ongeldige resource {0} BUNDLE_RULE_INVALID_INDEX = Index van Bundle-regels is ongeldig ({0}) diff --git a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties new file mode 100644 index 000000000..4ec9760f4 --- /dev/null +++ b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases.properties @@ -0,0 +1,83 @@ +# Rendering +RENDER_BUNDLE_HEADER_ROOT = Bundle {0} of type {1} +RENDER_BUNDLE_HEADER_ENTRY = Entry {0} +RENDER_BUNDLE_HEADER_ENTRY_URL = Entry {0} - fullUrl = {1} +RENDER_BUNDLE_RESOURCE = Resource {0}: +RENDER_BUNDLE_SEARCH = Search: +RENDER_BUNDLE_SEARCH_MODE = Mode = {0} +RENDER_BUNDLE_SEARCH_SCORE = Score = {0} +RENDER_BUNDLE_RESPONSE = Response: +RENDER_BUNDLE_LOCATION = Location = {0} +RENDER_BUNDLE_ETAG = ETag = {0} +RENDER_BUNDLE_LAST_MOD = LastModified = {0} +RENDER_BUNDLE_REQUEST = Request: +RENDER_BUNDLE_IF_NON_MATCH = If-None-Match = {0} +RENDER_BUNDLE_IF_MOD = If-Modified-Since = {0} +RENDER_BUNDLE_IF_MATCH = If-Match = {0} +RENDER_BUNDLE_IF_NONE = If-None-Exist = {0} +SD_HEAD_NAME = Name +SD_HEAD_NAME_DESC = The logical name of the element +SD_HEAD_FLAGS = Flags +SD_HEAD_FLAGS_DESC = Information about the use of the element +SD_HEAD_CARD = Card. +SD_HEAD_CARD_DESC = Minimum and Maximum # of times the the element can appear in the instance +SD_HEAD_TYPE = Type +SD_HEAD_TYPE_DESC = Reference to the type of the element +SD_HEAD_DESC = Description & Constraints +SD_HEAD_DESC_DESC = Additional information about the element +SD_COMP_HEAD_NAME = Name +SD_COMP_HEAD_NAME_DESC = The logical name of the element +SD_COMP_HEAD_FLAGS_L = L Flags +SD_COMP_HEAD_FLAGS_L_DESC = Information about the use of the element - Left Structure +SD_COMP_HEAD_CARD_L = L Card. +SD_COMP_HEAD_CARD_L_DESC = Minimum and Maximum # of times the the element can appear in the instance - Left Structure +SD_COMP_HEAD_TYPE_L = L Type +SD_COMP_HEAD_TYPE_L_DESC = Reference to the type of the element - Left Structure +SD_COMP_HEAD_DESC_L = L Description & Constraints +SD_COMP_HEAD_DESC_L_DESC = Additional information about the element - Left Structure +SD_COMP_HEAD_FLAGS_R = R Flags +SD_COMP_HEAD_FLAGS_R_DESC = Information about the use of the element - Right Structure +SD_COMP_HEAD_CARD_R = R Card. +SD_COMP_HEAD_CARD_R_DESC = Minimum and Maximum # of times the the element can appear in the instance - Right Structure +SD_COMP_HEAD_TYPE_R = R Type +SD_COMP_HEAD_TYPE_R_DESC = Reference to the type of the element - Right Structure +SD_COMP_HEAD_DESC_R = R Description & Constraints +SD_COMP_HEAD_DESC_R_DESC = Additional information about the element - Right Structure +SD_COMP_HEAD_COMP = Comments +SD_COMP_HEAD_COMP_DESC = Comments about the comparison +SD_GRID_HEAD_NAME = Name +SD_GRID_HEAD_NAME_DESC = The name of the element (Slice name in brackets). Mouse-over provides definition +SD_GRID_HEAD_CARD = Card. +SD_GRID_HEAD_CARD_DESC = Minimum and Maximum # of times the the element can appear in the instance. Super-scripts indicate additional constraints on appearance +SD_GRID_HEAD_TYPE = Type +SD_GRID_HEAD_TYPE_DESC = Reference to the type of the element +SD_GRID_HEAD_DESC = Constraints and Usage +SD_GRID_HEAD_DESC_DESC = Fixed values, length limits, vocabulary bindings and other usage notes +SD_LEGEND = Legend for this format +SD_DOCO = Documentation for this format +RENDER_RESOURCE_COPYRIGHT = Copyright Statement: +RENDER_CODESYSTEM_FILTERS = Filters +RENDER_CODESYSTEM_FILTER_CODE = Code +RENDER_CODESYSTEM_FILTER_DESC = Description +RENDER_CODESYSTEM_FILTER_OP = Operator +RENDER_CODESYSTEM_FILTER_VALUE = Value +RENDER_CODESYSTEM_PROPS = Properties +RENDER_CODESYSTEM_PROPS_DESC = This code system defines the following properties for its concepts +RENDER_CODESYSTEM_PROP_NAME = Name +RENDER_CODESYSTEM_PROP_CODE = Code +RENDER_CODESYSTEM_PROP_URI = URI +RENDER_CODESYSTEM_PROP_TYPE = Type +RENDER_CODESYSTEM_PROP_DESC = Description +RND_CS_CONTENT_COMPLETE = This code system defines the following codes: +RND_CS_CONTENT_EXAMPLE = This code system provides some codes that are example only: +RND_CS_CONTENT_FRAGMENT = This code system provides a fragment that includes following codes: +RND_CS_CONTENT_NOTPRESENT = This code system defines codes, but no codes are represented here +RND_CS_CONTENT_SUPPLEMENT = This code system defines {0} on the following codes: +RENDER_CODESYSTEM_CONCEPTS = Concepts +RENDER_CODESYSTEM_DEPRECATED = Deprecated +RENDER_TX_CODE = Code +RENDER_TX_DISPLAY = Display +RENDER_TX_DEFINITION = Definition +RENDER_TX_DEPRECATED = Deprecated +RENDER_TX_COMMENTS = Comments +RENDER_TX_VERSION = Version diff --git a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_de.properties b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_de.properties new file mode 100644 index 000000000..ff1da5ec5 --- /dev/null +++ b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_de.properties @@ -0,0 +1,17 @@ +# Rendering +RENDER_BUNDLE_HEADER_ROOT=Bundle {0} vom Typ {1} +RENDER_BUNDLE_HEADER_ENTRY=Entry {0} +RENDER_BUNDLE_HEADER_ENTRY_URL=Entry {0} - fullUrl = {1} +RENDER_BUNDLE_RESOURCE=Ressource {0}: +RENDER_BUNDLE_SEARCH=Suche: +RENDER_BUNDLE_SEARCH_MODE=Mode = {0} +RENDER_BUNDLE_SEARCH_SCORE=Score = {0} +RENDER_BUNDLE_RESPONSE=Response: +RENDER_BUNDLE_LOCATION=Location = {0} +RENDER_BUNDLE_ETAG=ETag = {0} +RENDER_BUNDLE_LAST_MOD=LastModified = {0} +RENDER_BUNDLE_REQUEST=Request: +RENDER_BUNDLE_IF_NON_MATCH=If-None-Match = {0} +RENDER_BUNDLE_IF_MOD=If-Modified-Since = {0} +RENDER_BUNDLE_IF_MATCH=If-Match = {0} +RENDER_BUNDLE_IF_NONE=If-None-Exist = {0} diff --git a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_es.properties b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_es.properties new file mode 100644 index 000000000..8990e718f --- /dev/null +++ b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_es.properties @@ -0,0 +1,17 @@ +# Rendering +RENDER_BUNDLE_HEADER_ROOT = Bundle {0} De tipo {1} +RENDER_BUNDLE_HEADER_ENTRY = Entry {0} +RENDER_BUNDLE_HEADER_ENTRY_URL = Entry {0} - FullURL = {1} +RENDER_BUNDLE_RESOURCE = Recurso {0}: +RENDER_BUNDLE_SEARCH = Búsqueda: +RENDER_BUNDLE_SEARCH_MODE = mode = {0} +RENDER_BUNDLE_SEARCH_SCORE = score = {0} +RENDER_BUNDLE_RESPONSE = Respuesta: +RENDER_BUNDLE_LOCATION = Location = {0} +RENDER_BUNDLE_ETAG = ETag = {0} +RENDER_BUNDLE_LAST_MOD = LastModified = {0} +RENDER_BUNDLE_REQUEST = Request: +RENDER_BUNDLE_IF_NON_MATCH = If-None-Match = {0} +RENDER_BUNDLE_IF_MOD = If-Modified-Since = {0} +RENDER_BUNDLE_IF_MATCH = If-Match = {0} +RENDER_BUNDLE_IF_NONE = If-None-Exist = {0} diff --git a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_ja.properties b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_ja.properties new file mode 100644 index 000000000..36fd58921 --- /dev/null +++ b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_ja.properties @@ -0,0 +1,22 @@ +# Rendering +RENDER_BUNDLE_HEADER_ROOT = タイプ {1} のバンドル {0} +RENDER_BUNDLE_HEADER_ENTRY = エントリ {0} +RENDER_BUNDLE_HEADER_ENTRY_URL = エントリ {0} - fullUrl = {1} +RENDER_BUNDLE_RESOURCE = Resource {0}: +RENDER_BUNDLE_SEARCH = Search: +RENDER_BUNDLE_SEARCH_MODE = Mode = {0} +RENDER_BUNDLE_SEARCH_SCORE = Score = {0} +RENDER_BUNDLE_RESPONSE = Response: +RENDER_BUNDLE_LOCATION = Location = {0} +RENDER_BUNDLE_ETAG = ETag = {0} +RENDER_BUNDLE_LAST_MOD = LastModified = {0} +RENDER_BUNDLE_REQUEST = Request: +RENDER_BUNDLE_IF_NON_MATCH = If-None-Match = {0} +RENDER_BUNDLE_IF_MOD = If-Modified-Since = {0} +RENDER_BUNDLE_IF_MATCH = If-Match = {0} +RENDER_BUNDLE_IF_NONE = If-None-Exist = {0} +RND_CS_CONTENT_COMPLETE = このコードシステム は次のコードたちを定義します: +RND_CS_CONTENT_EXAMPLE = このコードシステム はいくつかの例コードたちを提供します: +RND_CS_CONTENT_FRAGMENT = このコードシステム は以下のコードを含むフラグメントを提供します: +RND_CS_CONTENT_NOTPRESENT = このコードシステム はコードを定義しますが、ここではコードは表現されていません +RND_CS_CONTENT_SUPPLEMENT = このコードシステム は次のコードに {0} を定義します: diff --git a/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_nl.properties b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_nl.properties new file mode 100644 index 000000000..c219a1de4 --- /dev/null +++ b/org.hl7.fhir.utilities/src/main/resources/rendering-phrases_nl.properties @@ -0,0 +1,17 @@ +# Rendering +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} +RENDER_BUNDLE_RESOURCE = Resource {0}: +RENDER_BUNDLE_SEARCH = Zoeken: +RENDER_BUNDLE_SEARCH_MODE = mode = {0} +RENDER_BUNDLE_SEARCH_SCORE = score = {0} +RENDER_BUNDLE_RESPONSE = Response: +RENDER_BUNDLE_LOCATION = Location = {0} +RENDER_BUNDLE_ETAG = ETag = {0} +RENDER_BUNDLE_LAST_MOD = LastModified = {0} +RENDER_BUNDLE_REQUEST = Request: +RENDER_BUNDLE_IF_NON_MATCH = If-None-Match = {0} +RENDER_BUNDLE_IF_MOD = If-Modified-Since = {0} +RENDER_BUNDLE_IF_MATCH = If-Match = {0} +RENDER_BUNDLE_IF_NONE = If-None-Exist = {0} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/generator/InstanceGenerator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/generator/InstanceGenerator.java new file mode 100644 index 000000000..08b273489 --- /dev/null +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/generator/InstanceGenerator.java @@ -0,0 +1,57 @@ +package org.hl7.fhir.validation.generator; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; + +import org.hl7.fhir.convertors.loaders.loaderR5.R4BToR5Loader; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.r5.context.IWorkerContext; +import org.hl7.fhir.r5.context.SimpleWorkerContext; +import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager; +import org.hl7.fhir.utilities.npm.NpmPackage; + +public class InstanceGenerator { + + public static void main(String[] args) throws FHIRException, IOException { + FilesystemPackageCacheManager pcm = new FilesystemPackageCacheManager.Builder().build(); + NpmPackage npm = pcm.loadPackage("hl7.fhir.r4.core"); + SimpleWorkerContext context = new SimpleWorkerContext.SimpleWorkerContextBuilder().withAllowLoadingDuplicates(true).fromPackage(npm); + context.loadFromPackage(pcm.loadPackage("hl7.fhir.us.core#6.0.0"), new R4BToR5Loader(null, null, null)); + var gen = new InstanceGenerator(context); + StructureDefinition sd = context.fetchResource(StructureDefinition.class, args[0]); + FhirFormat fmt = FhirFormat.valueOf(args[1].toUpperCase()); + FileOutputStream f = new FileOutputStream(args[2]); + List messages = gen.generateInstance(sd, fmt, f); + if (messages.isEmpty()) { + System.out.println("Generated OK"); + } else { + System.out.println("Generation failed:"); + for (String msg : messages) { + System.out.println(" - "+msg); + } + } + } + + private IWorkerContext context; + + protected InstanceGenerator(IWorkerContext context) { + super(); + this.context = context; + } + + /** + * main public entry point. populates the outputstream, or produces at least one error message in the output + * + */ + public List generateInstance(StructureDefinition profile, FhirFormat format, OutputStream destination) { + List res = new ArrayList<>(); + res.add("Not done yet"); + return res; + + } +} diff --git a/pom.xml b/pom.xml index d0919a164..fdca82807 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 1.26.0 32.0.1-jre 6.4.1 - 1.5.3 + 1.5.4-SNAPSHOT 2.16.0 5.9.2 1.8.2