commit
1b378ac9b0
|
@ -459,6 +459,10 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ElementDefinition> getChildList(StructureDefinition profile, String path, String id, boolean diff) {
|
public List<ElementDefinition> getChildList(StructureDefinition profile, String path, String id, boolean diff) {
|
||||||
|
return getChildList(profile, path, id, diff, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ElementDefinition> getChildList(StructureDefinition profile, String path, String id, boolean diff, boolean refs) {
|
||||||
List<ElementDefinition> res = new ArrayList<ElementDefinition>();
|
List<ElementDefinition> res = new ArrayList<ElementDefinition>();
|
||||||
|
|
||||||
boolean capturing = id==null;
|
boolean capturing = id==null;
|
||||||
|
@ -483,7 +487,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
if (capturing) {
|
if (capturing) {
|
||||||
String p = e.getPath();
|
String p = e.getPath();
|
||||||
|
|
||||||
if (!Utilities.noString(e.getContentReference()) && path.startsWith(p)) {
|
if (refs && !Utilities.noString(e.getContentReference()) && path.startsWith(p)) {
|
||||||
if (path.length() > p.length()) {
|
if (path.length() > p.length()) {
|
||||||
return getChildList(profile, e.getContentReference()+"."+path.substring(p.length()+1), null, diff);
|
return getChildList(profile, e.getContentReference()+"."+path.substring(p.length()+1), null, diff);
|
||||||
} else if (e.getContentReference().startsWith("#")) {
|
} else if (e.getContentReference().startsWith("#")) {
|
||||||
|
@ -511,6 +515,10 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ElementDefinition> getChildList(StructureDefinition structure, ElementDefinition element, boolean diff, boolean refs) {
|
||||||
|
return getChildList(structure, element.getPath(), element.getId(), diff, refs);
|
||||||
|
}
|
||||||
|
|
||||||
public List<ElementDefinition> getChildList(StructureDefinition structure, ElementDefinition element, boolean diff) {
|
public List<ElementDefinition> getChildList(StructureDefinition structure, ElementDefinition element, boolean diff) {
|
||||||
return getChildList(structure, element.getPath(), element.getId(), diff);
|
return getChildList(structure, element.getPath(), element.getId(), diff);
|
||||||
}
|
}
|
||||||
|
@ -3313,7 +3321,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
c.getPieces().add(gen.new Piece("#"+ed.getElement().getPath(), tail(ed.getElement().getPath()), ed.getElement().getPath()));
|
c.getPieces().add(gen.new Piece("#"+ed.getElement().getPath(), tail(ed.getElement().getPath()), ed.getElement().getPath()));
|
||||||
} else {
|
} else {
|
||||||
c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getElement().getPath()), null));
|
c.getPieces().add(gen.new Piece(null, translate("sd.table", "See ", ed.getElement().getPath()), null));
|
||||||
c.getPieces().add(gen.new Piece(corePath+ed.getSource().getUserString("path")+"#"+ed.getElement().getPath(), tail(ed.getElement().getPath())+" ("+ed.getSource().getType()+")", ed.getElement().getPath()));
|
c.getPieces().add(gen.new Piece(pfx(corePath, ed.getSource().getUserString("path"))+"#"+ed.getElement().getPath(), tail(ed.getElement().getPath())+" ("+ed.getSource().getType()+")", ed.getElement().getPath()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
|
@ -3446,6 +3454,10 @@ public class ProfileUtilities extends TranslatingUtilities {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String pfx(String prefix, String url) {
|
||||||
|
return Utilities.isAbsoluteUrl(url) ? url : prefix + url;
|
||||||
|
}
|
||||||
|
|
||||||
public void genTargetLink(HierarchicalTableGenerator gen, String profileBaseFileName, String corePath, Cell c, TypeRefComponent t, String u) {
|
public void genTargetLink(HierarchicalTableGenerator gen, String profileBaseFileName, String corePath, Cell c, TypeRefComponent t, String u) {
|
||||||
if (u.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
|
if (u.startsWith("http://hl7.org/fhir/StructureDefinition/")) {
|
||||||
StructureDefinition sd = context.fetchResource(StructureDefinition.class, u);
|
StructureDefinition sd = context.fetchResource(StructureDefinition.class, u);
|
||||||
|
|
|
@ -678,5 +678,32 @@ public class ResourceFactory extends Factory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DataType createPrimitive(String type, String value) {
|
||||||
|
switch (type) {
|
||||||
|
case "boolean": return new BooleanType(value);
|
||||||
|
case "integer": return new IntegerType(value);
|
||||||
|
case "integer64": return new Integer64Type(value);
|
||||||
|
case "string": return new StringType(value);
|
||||||
|
case "decimal": return new DecimalType(value);
|
||||||
|
case "uri": return new UriType(value);
|
||||||
|
case "url": return new UrlType(value);
|
||||||
|
case "canonical": return new CanonicalType(value);
|
||||||
|
case "base64Binary": return new Base64BinaryType(value);
|
||||||
|
case "instant": return new InstantType(value);
|
||||||
|
case "date": return new DateType(value);
|
||||||
|
case "dateTime": return new DateTimeType(value);
|
||||||
|
case "time": return new TimeType(value);
|
||||||
|
case "code": return new CodeType(value);
|
||||||
|
case "oid": return new OidType(value);
|
||||||
|
case "id": return new IdType(value);
|
||||||
|
case "markdown": return new MarkdownType(value);
|
||||||
|
case "unsignedInt": return new UnsignedIntType(value);
|
||||||
|
case "positiveInt": return new PositiveIntType(value);
|
||||||
|
case "uuid": return new UuidType(value);
|
||||||
|
default:
|
||||||
|
throw new FHIRException("Unknown Primitive Type '"+type+"'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -72,7 +72,7 @@ public class ElementWrappers {
|
||||||
@Override
|
@Override
|
||||||
public List<PropertyWrapper> children() {
|
public List<PropertyWrapper> children() {
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
children = context.getProfileUtilities().getChildList(structure, definition);
|
children = context.getProfileUtilities().getChildList(structure, definition, false, true);
|
||||||
if (children.isEmpty() && !Utilities.noString(type)) {
|
if (children.isEmpty() && !Utilities.noString(type)) {
|
||||||
StructureDefinition sd = context.getWorker().fetchTypeDefinition(type);
|
StructureDefinition sd = context.getWorker().fetchTypeDefinition(type);
|
||||||
children = context.getProfileUtilities().getChildList(sd, sd.getSnapshot().getElementFirstRep());
|
children = context.getProfileUtilities().getChildList(sd, sd.getSnapshot().getElementFirstRep());
|
||||||
|
|
|
@ -282,6 +282,16 @@ public class CodeSystemUtilities {
|
||||||
return cs;
|
return cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean makeCSShareable(CodeSystem cs) {
|
||||||
|
if (!cs.hasMeta())
|
||||||
|
cs.setMeta(new Meta());
|
||||||
|
for (UriType t : cs.getMeta().getProfile())
|
||||||
|
if (t.getValue().equals("http://hl7.org/fhir/StructureDefinition/shareablecodesystem"))
|
||||||
|
return false;
|
||||||
|
cs.getMeta().getProfile().add(new CanonicalType("http://hl7.org/fhir/StructureDefinition/shareablecodesystem"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static void setOID(CodeSystem cs, String oid) {
|
public static void setOID(CodeSystem cs, String oid) {
|
||||||
if (!oid.startsWith("urn:oid:"))
|
if (!oid.startsWith("urn:oid:"))
|
||||||
oid = "urn:oid:" + oid;
|
oid = "urn:oid:" + oid;
|
||||||
|
|
|
@ -57,6 +57,16 @@ public class ValueSetUtilities {
|
||||||
return vs;
|
return vs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean makeVSShareable(ValueSet vs) {
|
||||||
|
if (!vs.hasMeta())
|
||||||
|
vs.setMeta(new Meta());
|
||||||
|
for (UriType t : vs.getMeta().getProfile())
|
||||||
|
if (t.getValue().equals("http://hl7.org/fhir/StructureDefinition/shareablevalueset"))
|
||||||
|
return false;
|
||||||
|
vs.getMeta().getProfile().add(new CanonicalType("http://hl7.org/fhir/StructureDefinition/shareablevalueset"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public static void checkShareable(ValueSet vs) {
|
public static void checkShareable(ValueSet vs) {
|
||||||
if (!vs.hasMeta())
|
if (!vs.hasMeta())
|
||||||
throw new Error("ValueSet "+vs.getUrl()+" is not shareable");
|
throw new Error("ValueSet "+vs.getUrl()+" is not shareable");
|
||||||
|
|
|
@ -149,7 +149,7 @@ public class TestingUtilities extends BaseTestingUtilities {
|
||||||
public static String checkXMLIsSame(String f1, String f2) throws Exception {
|
public static String checkXMLIsSame(String f1, String f2) throws Exception {
|
||||||
String result = compareXml(f1, f2);
|
String result = compareXml(f1, f2);
|
||||||
if (result != null && SHOW_DIFF) {
|
if (result != null && SHOW_DIFF) {
|
||||||
String diff = Utilities.path(System.getenv("ProgramFiles(X86)"), "WinMerge", "WinMergeU.exe");
|
String diff = Utilities.path(System.getenv("ProgramFiles"), "WinMerge", "WinMergeU.exe");
|
||||||
List<String> command = new ArrayList<String>();
|
List<String> command = new ArrayList<String>();
|
||||||
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
|
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,9 @@ public class ToolingExtensions {
|
||||||
public static final String EXT_EXP_FRAGMENT = "http://hl7.org/fhir/tools/StructureDefinition/expansion-codesystem-fragment";
|
public static final String EXT_EXP_FRAGMENT = "http://hl7.org/fhir/tools/StructureDefinition/expansion-codesystem-fragment";
|
||||||
public static final String EXT_EXP_TOOCOSTLY = "http://hl7.org/fhir/StructureDefinition/valueset-toocostly";
|
public static final String EXT_EXP_TOOCOSTLY = "http://hl7.org/fhir/StructureDefinition/valueset-toocostly";
|
||||||
public static final String EXT_MUST_SUPPORT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support";
|
public static final String EXT_MUST_SUPPORT = "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support";
|
||||||
|
public static final String EXT_TRANSLATABLE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable";
|
||||||
|
public static final String EXT_PATTERN = "http://hl7.org/fhir/StructureDefinition/elementdefinition-pattern";
|
||||||
|
|
||||||
// specific extension helpers
|
// specific extension helpers
|
||||||
|
|
||||||
public static Extension makeIssueSource(Source source) {
|
public static Extension makeIssueSource(Source source) {
|
||||||
|
|
|
@ -240,16 +240,18 @@ public class HierarchicalTableGenerator extends TranslatingUtilities {
|
||||||
pieces.add(piece);
|
pieces.add(piece);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cell addMarkdown(String md) {
|
public Cell addMarkdown(String md) {
|
||||||
try {
|
if (!Utilities.noString(md)) {
|
||||||
Parser parser = Parser.builder().build();
|
try {
|
||||||
Node document = parser.parse(md);
|
Parser parser = Parser.builder().build();
|
||||||
HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).build();
|
Node document = parser.parse(md);
|
||||||
String html = renderer.render(document);
|
HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).build();
|
||||||
pieces.addAll(htmlToParagraphPieces(html, null));
|
String html = renderer.render(document);
|
||||||
} catch (Exception e) {
|
pieces.addAll(htmlToParagraphPieces(html, null));
|
||||||
e.printStackTrace();
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<hapi_fhir_version>5.1.0</hapi_fhir_version>
|
<hapi_fhir_version>5.1.0</hapi_fhir_version>
|
||||||
<validator_test_case_version>1.1.56</validator_test_case_version>
|
<validator_test_case_version>1.1.57-SNAPSHOT</validator_test_case_version>
|
||||||
<junit_jupiter_version>5.6.2</junit_jupiter_version>
|
<junit_jupiter_version>5.6.2</junit_jupiter_version>
|
||||||
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
|
<maven_surefire_version>3.0.0-M4</maven_surefire_version>
|
||||||
<jacoco_version>0.8.5</jacoco_version>
|
<jacoco_version>0.8.5</jacoco_version>
|
||||||
|
|
Loading…
Reference in New Issue