Fix for NPE in R5 IG

This commit is contained in:
Grahame Grieve 2023-03-09 22:20:10 +11:00
parent fdbe28fb13
commit 9e87e6915c
2 changed files with 63 additions and 4 deletions

View File

@ -10,6 +10,8 @@ import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.r5.comparison.ValueSetComparer.ValueSetComparison;
import org.hl7.fhir.r5.conformance.profile.BindingResolution;
import org.hl7.fhir.r5.conformance.profile.ProfileKnowledgeProvider;
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.formats.IParser;
@ -49,7 +51,9 @@ import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.Row;
import org.hl7.fhir.utilities.xhtml.HierarchicalTableGenerator.TableModel;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
public class ProfileComparer extends CanonicalResourceComparer {
import kotlin.NotImplementedError;
public class ProfileComparer extends CanonicalResourceComparer implements ProfileKnowledgeProvider {
public class ProfileComparison extends CanonicalResourceComparison<StructureDefinition> {
@ -994,8 +998,8 @@ public class ProfileComparer extends CanonicalResourceComparer {
if (sn != null)
sName = sName +":"+sn;
StructureDefinitionRenderer.UnusedTracker used = new StructureDefinitionRenderer.UnusedTracker();
StructureDefinitionRenderer sdrLeft = new StructureDefinitionRenderer(new RenderingContext(utilsLeft.getContext(), null, utilsLeft.getTerminologyServiceOptions(), corePath, prefix, null, ResourceRendererMode.TECHNICAL, GenerationRules.IG_PUBLISHER));
StructureDefinitionRenderer sdrRight= new StructureDefinitionRenderer(new RenderingContext(utilsRight.getContext(), null, utilsRight.getTerminologyServiceOptions(), corePath, prefix, null, ResourceRendererMode.TECHNICAL, GenerationRules.IG_PUBLISHER));
StructureDefinitionRenderer sdrLeft = new StructureDefinitionRenderer(new RenderingContext(utilsLeft.getContext(), null, utilsLeft.getTerminologyServiceOptions(), corePath, prefix, null, ResourceRendererMode.TECHNICAL, GenerationRules.IG_PUBLISHER).setPkp(this));
StructureDefinitionRenderer sdrRight= new StructureDefinitionRenderer(new RenderingContext(utilsRight.getContext(), null, utilsRight.getTerminologyServiceOptions(), corePath, prefix, null, ResourceRendererMode.TECHNICAL, GenerationRules.IG_PUBLISHER).setPkp(this));
@ -1099,5 +1103,59 @@ private String tail(String path) {
return path;
}
@Override
public boolean isDatatype(String typeSimple) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isPrimitiveType(String typeSimple) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isResource(String typeSimple) {
// return false;
throw new NotImplementedError();
}
@Override
public boolean hasLinkFor(String typeSimple) {
return false;
}
@Override
public String getLinkFor(String corePath, String typeSimple) {
return "??|??";
}
@Override
public BindingResolution resolveBinding(StructureDefinition def, ElementDefinitionBindingComponent binding, String path)
throws FHIRException {
return new BindingResolution("??", "??");
}
@Override
public BindingResolution resolveBinding(StructureDefinition def, String url, String path) throws FHIRException {
return new BindingResolution("??", "??");
}
@Override
public String getLinkForProfile(StructureDefinition profile, String url) {
return "??|??";
}
@Override
public boolean prependLinks() {
return false;
}
@Override
public String getLinkForUrl(String corePath, String s) {
throw new NotImplementedError();
}
}

View File

@ -640,8 +640,9 @@ public class RenderingContext {
return this;
}
public void setPkp(ProfileKnowledgeProvider pkp) {
public RenderingContext setPkp(ProfileKnowledgeProvider pkp) {
this.pkp = pkp;
return this;
}
public ProfileKnowledgeProvider getPkp() {
return pkp;