More stability on tests + fix questionnaire renderer problem + add SearchParameter derivation validation
This commit is contained in:
parent
0c7cde13e2
commit
e1e994704d
|
@ -111,6 +111,11 @@ public class TerminologyClientR2 implements TerminologyClient {
|
|||
public Parameters lookupCode(Map<String, String> params) throws FHIRException {
|
||||
return (Parameters) VersionConvertor_10_50.convertResource(client.lookupCode(params));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRetryCount() throws FHIRException {
|
||||
return client.getRetryCount();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -111,5 +111,10 @@ public class TerminologyClientR3 implements TerminologyClient {
|
|||
public Parameters lookupCode(Map<String, String> params) throws FHIRException {
|
||||
return (Parameters) VersionConvertor_30_50.convertResource(client.lookupCode(params), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRetryCount() throws FHIRException {
|
||||
return client.getRetryCount();
|
||||
}
|
||||
|
||||
}
|
|
@ -112,5 +112,10 @@ public class TerminologyClientR4 implements TerminologyClient {
|
|||
public Parameters lookupCode(Map<String, String> params) throws FHIRException {
|
||||
return (Parameters) VersionConvertor_40_50.convertResource(client.lookupCode(params));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRetryCount() throws FHIRException {
|
||||
return client.getRetryCount();
|
||||
}
|
||||
|
||||
}
|
|
@ -105,4 +105,9 @@ public class TerminologyClientR5 implements TerminologyClient {
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRetryCount() throws FHIRException {
|
||||
return client.getRetryCount();
|
||||
}
|
||||
|
||||
}
|
|
@ -1393,12 +1393,24 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
|
||||
|
||||
protected String tail(String url) {
|
||||
if (Utilities.noString(url)) {
|
||||
return "noname";
|
||||
if (Utilities.noString(url)) {
|
||||
return "noname";
|
||||
}
|
||||
if (url.contains("/")) {
|
||||
return url.substring(url.lastIndexOf("/")+1);
|
||||
}
|
||||
return url;
|
||||
}
|
||||
if (url.contains("/")) {
|
||||
return url.substring(url.lastIndexOf("/")+1);
|
||||
|
||||
public int getClientRetryCount() {
|
||||
return txClient == null ? 0 : txClient.getRetryCount();
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
public IWorkerContext setClientRetryCount(int value) {
|
||||
if (txClient != null) {
|
||||
txClient.setRetryCount(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
|
@ -634,5 +634,6 @@ public interface IWorkerContext {
|
|||
|
||||
public boolean hasPackage(String id, String ver);
|
||||
|
||||
|
||||
public int getClientRetryCount();
|
||||
public IWorkerContext setClientRetryCount(int value);
|
||||
}
|
|
@ -253,7 +253,7 @@ public class QuestionnaireRenderer extends TerminologyRenderer {
|
|||
hasExt = renderLogicItem(gen, model.getRows(), q, i) || hasExt;
|
||||
}
|
||||
}
|
||||
XhtmlNode xn = gen.generate(model, context.getDestDir(), 1, null);
|
||||
XhtmlNode xn = gen.generate(model, context.getLocalPrefix(), 1, null);
|
||||
x.getChildNodes().add(xn);
|
||||
return hasExt;
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ public interface TerminologyClient {
|
|||
public Parameters validateVS(Parameters pin) throws FHIRException;
|
||||
public TerminologyClient setTimeout(int i) throws FHIRException;
|
||||
public TerminologyClient setLogger(ToolingClientLogger txLog) throws FHIRException;
|
||||
public int getRetryCount() throws FHIRException;
|
||||
public TerminologyClient setRetryCount(int retryCount) throws FHIRException;
|
||||
public CapabilityStatement getCapabilitiesStatementQuick() throws FHIRException;
|
||||
public Parameters lookupCode(Map<String, String> params) throws FHIRException;
|
||||
|
|
|
@ -502,4 +502,8 @@ public class I18nConstants {
|
|||
public static final String _HAS_CHILDREN__FOR_TYPE__IN_PROFILE__BUT_CANT_FIND_TYPE = "_has_children__for_type__in_profile__but_cant_find_type";
|
||||
public static final String _HAS_NO_CHILDREN__AND_NO_TYPES_IN_PROFILE_ = "_has_no_children__and_no_types_in_profile_";
|
||||
public static final String ALL_OK = "ALL_OK";
|
||||
public static final String SEARCHPARAMETER_NOTFOUND = "SEARCHPARAMETER_NOTFOUND";
|
||||
public static final String SEARCHPARAMETER_BASE_WRONG = "SEARCHPARAMETER_BASE_WRONG";
|
||||
public static final String SEARCHPARAMETER_TYPE_WRONG = "SEARCHPARAMETER_TYPE_WRONG";
|
||||
public static final String SEARCHPARAMETER_EXP_WRONG = "SEARCHPARAMETER_EXP_WRONG";
|
||||
}
|
|
@ -502,4 +502,8 @@ VALIDATION_VAL_ILLEGAL_TYPE_CONSTRAINT = Illegal constraint in profile {0} at pa
|
|||
EXTENSION_EXT_CONTEXT_WRONG_XVER = The extension {0} from FHIR version {3} is not allowed to be used at this point (allowed = {1}; this element is [{2}; this is a warning since contexts may be renamed between FHIR versions)
|
||||
SECURITY_STRING_CONTENT_ERROR = The string value contains embedded HTML tags, which are not allowed for security reasons in this context
|
||||
SECURITY_STRING_CONTENT_WARNING = The string value contains embedded HTML tags. Note that all inputs should be escaped when rendered to HTML as a matter of course
|
||||
ALL_OK = All OK
|
||||
ALL_OK = All OK
|
||||
SEARCHPARAMETER_NOTFOUND = Unable to find the base Search Parameter {0} so can't check that this SearchParameter is a proper derivation from it
|
||||
SEARCHPARAMETER_BASE_WRONG = The base {1} is not listed as a base in the derivedFrom SearchParameter
|
||||
SEARCHPARAMETER_TYPE_WRONG = The type {1} is different to the type {0} in the derivedFrom SearchParameter
|
||||
SEARCHPARAMETER_TYPE_WRONG = The expression "{1}" is different to the expression "{0}" in the derivedFrom SearchParameter, and this likely indicates that the derivation relationship is not valid
|
||||
|
|
|
@ -140,6 +140,7 @@ import org.hl7.fhir.validation.instance.type.BundleValidator;
|
|||
import org.hl7.fhir.validation.instance.type.CodeSystemValidator;
|
||||
import org.hl7.fhir.validation.instance.type.MeasureValidator;
|
||||
import org.hl7.fhir.validation.instance.type.QuestionnaireValidator;
|
||||
import org.hl7.fhir.validation.instance.type.SearchParameterValidator;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.Utilities.DecimalStatus;
|
||||
|
@ -3464,6 +3465,8 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
validateCapabilityStatement(errors, element, stack);
|
||||
} else if (element.getType().equals("CodeSystem")) {
|
||||
new CodeSystemValidator(context, timeTracker).validateCodeSystem(errors, element, stack);
|
||||
} else if (element.getType().equals("SearchParameter")) {
|
||||
new SearchParameterValidator(context, timeTracker).validateSearchParameter(errors, element, stack);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package org.hl7.fhir.validation.instance.type;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.elementmodel.Element;
|
||||
import org.hl7.fhir.r5.model.SearchParameter;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.i18n.I18nConstants;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
|
||||
import org.hl7.fhir.validation.BaseValidator;
|
||||
import org.hl7.fhir.validation.TimeTracker;
|
||||
import org.hl7.fhir.validation.instance.utils.NodeStack;
|
||||
|
||||
public class SearchParameterValidator extends BaseValidator {
|
||||
|
||||
public SearchParameterValidator(IWorkerContext context, TimeTracker timeTracker) {
|
||||
super(context);
|
||||
source = Source.InstanceValidator;
|
||||
this.timeTracker = timeTracker;
|
||||
}
|
||||
|
||||
public void validateSearchParameter(List<ValidationMessage> errors, Element cs, NodeStack stack) {
|
||||
String url = cs.getNamedChildValue("url");
|
||||
String master = cs.getNamedChildValue("derivedFrom");
|
||||
|
||||
if (!Utilities.noString(master)) {
|
||||
SearchParameter sp = context.fetchResource(SearchParameter.class, master);
|
||||
if (warning(errors, IssueType.BUSINESSRULE,stack.getLiteralPath(), sp != null, I18nConstants.SEARCHPARAMETER_NOTFOUND, master)) {
|
||||
// base must be in the master list of base
|
||||
List<Element> bl = cs.getChildren("base");
|
||||
for (Element b : bl) {
|
||||
rule(errors, IssueType.BUSINESSRULE,stack.getLiteralPath(), sp.hasBase(b.primitiveValue()), I18nConstants.SEARCHPARAMETER_BASE_WRONG, master, b.primitiveValue());
|
||||
}
|
||||
rule(errors, IssueType.BUSINESSRULE,stack.getLiteralPath(), !cs.hasChild("type") || sp.getType().toCode().equals(cs.getNamedChildValue("type")), I18nConstants.SEARCHPARAMETER_TYPE_WRONG, master, sp.getType().toCode(), cs.getNamedChildValue("type"));
|
||||
warning(errors, IssueType.BUSINESSRULE,stack.getLiteralPath(), !cs.hasChild("expression") || sp.getExpression().equals(cs.getNamedChildValue("expression")), I18nConstants.SEARCHPARAMETER_EXP_WRONG, master, sp.getExpression(), cs.getNamedChildValue("expression"));
|
||||
// todo: cjeck compositions
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -142,6 +142,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
|||
String testCaseContent = TestingUtilities.loadTestResource("validator", name);
|
||||
|
||||
InstanceValidator val = vCurr.getValidator();
|
||||
val.getContext().setClientRetryCount(4);
|
||||
val.setDebug(false);
|
||||
if (content.has("allowed-extension-domain"))
|
||||
val.getExtensionDomains().add(content.get("allowed-extension-domain").getAsString());
|
||||
|
|
Loading…
Reference in New Issue