refactor resource narrative generation rules
This commit is contained in:
parent
27e373c7b7
commit
96218a5ce4
|
@ -118,6 +118,7 @@ import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
|||
import org.hl7.fhir.r5.renderers.TerminologyRenderer;
|
||||
import org.hl7.fhir.r5.renderers.spreadsheets.SpreadsheetGenerator;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.utils.FHIRLexer;
|
||||
|
@ -4101,8 +4102,8 @@ 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<String> outputTracker, boolean active, boolean mustSupport, RenderingContext rc) throws IOException, FHIRException {
|
||||
return generateTable(defFile, profile, diff, imageFolder, inlineGraphics, profileBaseFileName, snapshot, corePath, imagePath, logicalModel, allInvariants, outputTracker, active, mustSupport, rc, "");
|
||||
boolean logicalModel, boolean allInvariants, Set<String> outputTracker, boolean mustSupport, RenderingContext rc) throws IOException, FHIRException {
|
||||
return generateTable(defFile, profile, diff, imageFolder, inlineGraphics, profileBaseFileName, snapshot, corePath, imagePath, logicalModel, allInvariants, outputTracker, mustSupport, rc, "");
|
||||
}
|
||||
|
||||
public List<ElementDefinition> supplementMissingDiffElements(StructureDefinition profile) {
|
||||
|
@ -4124,11 +4125,11 @@ 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<String> outputTracker, boolean active, boolean mustSupport, RenderingContext rc, String anchorPrefix) throws IOException, FHIRException {
|
||||
boolean logicalModel, boolean allInvariants, Set<String> 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());
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, profile.getId()+(diff ? "d" : "s"), active);
|
||||
TableModel model = gen.initNormalTable(corePath, false, true, profile.getId()+(diff ? "d" : "s"), rc.getRules() == GenerationRules.IG_PUBLISHER);
|
||||
List<ElementDefinition> list;
|
||||
if (diff)
|
||||
list = supplementMissingDiffElements(profile);
|
||||
|
|
|
@ -72,6 +72,7 @@ import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceComponent;
|
|||
import org.hl7.fhir.r5.model.ValueSet.ConceptReferenceDesignationComponent;
|
||||
import org.hl7.fhir.r5.renderers.utils.BaseWrappers.BaseWrapper;
|
||||
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.ResourceRendererMode;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
@ -521,7 +522,7 @@ public class DataRenderer extends Renderer {
|
|||
// -- 6. Data type Rendering ----------------------------------------------
|
||||
|
||||
public static String display(IWorkerContext context, DataType type) {
|
||||
return new DataRenderer(new RenderingContext(context, null, null, "http://hl7.org/fhir/R4", "", null, ResourceRendererMode.END_USER)).display(type);
|
||||
return new DataRenderer(new RenderingContext(context, null, null, "http://hl7.org/fhir/R4", "", null, ResourceRendererMode.END_USER, GenerationRules.VALID_RESOURCE)).display(type);
|
||||
}
|
||||
|
||||
public String displayBase(Base b) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.hl7.fhir.r5.model.StructureDefinition;
|
|||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.KnownLinkType;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
|
@ -67,7 +68,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
x.b().tx("Structure");
|
||||
}
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
|
||||
TableModel model = gen.new TableModel("qtree="+q.getId(), !forResource);
|
||||
TableModel model = gen.new TableModel("qtree="+q.getId(), context.getRules() == GenerationRules.IG_PUBLISHER);
|
||||
model.setAlternating(true);
|
||||
model.setDocoImg(context.getLink(KnownLinkType.SPEC) +"help16.png");
|
||||
model.setDocoRef(context.getLink(KnownLinkType.SPEC)+"formats.html#table");
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.hl7.fhir.r5.renderers;
|
|||
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
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.ResourceRendererMode;
|
||||
import org.hl7.fhir.utilities.MarkDownProcessor;
|
||||
import org.hl7.fhir.utilities.MarkDownProcessor.Dialect;
|
||||
|
@ -33,7 +34,7 @@ public class Renderer {
|
|||
}
|
||||
|
||||
public Renderer(IWorkerContext worker) {
|
||||
this.context = new RenderingContext(worker, new MarkDownProcessor(Dialect.COMMON_MARK), ValidationOptions.defaults(), "http://hl7.org/fhir/R5", "", null, ResourceRendererMode.END_USER);
|
||||
this.context = new RenderingContext(worker, new MarkDownProcessor(Dialect.COMMON_MARK), ValidationOptions.defaults(), "http://hl7.org/fhir/R5", "", null, ResourceRendererMode.END_USER, GenerationRules.IG_PUBLISHER);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
|
||||
protected ResourceContext rcontext;
|
||||
protected XVerExtensionManager xverManager;
|
||||
protected boolean forResource;
|
||||
|
||||
|
||||
public ResourceRenderer(RenderingContext context) {
|
||||
|
@ -84,14 +83,8 @@ public abstract class ResourceRenderer extends DataRenderer {
|
|||
|
||||
public void render(DomainResource r) throws IOException, FHIRException, EOperationOutcome {
|
||||
XhtmlNode x = new XhtmlNode(NodeType.Element, "div");
|
||||
boolean ofr = forResource;
|
||||
boolean hasExtensions;
|
||||
try {
|
||||
forResource = true;
|
||||
hasExtensions = render(x, r);
|
||||
} finally {
|
||||
forResource = ofr;
|
||||
}
|
||||
hasExtensions = render(x, r);
|
||||
inject(r, x, hasExtensions ? NarrativeStatus.EXTENSIONS : NarrativeStatus.GENERATED);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,8 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
public boolean render(XhtmlNode x, StructureDefinition sd) throws FHIRFormatError, DefinitionException, IOException {
|
||||
x.getChildNodes().add(context.getProfileUtilities().generateTable(context.getDefinitionsTarget(), sd, true, context.getDestDir(), false, sd.getId(), false, context.getLink(KnownLinkType.SPEC), "", sd.getKind() == StructureDefinitionKind.LOGICAL, false, null, false, false, context, ""));
|
||||
x.getChildNodes().add(context.getProfileUtilities().generateTable(context.getDefinitionsTarget(), sd, true, context.getDestDir(), false, sd.getId(), false,
|
||||
context.getLink(KnownLinkType.SPEC), "", sd.getKind() == StructureDefinitionKind.LOGICAL, false, null, false, context, ""));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionContainsComponent;
|
|||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionParameterComponent;
|
||||
import org.hl7.fhir.r5.model.ValueSet.ValueSetExpansionPropertyComponent;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||
import org.hl7.fhir.r5.renderers.utils.Resolver.ResourceContext;
|
||||
import org.hl7.fhir.r5.terminologies.CodeSystemUtilities;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpander.ValueSetExpansionOutcome;
|
||||
|
@ -956,7 +957,7 @@ public class ValueSetRenderer extends TerminologyRenderer {
|
|||
x.br();
|
||||
x.tx(s);
|
||||
HierarchicalTableGenerator gen = new HierarchicalTableGenerator(context.getDestDir(), context.isInlineGraphics(), true);
|
||||
TableModel model = gen.new TableModel("exp.h="+index, !forResource);
|
||||
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));
|
||||
model.getTitles().add(gen.new Title(null, model.getDocoRef(), translate("vs.exp.header", "Display"), translate("vs.exp.hint", "The display for the item"), null, 0));
|
||||
|
|
|
@ -65,6 +65,20 @@ public class RenderingContext {
|
|||
TECHNICAL
|
||||
}
|
||||
|
||||
public enum GenerationRules {
|
||||
/**
|
||||
* The output must be valid XHTML for a resource: no active content, etc. The only external dependency allowed is fhir.css
|
||||
*/
|
||||
VALID_RESOURCE,
|
||||
|
||||
/**
|
||||
* The output must be valid for an implementation guide according ot the base FHIR template.
|
||||
* This means active content is allowed, though the default presentation must be *show everything* for balloting purposes
|
||||
* Active content is allowed
|
||||
*/
|
||||
IG_PUBLISHER,
|
||||
}
|
||||
|
||||
public enum QuestionnaireRendererMode {
|
||||
/**
|
||||
* A visual presentation of the questionnaire, with a set of property panes that can be toggled on and off.
|
||||
|
@ -102,6 +116,7 @@ public class RenderingContext {
|
|||
private IWorkerContext worker;
|
||||
private MarkDownProcessor markdown;
|
||||
private ResourceRendererMode mode;
|
||||
private GenerationRules rules;
|
||||
private IReferenceResolver resolver;
|
||||
private ILiquidTemplateProvider templateProvider;
|
||||
private IEvaluationContext services;
|
||||
|
@ -151,7 +166,7 @@ public class RenderingContext {
|
|||
* @param specLink - path to FHIR specification
|
||||
* @param lang - langauage to render in
|
||||
*/
|
||||
public RenderingContext(IWorkerContext worker, MarkDownProcessor markdown, ValidationOptions terminologyServiceOptions, String specLink, String localPrefix, String lang, ResourceRendererMode mode) {
|
||||
public RenderingContext(IWorkerContext worker, MarkDownProcessor markdown, ValidationOptions terminologyServiceOptions, String specLink, String localPrefix, String lang, ResourceRendererMode mode, GenerationRules rules) {
|
||||
super();
|
||||
this.worker = worker;
|
||||
this.markdown = markdown;
|
||||
|
@ -159,6 +174,7 @@ public class RenderingContext {
|
|||
this.links.put(KnownLinkType.SPEC, specLink);
|
||||
this.localPrefix = localPrefix;
|
||||
this.mode = mode;
|
||||
this.rules = rules;
|
||||
if (terminologyServiceOptions != null) {
|
||||
this.terminologyServiceOptions = terminologyServiceOptions;
|
||||
}
|
||||
|
@ -166,7 +182,7 @@ public class RenderingContext {
|
|||
this.locale = new Locale.Builder().setLanguageTag("en-US").build();
|
||||
}
|
||||
public RenderingContext copy() {
|
||||
RenderingContext res = new RenderingContext(worker, markdown, terminologyServiceOptions, getLink(KnownLinkType.SPEC), localPrefix, lang, mode);
|
||||
RenderingContext res = new RenderingContext(worker, markdown, terminologyServiceOptions, getLink(KnownLinkType.SPEC), localPrefix, lang, mode, rules);
|
||||
|
||||
res.resolver = resolver;
|
||||
res.templateProvider = templateProvider;
|
||||
|
@ -618,9 +634,15 @@ public class RenderingContext {
|
|||
public String getLink(KnownLinkType link) {
|
||||
return links.get(link);
|
||||
}
|
||||
public void addLink(KnownLinkType self, String targetOutput) {
|
||||
// TODO Auto-generated method stub
|
||||
public void addLink(KnownLinkType type, String link) {
|
||||
links.put(type, link);
|
||||
|
||||
}
|
||||
public GenerationRules getRules() {
|
||||
return rules;
|
||||
}
|
||||
public void setRules(GenerationRules rules) {
|
||||
this.rules = rules;
|
||||
}
|
||||
|
||||
}
|
|
@ -25,6 +25,7 @@ import org.hl7.fhir.r5.model.StructureDefinition;
|
|||
import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||
import org.hl7.fhir.r5.renderers.utils.ElementWrappers;
|
||||
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.ITypeParser;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.ResourceRendererMode;
|
||||
import org.hl7.fhir.r5.test.NarrativeGenerationTests.TestProfileKnowledgeProvider;
|
||||
|
@ -183,7 +184,7 @@ public class NarrativeGenerationTests {
|
|||
@ParameterizedTest(name = "{index}: file {0}")
|
||||
@MethodSource("data")
|
||||
public void test(String id, TestDetails test) throws Exception {
|
||||
RenderingContext rc = new RenderingContext(context, null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER);
|
||||
RenderingContext rc = new RenderingContext(context, null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER, GenerationRules.VALID_RESOURCE);
|
||||
rc.setDestDir(Utilities.path("[tmp]", "narrative"));
|
||||
rc.setHeader(test.isHeader());
|
||||
rc.setDefinitionsTarget("test.html");
|
||||
|
|
|
@ -16,6 +16,7 @@ import org.hl7.fhir.r5.model.DomainResource;
|
|||
import org.hl7.fhir.r5.renderers.DataRenderer;
|
||||
import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||
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.ResourceRendererMode;
|
||||
import org.hl7.fhir.r5.test.utils.CompareUtilities;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
|
@ -35,7 +36,7 @@ public class NarrativeGeneratorTests {
|
|||
|
||||
@BeforeAll
|
||||
public static void setUp() throws FHIRException {
|
||||
rc = new RenderingContext(TestingUtilities.getSharedWorkerContext(), null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER);
|
||||
rc = new RenderingContext(TestingUtilities.getSharedWorkerContext(), null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER, GenerationRules.VALID_RESOURCE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.hl7.fhir.r5.model.DomainResource;
|
|||
import org.hl7.fhir.r5.model.Resource;
|
||||
import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||
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.ResourceRendererMode;
|
||||
import org.hl7.fhir.r5.test.utils.CompareUtilities;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
|
@ -34,7 +35,7 @@ public class ResourceRoundTripTests {
|
|||
@Test
|
||||
public void test() throws IOException, FHIRException, EOperationOutcome {
|
||||
DomainResource res = (DomainResource) new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "unicode.xml"));
|
||||
RenderingContext rc = new RenderingContext(TestingUtilities.getSharedWorkerContext(), null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER);
|
||||
RenderingContext rc = new RenderingContext(TestingUtilities.getSharedWorkerContext(), null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER, GenerationRules.VALID_RESOURCE);
|
||||
RendererFactory.factory(res, rc).render(res);
|
||||
IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "unicode.xml"), new FileOutputStream(TestingUtilities.tempFile("gen", "unicode.xml")));
|
||||
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.tempFile("gen", "unicode.out.xml")), res);
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.hl7.fhir.r5.model.TypeDetails;
|
|||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||
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.ResourceRendererMode;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||
|
@ -546,7 +547,7 @@ public class SnapShotGenerationTests {
|
|||
throw e;
|
||||
}
|
||||
if (output.getDifferential().hasElement()) {
|
||||
RenderingContext rc = new RenderingContext(TestingUtilities.getSharedWorkerContext(), null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER);
|
||||
RenderingContext rc = new RenderingContext(TestingUtilities.getSharedWorkerContext(), null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER, GenerationRules.VALID_RESOURCE);
|
||||
rc.setDestDir(Utilities.path("[tmp]", "snapshot"));
|
||||
rc.setProfileUtilities(new ProfileUtilities(TestingUtilities.getSharedWorkerContext(), null, new TestPKP()));
|
||||
RendererFactory.factory(output, rc).render(output);
|
||||
|
|
|
@ -694,7 +694,7 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
|||
XhtmlNode img = tc.addTag("span").setAttribute("style", "float: right").addTag("a").setAttribute("title", "Legend for this format").setAttribute("href", model.getDocoRef()).addTag("img");
|
||||
img.setAttribute("alt", "doco").setAttribute("style", "background-color: inherit").setAttribute("src", model.getDocoImg());
|
||||
if (model.isActive()) {
|
||||
img.setAttribute("onload", "fhirTableInit(this)");
|
||||
img.setAttribute("onLoad", "fhirTableInit(this)");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.hl7.fhir.r5.model.OperationOutcome;
|
|||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||
import org.hl7.fhir.utilities.SimpleHTTPClient;
|
||||
|
@ -255,7 +256,7 @@ public class Scanner {
|
|||
}
|
||||
|
||||
protected void genScanOutputItem(ScanOutputItem item, String filename) throws IOException, FHIRException, EOperationOutcome {
|
||||
RenderingContext rc = new RenderingContext(getContext(), null, null, "http://hl7.org/fhir", "", null, RenderingContext.ResourceRendererMode.END_USER);
|
||||
RenderingContext rc = new RenderingContext(getContext(), null, null, "http://hl7.org/fhir", "", null, RenderingContext.ResourceRendererMode.END_USER, GenerationRules.VALID_RESOURCE);
|
||||
rc.setNoSlowLookup(true);
|
||||
RendererFactory.factory(item.getOutcome(), rc).render(item.getOutcome());
|
||||
String s = new XhtmlComposer(XhtmlComposer.HTML).compose(item.getOutcome().getText().getDiv());
|
||||
|
@ -309,7 +310,7 @@ public class Scanner {
|
|||
protected OperationOutcome exceptionToOutcome(Exception ex) throws IOException, FHIRException, EOperationOutcome {
|
||||
OperationOutcome op = new OperationOutcome();
|
||||
op.addIssue().setCode(OperationOutcome.IssueType.EXCEPTION).setSeverity(OperationOutcome.IssueSeverity.FATAL).getDetails().setText(ex.getMessage());
|
||||
RenderingContext rc = new RenderingContext(getContext(), null, null, "http://hl7.org/fhir", "", null, RenderingContext.ResourceRendererMode.END_USER);
|
||||
RenderingContext rc = new RenderingContext(getContext(), null, null, "http://hl7.org/fhir", "", null, RenderingContext.ResourceRendererMode.END_USER, GenerationRules.VALID_RESOURCE);
|
||||
RendererFactory.factory(op, rc).render(op);
|
||||
return op;
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ import org.hl7.fhir.r5.model.StructureMap;
|
|||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||
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.ResourceRendererMode;
|
||||
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||
|
@ -652,7 +653,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
|||
public Resource generate(String source, String version) throws FHIRException, IOException, EOperationOutcome {
|
||||
Content cnt = igLoader.loadContent(source, "validate", false);
|
||||
Resource res = igLoader.loadResourceByVersion(version, cnt.focus, source);
|
||||
RenderingContext rc = new RenderingContext(context, null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER);
|
||||
RenderingContext rc = new RenderingContext(context, null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER, GenerationRules.VALID_RESOURCE);
|
||||
genResource(res, rc);
|
||||
return (Resource) res;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
|||
import org.hl7.fhir.r5.model.OperationOutcome;
|
||||
import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext;
|
||||
import org.hl7.fhir.r5.renderers.utils.RenderingContext.GenerationRules;
|
||||
import org.hl7.fhir.r5.utils.EOperationOutcome;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||
import org.hl7.fhir.r5.utils.OperationOutcomeUtilities;
|
||||
|
@ -108,7 +109,7 @@ public class ValidatorUtils {
|
|||
if (!op.hasIssue()) {
|
||||
op.addIssue().setSeverity(OperationOutcome.IssueSeverity.INFORMATION).setCode(OperationOutcome.IssueType.INFORMATIONAL).getDetails().setText(context.formatMessage(I18nConstants.ALL_OK));
|
||||
}
|
||||
RenderingContext rc = new RenderingContext(context, null, null, "http://hl7.org/fhir", "", null, RenderingContext.ResourceRendererMode.END_USER);
|
||||
RenderingContext rc = new RenderingContext(context, null, null, "http://hl7.org/fhir", "", null, RenderingContext.ResourceRendererMode.END_USER, GenerationRules.VALID_RESOURCE);
|
||||
RendererFactory.factory(op, rc).render(op);
|
||||
return op;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.hl7.fhir.r5.model.TypeDetails;
|
|||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.renderers.RendererFactory;
|
||||
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.ResourceRendererMode;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
import org.hl7.fhir.r5.utils.FHIRPathEngine;
|
||||
|
@ -529,7 +530,7 @@ public class SnapShotGenerationXTests {
|
|||
throw e;
|
||||
}
|
||||
if (output.getDifferential().hasElement()) {
|
||||
RenderingContext rc = new RenderingContext(TestingUtilities.getSharedWorkerContext(), null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER);
|
||||
RenderingContext rc = new RenderingContext(TestingUtilities.getSharedWorkerContext(), null, null, "http://hl7.org/fhir", "", null, ResourceRendererMode.END_USER, GenerationRules.VALID_RESOURCE);
|
||||
rc.setDestDir(makeTempDir());
|
||||
rc.setProfileUtilities(new ProfileUtilities(TestingUtilities.getSharedWorkerContext(), null, new TestPKP()));
|
||||
RendererFactory.factory(output, rc).render(output);
|
||||
|
|
Loading…
Reference in New Issue