fix snapshot generation problem when profiling extensions in R3
This commit is contained in:
parent
6840eb3133
commit
854ebc35a4
|
@ -687,8 +687,9 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
*/
|
||||
private ElementDefinition processPaths(String indent, StructureDefinitionSnapshotComponent result, StructureDefinitionSnapshotComponent base, StructureDefinitionDifferentialComponent differential, int baseCursor, int diffCursor, int baseLimit,
|
||||
int diffLimit, String url, String webUrl, String profileName, String contextPathSrc, String contextPathDst, boolean trimDifferential, String contextName, String resultPathBase, boolean slicingDone, String typeSlicingPath, List<ElementRedirection> redirector, StructureDefinition srcSD) throws DefinitionException, FHIRException {
|
||||
if (debug)
|
||||
if (debug) {
|
||||
System.out.println(indent+"PP @ "+resultPathBase+" / "+contextPathSrc+" : base = "+baseCursor+" to "+baseLimit+", diff = "+diffCursor+" to "+diffLimit+" (slicing = "+slicingDone+", redirector = "+(redirector == null ? "null" : redirector.toString())+")");
|
||||
}
|
||||
ElementDefinition res = null;
|
||||
List<TypeSlice> typeList = new ArrayList<>();
|
||||
// just repeat processing entries until we run out of our allowed scope (1st entry, the allowed scope is all the entries)
|
||||
|
@ -696,9 +697,10 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
// get the current focus of the base, and decide what to do
|
||||
ElementDefinition currentBase = base.getElement().get(baseCursor);
|
||||
String cpath = fixedPathSource(contextPathSrc, currentBase.getPath(), redirector);
|
||||
if (debug)
|
||||
if (debug) {
|
||||
System.out.println(indent+" - "+cpath+": base = "+baseCursor+" ("+descED(base.getElement(),baseCursor)+") to "+baseLimit+" ("+descED(base.getElement(),baseLimit)+"), diff = "+diffCursor+" ("+descED(differential.getElement(),diffCursor)+") to "+diffLimit+" ("+descED(differential.getElement(),diffLimit)+") "+
|
||||
"(slicingDone = "+slicingDone+") (diffpath= "+(differential.getElement().size() > diffCursor ? differential.getElement().get(diffCursor).getPath() : "n/a")+")");
|
||||
}
|
||||
List<ElementDefinition> diffMatches = getDiffMatches(differential, cpath, diffCursor, diffLimit, profileName); // get a list of matching elements in scope
|
||||
|
||||
// in the simple case, source is not sliced.
|
||||
|
@ -1107,7 +1109,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
int nbl = findEndOfElement(base, baseCursor);
|
||||
int ndc = differential.getElement().indexOf(diffMatches.get(0));
|
||||
ElementDefinition elementToRemove = null;
|
||||
boolean shortCut = !typeList.isEmpty() && typeList.get(0).type != null;
|
||||
boolean shortCut = (!typeList.isEmpty() && typeList.get(0).type != null) || (diffMatches.get(0).hasSliceName() && !diffMatches.get(0).hasSlicing());
|
||||
// we come here whether they are sliced in the diff, or whether the short cut is used.
|
||||
if (shortCut) {
|
||||
// this is the short cut method, we've just dived in and specified a type slice.
|
||||
|
@ -1574,6 +1576,13 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
if (!s.contains(".")) {
|
||||
if (ed.hasSliceName() && ed.getType().size() == 1) {
|
||||
typeList.add(new TypeSlice(ed, ed.getTypeFirstRep().getWorkingCode()));
|
||||
} else if (ed.hasSliceName() && ed.getType().size() == 0) {
|
||||
String tn = ed.getSliceName().substring(rn.length());
|
||||
if (isDataType(tn)) {
|
||||
typeList.add(new TypeSlice(ed, tn));
|
||||
} else if (isDataType(Utilities.uncapitalize(tn))) {
|
||||
typeList.add(new TypeSlice(ed, Utilities.uncapitalize(tn)));
|
||||
}
|
||||
} else if (!ed.hasSliceName() && !s.equals("[x]")) {
|
||||
if (isDataType(s))
|
||||
typeList.add(new TypeSlice(ed, s));
|
||||
|
|
|
@ -106,6 +106,7 @@ public class SnapShotGenerationTests {
|
|||
private boolean gen;
|
||||
private boolean sort;
|
||||
private boolean fail;
|
||||
private boolean newSliceProcessing;
|
||||
private List<Rule> rules = new ArrayList<>();
|
||||
private StructureDefinition source;
|
||||
private StructureDefinition included;
|
||||
|
@ -117,6 +118,8 @@ public class SnapShotGenerationTests {
|
|||
gen = "true".equals(test.getAttribute("gen"));
|
||||
sort = "true".equals(test.getAttribute("sort"));
|
||||
fail = "true".equals(test.getAttribute("fail"));
|
||||
newSliceProcessing = !"false".equals(test.getAttribute("new-slice-processing"));
|
||||
|
||||
id = test.getAttribute("id");
|
||||
include = test.getAttribute("include");
|
||||
register = test.getAttribute("register");
|
||||
|
@ -183,6 +186,9 @@ public class SnapShotGenerationTests {
|
|||
}
|
||||
}
|
||||
}
|
||||
public boolean isNewSliceProcessing() {
|
||||
return newSliceProcessing;
|
||||
}
|
||||
}
|
||||
|
||||
public class TestPKP implements ProfileKnowledgeProvider {
|
||||
|
@ -472,9 +478,9 @@ public class SnapShotGenerationTests {
|
|||
|
||||
StructureDefinition output = test.getSource().copy();
|
||||
ProfileUtilities pu = new ProfileUtilities(TestingUtilities.context(), messages , new TestPKP());
|
||||
pu.setNewSlicingProcessing(true);
|
||||
pu.setThrowException(true);
|
||||
//pu.setDebug(true);
|
||||
pu.setNewSlicingProcessing(test.isNewSliceProcessing());
|
||||
pu.setThrowException(false);
|
||||
pu.setDebug(true);
|
||||
pu.setIds(test.getSource(), false);
|
||||
if (test.isSort()) {
|
||||
List<String> errors = new ArrayList<String>();
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -17,7 +17,7 @@
|
|||
|
||||
<properties>
|
||||
<hapi_fhir_version>4.1.0</hapi_fhir_version>
|
||||
<validator_test_case_version>1.0.28-SNAPSHOT</validator_test_case_version>
|
||||
<validator_test_case_version>1.0.29-SNAPSHOT</validator_test_case_version>
|
||||
</properties>
|
||||
|
||||
<artifactId>org.hl7.fhir.core</artifactId>
|
||||
|
|
Loading…
Reference in New Issue