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.ElementDefinitionBindingComponent;
|
||||
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.Library;
|
||||
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 (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) {
|
||||
|
@ -1147,7 +1148,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
|
||||
boolean cached = addDependentResources(p, vs);
|
||||
if (cached) {
|
||||
p.addParameter().setName("cache-id").setValue(new StringType(tcc.getCacheId()));
|
||||
p.addParameter().setName("cache-id").setValue(new IdType(tcc.getCacheId()));
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
@ -1276,7 +1277,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
addDependentResources(pin, vs);
|
||||
}
|
||||
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()) {
|
||||
if (pp.getName().equals("profile")) {
|
||||
|
@ -1917,6 +1918,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
private Set<String> notCanonical = new HashSet<String>();
|
||||
|
||||
protected IWorkerContextManager.IPackageLoadingTracker packageTracker;
|
||||
private boolean forPublication;
|
||||
|
||||
@Override
|
||||
public Resource fetchResourceById(String type, String uri) {
|
||||
|
@ -2467,4 +2469,13 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
// TODO Auto-generated method stub
|
||||
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);
|
||||
pu.setAutoFixSliceNames(true);
|
||||
pu.setThrowException(false);
|
||||
pu.setForPublication(context.isForPublication());
|
||||
if (xverManager == null) {
|
||||
xverManager = new XVerExtensionManager(context);
|
||||
}
|
||||
|
@ -282,8 +283,9 @@ public class ContextUtilities implements ProfileKnowledgeProvider {
|
|||
pu.sortDifferential(sd, p, p.getUrl(), errors, true);
|
||||
}
|
||||
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));
|
||||
}
|
||||
pu.generateSnapshot(sd, p, p.getUrl(), sd.getUserString("webroot"), p.getName());
|
||||
for (ValidationMessage msg : msgs) {
|
||||
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 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 + "#"+getCode();
|
||||
if (hasDisplay())
|
||||
base = base+": "+getDisplay();
|
||||
base = base+": '"+getDisplay()+"'";
|
||||
return base;
|
||||
|
||||
}
|
||||
|
|
|
@ -5968,14 +5968,30 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
}
|
||||
}
|
||||
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]", "")));
|
||||
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() : ""))) {
|
||||
ei.definition = ed;
|
||||
if (ei.slice == null) {
|
||||
ei.index = i;
|
||||
} else {
|
||||
ei.index = sliceOffset;
|
||||
ei.sliceindex = i - (sliceOffset + 1);
|
||||
if (update) {
|
||||
ei.definition = ed;
|
||||
if (ei.slice == null) {
|
||||
ei.index = i;
|
||||
} else {
|
||||
ei.index = sliceOffset;
|
||||
ei.sliceindex = i - (sliceOffset + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (childUnsupportedSlicing) {
|
||||
|
|
Loading…
Reference in New Issue