rework validation policy management in standalone validator
This commit is contained in:
parent
95ec2b00a4
commit
537f758d82
|
@ -887,6 +887,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
|||
}
|
||||
validator.setJurisdiction(jurisdiction);
|
||||
validator.setLogProgress(true);
|
||||
validator.setPolicyAdvisor(policyAdvisor);
|
||||
return validator;
|
||||
}
|
||||
|
||||
|
@ -1259,7 +1260,7 @@ public class ValidationEngine implements IValidatorResourceFetcher, IValidationP
|
|||
public List<StructureDefinition> getImpliedProfilesForResource(IResourceValidator validator, Object appContext,
|
||||
String stackPath, ElementDefinition definition, StructureDefinition structure, Element resource, boolean valid,
|
||||
IMessagingServices msgServices, List<ValidationMessage> messages) {
|
||||
return new BasePolicyAdvisorForFullValidation().getImpliedProfilesForResource(validator, appContext, stackPath,
|
||||
return new BasePolicyAdvisorForFullValidation(ReferenceValidationPolicy.CHECK_VALID).getImpliedProfilesForResource(validator, appContext, stackPath,
|
||||
definition, structure, resource, valid, msgServices, messages);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public class StandAloneValidatorFetcher extends BasePolicyAdvisorForFullValidati
|
|||
private Map<String, NpmPackage> pidMap = new HashMap<>();
|
||||
|
||||
public StandAloneValidatorFetcher(FilesystemPackageCacheManager pcm, IWorkerContext context, IPackageInstaller installer) {
|
||||
super();
|
||||
super(ReferenceValidationPolicy.IGNORE);
|
||||
this.pcm = pcm;
|
||||
this.context = context;
|
||||
this.installer = installer;
|
||||
|
@ -74,7 +74,7 @@ public class StandAloneValidatorFetcher extends BasePolicyAdvisorForFullValidati
|
|||
Object appContext,
|
||||
String path,
|
||||
String url) {
|
||||
return ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS;
|
||||
return ReferenceValidationPolicy.IGNORE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -534,6 +534,7 @@ public class ValidationService {
|
|||
StandAloneValidatorFetcher fetcher = new StandAloneValidatorFetcher(validationEngine.getPcm(), validationEngine.getContext(), validationEngine);
|
||||
validationEngine.setFetcher(fetcher);
|
||||
validationEngine.getContext().setLocator(fetcher);
|
||||
validationEngine.setPolicyAdvisor(fetcher);
|
||||
}
|
||||
validationEngine.getBundleValidationRules().addAll(cliContext.getBundleValidationRules());
|
||||
validationEngine.setJurisdiction(CodeSystemUtilities.readCoding(cliContext.getJurisdiction()));
|
||||
|
|
|
@ -27,10 +27,17 @@ import org.hl7.fhir.utilities.validation.ValidationMessage;
|
|||
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
|
||||
|
||||
public class BasePolicyAdvisorForFullValidation implements IValidationPolicyAdvisor {
|
||||
|
||||
private ReferenceValidationPolicy refpol = ReferenceValidationPolicy.CHECK_VALID;
|
||||
|
||||
public BasePolicyAdvisorForFullValidation(ReferenceValidationPolicy refpol) {
|
||||
super();
|
||||
this.refpol = refpol;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReferenceValidationPolicy policyForReference(IResourceValidator validator, Object appContext, String path, String url) {
|
||||
return ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS;
|
||||
return refpol;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -596,7 +596,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
private boolean noBindingMsgSuppressed;
|
||||
private Map<String, Element> fetchCache = new HashMap<>();
|
||||
private HashMap<Element, ResourceValidationTracker> resourceTracker = new HashMap<>();
|
||||
private IValidationPolicyAdvisor policyAdvisor = new BasePolicyAdvisorForFullValidation();
|
||||
private IValidationPolicyAdvisor policyAdvisor = new BasePolicyAdvisorForFullValidation(ReferenceValidationPolicy.CHECK_VALID);
|
||||
long time = 0;
|
||||
long start = 0;
|
||||
long lastlog = 0;
|
||||
|
|
|
@ -894,7 +894,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
|||
public List<StructureDefinition> getImpliedProfilesForResource(IResourceValidator validator, Object appContext,
|
||||
String stackPath, ElementDefinition definition, StructureDefinition structure, Element resource, boolean valid,
|
||||
IMessagingServices msgServices, List<ValidationMessage> messages) {
|
||||
return new BasePolicyAdvisorForFullValidation().getImpliedProfilesForResource(validator, appContext, stackPath,
|
||||
return new BasePolicyAdvisorForFullValidation(ReferenceValidationPolicy.CHECK_VALID).getImpliedProfilesForResource(validator, appContext, stackPath,
|
||||
definition, structure, resource, valid, msgServices, messages);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue