fix bug where ElementModel paths are not populated
This commit is contained in:
parent
10a876e26a
commit
ca96bbfdc4
|
@ -1238,5 +1238,18 @@ public class Element extends Base {
|
||||||
}
|
}
|
||||||
return "e:"+e+",w:"+w+",h:"+h;
|
return "e:"+e+",w:"+w+",h:"+h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void populatePaths(String path) {
|
||||||
|
if (path == null) {
|
||||||
|
path = fhirType();
|
||||||
|
}
|
||||||
|
setPath(path);
|
||||||
|
if (children != null) {
|
||||||
|
for (Element n : children) {
|
||||||
|
n.populatePaths(path+"."+n.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -636,6 +636,10 @@ public class JsonParser extends ParserBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void compose(Element e, OutputStream stream, OutputStyle style, String identity) throws FHIRException, IOException {
|
public void compose(Element e, OutputStream stream, OutputStyle style, String identity) throws FHIRException, IOException {
|
||||||
|
if (e.getPath() == null) {
|
||||||
|
e.populatePaths(null);
|
||||||
|
}
|
||||||
|
|
||||||
OutputStreamWriter osw = new OutputStreamWriter(stream, "UTF-8");
|
OutputStreamWriter osw = new OutputStreamWriter(stream, "UTF-8");
|
||||||
if (style == OutputStyle.CANONICAL)
|
if (style == OutputStyle.CANONICAL)
|
||||||
json = new JsonCreatorCanonical(osw);
|
json = new JsonCreatorCanonical(osw);
|
||||||
|
@ -654,6 +658,10 @@ public class JsonParser extends ParserBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void compose(Element e, JsonCreator json) throws Exception {
|
public void compose(Element e, JsonCreator json) throws Exception {
|
||||||
|
if (e.getPath() == null) {
|
||||||
|
e.populatePaths(null);
|
||||||
|
}
|
||||||
|
|
||||||
this.json = json;
|
this.json = json;
|
||||||
json.beginObject();
|
json.beginObject();
|
||||||
|
|
||||||
|
|
|
@ -315,6 +315,10 @@ public class TurtleParser extends ParserBase {
|
||||||
|
|
||||||
|
|
||||||
public void compose(Element e, Turtle ttl, String base) throws FHIRException {
|
public void compose(Element e, Turtle ttl, String base) throws FHIRException {
|
||||||
|
if (e.getPath() == null) {
|
||||||
|
e.populatePaths(null);
|
||||||
|
}
|
||||||
|
|
||||||
ttl.prefix("fhir", FHIR_URI_BASE);
|
ttl.prefix("fhir", FHIR_URI_BASE);
|
||||||
ttl.prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
|
ttl.prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#");
|
||||||
ttl.prefix("owl", "http://www.w3.org/2002/07/owl#");
|
ttl.prefix("owl", "http://www.w3.org/2002/07/owl#");
|
||||||
|
|
|
@ -602,6 +602,9 @@ public class XmlParser extends ParserBase {
|
||||||
xml.setSortAttributes(false);
|
xml.setSortAttributes(false);
|
||||||
xml.setPretty(style == OutputStyle.PRETTY);
|
xml.setPretty(style == OutputStyle.PRETTY);
|
||||||
xml.start();
|
xml.start();
|
||||||
|
if (e.getPath() == null) {
|
||||||
|
e.populatePaths(null);
|
||||||
|
}
|
||||||
String ns = e.getProperty().getXmlNamespace();
|
String ns = e.getProperty().getXmlNamespace();
|
||||||
if (ns!=null && !"noNamespace".equals(ns)) {
|
if (ns!=null && !"noNamespace".equals(ns)) {
|
||||||
xml.setDefaultNamespace(ns);
|
xml.setDefaultNamespace(ns);
|
||||||
|
@ -654,6 +657,9 @@ public class XmlParser extends ParserBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void compose(Element e, IXMLWriter xml) throws Exception {
|
public void compose(Element e, IXMLWriter xml) throws Exception {
|
||||||
|
if (e.getPath() == null) {
|
||||||
|
e.populatePaths(null);
|
||||||
|
}
|
||||||
xml.start();
|
xml.start();
|
||||||
xml.setDefaultNamespace(e.getProperty().getXmlNamespace());
|
xml.setDefaultNamespace(e.getProperty().getXmlNamespace());
|
||||||
if (schemaPath != null) {
|
if (schemaPath != null) {
|
||||||
|
|
|
@ -618,6 +618,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
||||||
if (map == null) throw new Error("Unable to find map " + mapUri + " (Known Maps = " + context.listMapUrls() + ")");
|
if (map == null) throw new Error("Unable to find map " + mapUri + " (Known Maps = " + context.listMapUrls() + ")");
|
||||||
org.hl7.fhir.r5.elementmodel.Element resource = getTargetResourceFromStructureMap(map);
|
org.hl7.fhir.r5.elementmodel.Element resource = getTargetResourceFromStructureMap(map);
|
||||||
scu.transform(null, src, map, resource);
|
scu.transform(null, src, map, resource);
|
||||||
|
resource.populatePaths(null);
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -385,6 +385,7 @@ public class ValidationService {
|
||||||
for (String src : cliContext.getIgs()) {
|
for (String src : cliContext.getIgs()) {
|
||||||
igLoader.loadIg(validator.getIgs(), validator.getBinaries(), src, cliContext.isRecursive());
|
igLoader.loadIg(validator.getIgs(), validator.getBinaries(), src, cliContext.isRecursive());
|
||||||
}
|
}
|
||||||
|
System.out.println(" Package Summary: "+validator.getContext().loadedPackageSummary());
|
||||||
System.out.print(" Get set... ");
|
System.out.print(" Get set... ");
|
||||||
validator.setQuestionnaireMode(cliContext.getQuestionnaireMode());
|
validator.setQuestionnaireMode(cliContext.getQuestionnaireMode());
|
||||||
validator.setLevel(cliContext.getLevel());
|
validator.setLevel(cliContext.getLevel());
|
||||||
|
|
Loading…
Reference in New Issue