Handle sub-slicing case where slice matches both the slice definition and the sub-slice definition
This commit is contained in:
parent
8a5c9c7ca6
commit
a2e2ef714e
|
@ -73,6 +73,7 @@ import org.hl7.fhir.r5.model.DomainResource;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition;
|
import org.hl7.fhir.r5.model.ElementDefinition;
|
||||||
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent;
|
||||||
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
import org.hl7.fhir.r5.model.Enumerations.PublicationStatus;
|
||||||
|
import org.hl7.fhir.r5.model.IdType;
|
||||||
import org.hl7.fhir.r5.model.ImplementationGuide;
|
import org.hl7.fhir.r5.model.ImplementationGuide;
|
||||||
import org.hl7.fhir.r5.model.Library;
|
import org.hl7.fhir.r5.model.Library;
|
||||||
import org.hl7.fhir.r5.model.Measure;
|
import org.hl7.fhir.r5.model.Measure;
|
||||||
|
@ -868,7 +869,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
|
|
||||||
// if that failed, we try to expand on the server
|
// if that failed, we try to expand on the server
|
||||||
if (addDependentResources(p, vs)) {
|
if (addDependentResources(p, vs)) {
|
||||||
p.addParameter().setName("cache-id").setValue(new StringType(tcc.getCacheId()));
|
p.addParameter().setName("cache-id").setValue(new IdType(tcc.getCacheId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (noTerminologyServer) {
|
if (noTerminologyServer) {
|
||||||
|
@ -1147,7 +1148,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
|
|
||||||
boolean cached = addDependentResources(p, vs);
|
boolean cached = addDependentResources(p, vs);
|
||||||
if (cached) {
|
if (cached) {
|
||||||
p.addParameter().setName("cache-id").setValue(new StringType(tcc.getCacheId()));
|
p.addParameter().setName("cache-id").setValue(new IdType(tcc.getCacheId()));
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -1276,7 +1277,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
addDependentResources(pin, vs);
|
addDependentResources(pin, vs);
|
||||||
}
|
}
|
||||||
if (cache) {
|
if (cache) {
|
||||||
pin.addParameter().setName("cache-id").setValue(new StringType(tcc.getCacheId()));
|
pin.addParameter().setName("cache-id").setValue(new IdType(tcc.getCacheId()));
|
||||||
}
|
}
|
||||||
for (ParametersParameterComponent pp : pin.getParameter()) {
|
for (ParametersParameterComponent pp : pin.getParameter()) {
|
||||||
if (pp.getName().equals("profile")) {
|
if (pp.getName().equals("profile")) {
|
||||||
|
@ -1917,6 +1918,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
private Set<String> notCanonical = new HashSet<String>();
|
private Set<String> notCanonical = new HashSet<String>();
|
||||||
|
|
||||||
protected IWorkerContextManager.IPackageLoadingTracker packageTracker;
|
protected IWorkerContextManager.IPackageLoadingTracker packageTracker;
|
||||||
|
private boolean forPublication;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Resource fetchResourceById(String type, String uri) {
|
public Resource fetchResourceById(String type, String uri) {
|
||||||
|
@ -2467,4 +2469,13 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
return new PEBuilder(this, elementProps, fixedProps);
|
return new PEBuilder(this, elementProps, fixedProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isForPublication() {
|
||||||
|
return forPublication;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setForPublication(boolean value) {
|
||||||
|
forPublication = value;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,6 +274,7 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
|
||||||
ProfileUtilities pu = new ProfileUtilities(context, msgs, this);
|
ProfileUtilities pu = new ProfileUtilities(context, msgs, this);
|
||||||
pu.setAutoFixSliceNames(true);
|
pu.setAutoFixSliceNames(true);
|
||||||
pu.setThrowException(false);
|
pu.setThrowException(false);
|
||||||
|
pu.setForPublication(context.isForPublication());
|
||||||
if (xverManager == null) {
|
if (xverManager == null) {
|
||||||
xverManager = new XVerExtensionManager(context);
|
xverManager = new XVerExtensionManager(context);
|
||||||
}
|
}
|
||||||
|
@ -282,8 +283,9 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
|
||||||
pu.sortDifferential(sd, p, p.getUrl(), errors, true);
|
pu.sortDifferential(sd, p, p.getUrl(), errors, true);
|
||||||
}
|
}
|
||||||
pu.setDebug(false);
|
pu.setDebug(false);
|
||||||
for (String err : errors)
|
for (String err : errors) {
|
||||||
msgs.add(new ValidationMessage(Source.ProfileValidator, IssueType.EXCEPTION, p.getWebPath(), "Error sorting Differential: "+err, ValidationMessage.IssueSeverity.ERROR));
|
msgs.add(new ValidationMessage(Source.ProfileValidator, IssueType.EXCEPTION, p.getWebPath(), "Error sorting Differential: "+err, ValidationMessage.IssueSeverity.ERROR));
|
||||||
|
}
|
||||||
pu.generateSnapshot(sd, p, p.getUrl(), sd.getUserString("webroot"), p.getName());
|
pu.generateSnapshot(sd, p, p.getUrl(), sd.getUserString("webroot"), p.getName());
|
||||||
for (ValidationMessage msg : msgs) {
|
for (ValidationMessage msg : msgs) {
|
||||||
if ((!ignoreProfileErrors && msg.getLevel() == ValidationMessage.IssueSeverity.ERROR) || msg.getLevel() == ValidationMessage.IssueSeverity.FATAL)
|
if ((!ignoreProfileErrors && msg.getLevel() == ValidationMessage.IssueSeverity.ERROR) || msg.getLevel() == ValidationMessage.IssueSeverity.FATAL)
|
||||||
|
|
|
@ -941,4 +941,6 @@ public interface IWorkerContext {
|
||||||
|
|
||||||
public PEBuilder getProfiledElementBuilder(PEElementPropertiesPolicy elementProps, boolean fixedProps);
|
public PEBuilder getProfiledElementBuilder(PEElementPropertiesPolicy elementProps, boolean fixedProps);
|
||||||
|
|
||||||
|
public boolean isForPublication();
|
||||||
|
public void setForPublication(boolean value);
|
||||||
}
|
}
|
|
@ -544,7 +544,7 @@ public class Coding extends DataType implements IBaseCoding, ICompositeType, ICo
|
||||||
base = base+"|"+getVersion();
|
base = base+"|"+getVersion();
|
||||||
base = base + "#"+getCode();
|
base = base + "#"+getCode();
|
||||||
if (hasDisplay())
|
if (hasDisplay())
|
||||||
base = base+": "+getDisplay();
|
base = base+": '"+getDisplay()+"'";
|
||||||
return base;
|
return base;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5968,14 +5968,30 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (match) {
|
if (match) {
|
||||||
|
boolean update = true;
|
||||||
boolean isOk = ei.definition == null || ei.definition == slicer || (ei.definition.getPath().endsWith("[x]") && ed.getPath().startsWith(ei.definition.getPath().replace("[x]", "")));
|
boolean isOk = ei.definition == null || ei.definition == slicer || (ei.definition.getPath().endsWith("[x]") && ed.getPath().startsWith(ei.definition.getPath().replace("[x]", "")));
|
||||||
|
if (!isOk) {
|
||||||
|
// is this a subslice? then we put it in as a replacement
|
||||||
|
String existingName = ei.definition == null || !ei.definition.hasSliceName() ? null : ei.definition.getSliceName();
|
||||||
|
String matchingName = ed.hasSliceName() ? ed.getSliceName() : null;
|
||||||
|
if (existingName != null && matchingName != null) {
|
||||||
|
if (matchingName.startsWith(existingName+"/")) {
|
||||||
|
isOk = true;
|
||||||
|
} else if (existingName.startsWith(matchingName+"/")) {
|
||||||
|
update = false;
|
||||||
|
isOk = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (rule(errors, NO_RULE_DATE, IssueType.INVALID, ei.line(), ei.col(), ei.getPath(), isOk, I18nConstants.VALIDATION_VAL_PROFILE_MATCHMULTIPLE, profile.getVersionedUrl(), (ei.definition == null || !ei.definition.hasSliceName() ? "" : ei.definition.getSliceName()), (ed.hasSliceName() ? ed.getSliceName() : ""))) {
|
if (rule(errors, NO_RULE_DATE, IssueType.INVALID, ei.line(), ei.col(), ei.getPath(), isOk, I18nConstants.VALIDATION_VAL_PROFILE_MATCHMULTIPLE, profile.getVersionedUrl(), (ei.definition == null || !ei.definition.hasSliceName() ? "" : ei.definition.getSliceName()), (ed.hasSliceName() ? ed.getSliceName() : ""))) {
|
||||||
ei.definition = ed;
|
if (update) {
|
||||||
if (ei.slice == null) {
|
ei.definition = ed;
|
||||||
ei.index = i;
|
if (ei.slice == null) {
|
||||||
} else {
|
ei.index = i;
|
||||||
ei.index = sliceOffset;
|
} else {
|
||||||
ei.sliceindex = i - (sliceOffset + 1);
|
ei.index = sliceOffset;
|
||||||
|
ei.sliceindex = i - (sliceOffset + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (childUnsupportedSlicing) {
|
} else if (childUnsupportedSlicing) {
|
||||||
|
|
Loading…
Reference in New Issue