This commit is contained in:
Grahame Grieve 2019-08-05 02:02:42 +00:00
commit ebe5f2a015
8 changed files with 68 additions and 22 deletions

View File

@ -448,7 +448,7 @@ public class ProfileUtilities extends TranslatingUtilities {
e.clearUserData(GENERATED_IN_SNAPSHOT);
// we actually delegate the work to a subroutine so we can re-enter it with a different cursors
StructureDefinitionDifferentialComponent diff = derived.getDifferential().copy(); // we make a copy here because we're sometimes going to hack the differential while processing it.
StructureDefinitionDifferentialComponent diff = cloneDiff(derived.getDifferential()); // we make a copy here because we're sometimes going to hack the differential while processing it. Have to migrate user data back afterwards
processPaths("", derived.getSnapshot(), base.getSnapshot(), diff, baseCursor, diffCursor, base.getSnapshot().getElement().size()-1,
derived.getDifferential().hasElement() ? derived.getDifferential().getElement().size()-1 : -1, url, webUrl, derived.present(), null, null, false, base.getUrl(), null, false, new ArrayList<ElementRedirection>(), base);
@ -467,6 +467,14 @@ public class ProfileUtilities extends TranslatingUtilities {
setIds(derived, false);
//Check that all differential elements have a corresponding snapshot element
for (ElementDefinition e : diff.getElement()) {
if (!e.hasUserData("diff-source"))
throw new Error("Unxpected internal condition - no source on diff element");
else {
if (e.hasUserData(DERIVATION_EQUALS))
((Base) e.getUserData("diff-source")).setUserData(DERIVATION_EQUALS, e.getUserData(DERIVATION_EQUALS));
if (e.hasUserData(DERIVATION_POINTER))
((Base) e.getUserData("diff-source")).setUserData(DERIVATION_POINTER, e.getUserData(DERIVATION_POINTER));
}
if (!e.hasUserData(GENERATED_IN_SNAPSHOT)) {
System.out.println("Error in snapshot generation: Differential for "+derived.getUrl()+" with " + (e.hasId() ? "id: "+e.getId() : "path: "+e.getPath())+" has an element that is not marked with a snapshot match");
if (exception)
@ -489,6 +497,17 @@ public class ProfileUtilities extends TranslatingUtilities {
}
}
private StructureDefinitionDifferentialComponent cloneDiff(StructureDefinitionDifferentialComponent source) {
StructureDefinitionDifferentialComponent diff = new StructureDefinitionDifferentialComponent();
for (ElementDefinition sed : source.getElement()) {
ElementDefinition ted = sed.copy();
diff.getElement().add(ted);
ted.setUserData("diff-source", sed);
}
return diff;
}
private String constraintSummary(ElementDefinition ed) {
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
if (ed.hasPattern())
@ -2533,13 +2552,13 @@ public class ProfileUtilities extends TranslatingUtilities {
row.setLineColor(0);
boolean hasDef = element != null;
boolean ext = false;
if (s.equals("extension")) {
if (tail(element.getPath()).equals("extension")) {
if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile().get(0).getValue()))
row.setIcon("icon_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX);
else
row.setIcon("icon_extension_simple.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_SIMPLE);
ext = true;
} else if (s.equals("modifierExtension")) {
} else if (tail(element.getPath()).equals("modifierExtension")) {
if (element.hasType() && element.getType().get(0).hasProfile() && extensionIsComplex(element.getType().get(0).getProfile().get(0).getValue()))
row.setIcon("icon_modifier_extension_complex.png", HierarchicalTableGenerator.TEXT_ICON_EXTENSION_COMPLEX);
else

View File

@ -604,6 +604,14 @@ public class Element extends Base {
return getNamedChild(name) != null;
}
public boolean hasChildren(String name) {
if (children != null)
for (Element child : children)
if (child.getName().equals(name))
return true;
return false;
}
@Override
public String toString() {
return name+"="+fhirType() + "["+(children == null || hasValue() ? value : Integer.toString(children.size())+" children")+"]";

View File

@ -3885,5 +3885,18 @@ public class StructureDefinition extends MetadataResource {
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_BASE = new ca.uhn.fhir.model.api.Include("StructureDefinition:base").toLocked();
public String describeType() {
if ("Extension".equals(getType()))
return "Extension" ;
switch (getKind()) {
case COMPLEXTYPE: return getDerivation() == TypeDerivationRule.CONSTRAINT ? "DataType Constraint" : "DataType" ;
case LOGICAL: return getDerivation() == TypeDerivationRule.CONSTRAINT ? "Logical Model" : "Logical Model Profile";
case PRIMITIVETYPE: return getDerivation() == TypeDerivationRule.CONSTRAINT ? "Type Constraint" : "Type";
case RESOURCE: return getDerivation() == TypeDerivationRule.CONSTRAINT ? "Resource Profile" : "Resource";
default:
return "Definition";
}
}
}

View File

@ -62,7 +62,7 @@
<img src="tbl_spacer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vjoin.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="icon_extension_simple.png" alt="." style="background-color: white; background-color: inherit" title="Simple Extension" class="hierarchy"/>
<span title="Slice namespace-id: null">extension</span>
<span title="Slice namespace-id: null">namespace-id</span>
<a name="Extension.extension"> </a>
</td>
<td style="vertical-align: top; text-align : left; background-color: white; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px" class="hierarchy"/>
@ -112,7 +112,7 @@
<img src="tbl_spacer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vjoin.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="icon_extension_simple.png" alt="." style="background-color: #F7F7F7; background-color: inherit" title="Simple Extension" class="hierarchy"/>
<span title="Slice universal-id: Identifier values follwing the universal-id-type defined scheme.">extension</span>
<span title="Slice universal-id: Identifier values follwing the universal-id-type defined scheme.">universal-id</span>
<a name="Extension.extension"> </a>
</td>
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px" class="hierarchy"/>
@ -162,7 +162,7 @@
<img src="tbl_spacer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vjoin.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="icon_extension_simple.png" alt="." style="background-color: white; background-color: inherit" title="Simple Extension" class="hierarchy"/>
<span title="Slice universal-id-type: Provides scheme to use to interpret the universal-id value .e.g. GUID, ISO etc. see HL7 V2 Table 0301 - Universal ID type.">extension</span>
<span title="Slice universal-id-type: Provides scheme to use to interpret the universal-id value .e.g. GUID, ISO etc. see HL7 V2 Table 0301 - Universal ID type.">universal-id-type</span>
<a name="Extension.extension"> </a>
</td>
<td style="vertical-align: top; text-align : left; background-color: white; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px" class="hierarchy"/>

View File

@ -119,7 +119,7 @@
</tr>
<tr style="border: 0px #F0F0F0 solid; padding:0px; vertical-align: top; background-color: #F7F7F7;">
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck12.png)" class="hierarchy">
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck13.png)" class="hierarchy">
<img src="tbl_spacer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vjoin.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="icon_slice.png" alt="." style="background-color: #F7F7F7; background-color: inherit" title="Slice Definition" class="hierarchy"/>
@ -129,10 +129,7 @@
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px" class="hierarchy"/>
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px" class="hierarchy"/>
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px" class="hierarchy">
<a style="font-style: italic" href="nullreferences.html">Reference</a>
<span style="font-style: italic">(</span>
<span style="font-style: italic">http://hl7.org.au/fhir/StructureDefinition/au-practitioner</span>
<span style="font-style: italic">)</span>
<a style="font-style: italic" href="nullprofiling.html#slicing">(Slice Definition)</a>
</td>
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px" class="hierarchy">
<span style="font-weight:bold; font-style: italic">Slice: </span>
@ -141,11 +138,12 @@
</tr>
<tr style="border: 0px #F0F0F0 solid; padding:0px; vertical-align: top; background-color: white;">
<td style="vertical-align: top; text-align : left; background-color: white; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck15.png)" class="hierarchy">
<td style="vertical-align: top; text-align : left; background-color: white; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck135.png)" class="hierarchy">
<img src="tbl_spacer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vjoin.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vline.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vjoin_slicer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="icon_reference.png" alt="." style="background-color: white; background-color: inherit" title="Reference to another Resource" class="hierarchy"/>
<span title="Slice Examiner: null">performer</span>
<span title="Slice Examiner: null">Examiner</span>
<a name="Observation.performer"> </a>
</td>
<td style="vertical-align: top; text-align : left; background-color: white; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px" class="hierarchy"/>
@ -157,9 +155,10 @@
</tr>
<tr style="border: 0px #F0F0F0 solid; padding:0px; vertical-align: top; background-color: #F7F7F7;">
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck140.png)" class="hierarchy">
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck1340.png)" class="hierarchy">
<img src="tbl_spacer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vline.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vline_slicer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vjoin_end_slice.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="icon_element.gif" alt="." style="background-color: #F7F7F7; background-color: inherit" title="Element" class="hierarchy"/>
<span title="null">display</span>
@ -175,11 +174,12 @@
</tr>
<tr style="border: 0px #F0F0F0 solid; padding:0px; vertical-align: top; background-color: white;">
<td style="vertical-align: top; text-align : left; background-color: white; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck15.png)" class="hierarchy">
<td style="vertical-align: top; text-align : left; background-color: white; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck125.png)" class="hierarchy">
<img src="tbl_spacer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vjoin.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vline.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vjoin_end_slicer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="icon_reference.png" alt="." style="background-color: white; background-color: inherit" title="Reference to another Resource" class="hierarchy"/>
<span title="Slice Organisation: null">performer</span>
<span title="Slice Organisation: null">Organisation</span>
<a name="Observation.performer"> </a>
</td>
<td style="vertical-align: top; text-align : left; background-color: white; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px" class="hierarchy"/>
@ -191,9 +191,10 @@
</tr>
<tr style="border: 0px #F0F0F0 solid; padding:0px; vertical-align: top; background-color: #F7F7F7;">
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck140.png)" class="hierarchy">
<td style="vertical-align: top; text-align : left; background-color: #F7F7F7; border: 0px #F0F0F0 solid; padding:0px 4px 0px 4px; white-space: nowrap; background-image: url(tbl_bck1240.png)" class="hierarchy">
<img src="tbl_spacer.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vline.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_blank.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="tbl_vjoin_end_slice.png" alt="." style="background-color: inherit" class="hierarchy"/>
<img src="icon_element.gif" alt="." style="background-color: #F7F7F7; background-color: inherit" title="Element" class="hierarchy"/>
<span title="null">display</span>

View File

@ -83,6 +83,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<archive>
<manifest>

View File

@ -2738,9 +2738,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
}
if (!anyFound) {
if (slicer.getSlicing().getDiscriminator().size() > 1)
throw new DefinitionException("Could not match any discriminators (" + discriminators + ") for slice " + ed.getId() + " in profile " + profile.getUrl() + " - does not have fixed value, binding or existence assertions for any of the discriminators");
throw new DefinitionException("Could not match any discriminators (" + discriminators + ") for slice " + ed.getId() + " in profile " + profile.getUrl() + " - None of the discriminator " + discriminators + " have fixed value, binding or existence assertions");
else
throw new DefinitionException("Could not match discriminator (" + discriminators + ") for slice " + ed.getId() + " in profile " + profile.getUrl() + " - does not have fixed value, binding or existence assertions");
throw new DefinitionException("Could not match discriminator (" + discriminators + ") for slice " + ed.getId() + " in profile " + profile.getUrl() + " - the discriminator " + discriminators + " does not have fixed value, binding or existence assertions");
}
try {

View File

@ -17,7 +17,6 @@
<properties>
<hapi_fhir_version>4.0.0-SNAPSHOT</hapi_fhir_version>
<maven.test.skip>true</maven.test.skip>
</properties>
<artifactId>org.hl7.fhir.core</artifactId>
@ -151,6 +150,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
<includes>
</includes>
<excludes>
<exclude>*</exclude>
</excludes>
</configuration>
</plugin>
<plugin>