more config for validator (#309)

* fix up POMs

* fixes for main build to use packages

* more config for validator

* more options for validation version comparison
This commit is contained in:
Grahame Grieve 2020-08-17 23:53:54 +10:00 committed by GitHub
parent 9acaeeb6e3
commit eb23fcc5e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 11 deletions

View File

@ -101,7 +101,7 @@ import ca.uhn.fhir.parser.DataFormatException;
public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerContext, ProfileKnowledgeProvider {
public class PackageResourceLoader extends CanonicalResourceProxy {
public static class PackageResourceLoader extends CanonicalResourceProxy {
private String filename;
private IContextResourceLoader loader;
@ -429,7 +429,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
loadedPackages.add(pi.id()+"#"+pi.version());
if (types.length == 0 && loader != null) {
if ((types == null || types.length == 0) && loader != null) {
types = loader.getTypes();
}
if (VersionUtilities.isR2Ver(pi.fhirVersion()) || !pi.canLazyLoad()) {

View File

@ -132,8 +132,6 @@ public interface IResourceValidator {
OPTIONAL, REQUIRED, PROHIBITED
}
/**
* how much to check displays for coded elements
* @return
@ -214,6 +212,8 @@ public interface IResourceValidator {
public boolean isCrumbTrails();
public void setCrumbTrails(boolean crumbTrails);
public boolean isValidateValueSetCodesOnTxServer();
public void setValidateValueSetCodesOnTxServer(boolean value);
/**
* Bundle validation rules allow for requesting particular entries in a bundle get validated against particular profiles
@ -223,6 +223,7 @@ public interface IResourceValidator {
* @return
*/
public List<BundleValidationRule> getBundleValidationRules();
/**
* Validate suite
*

View File

@ -147,13 +147,22 @@ public class VersionUtilities {
}
public static boolean versionsCompatible(String v1, String v2) {
String mm1 = getMajMin(v1);
String mm2 = getMajMin(v2);
if (mm1 == null || mm2 == null) {
return false;
} else {
return mm1.equals(mm2);
String[] v1l = v1.split("\\|");
String[] v2l = v2.split("\\|");
for (String vs1 : v1l) {
for (String vs2 : v2l) {
String mm1 = getMajMin(vs1);
String mm2 = getMajMin(vs2);
if (mm1 == null || mm2 == null) {
return false;
} else {
if (mm1.equals(mm2)) {
return true;
}
}
}
}
return false;
}
public static boolean isCorePackage(String s) {

View File

@ -365,6 +365,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
private ProfileUtilities profileUtilities;
private boolean crumbTrails;
private List<BundleValidationRule> bundleValidationRules = new ArrayList<>();
private boolean validateValueSetCodesOnTxServer;
public InstanceValidator(IWorkerContext theContext, IEvaluationContext hostServices) {
super(theContext);
@ -4824,4 +4825,14 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
return bundleValidationRules ;
}
@Override
public boolean isValidateValueSetCodesOnTxServer() {
return validateValueSetCodesOnTxServer;
}
@Override
public void setValidateValueSetCodesOnTxServer(boolean value) {
this.validateValueSetCodesOnTxServer = value;
}
}

View File

@ -114,7 +114,7 @@ public class ValueSetValidator extends BaseValidator {
}
cc++;
}
if (batch.size() > 0) {
if (parent.isValidateValueSetCodesOnTxServer() && batch.size() > 0) {
long t = System.currentTimeMillis();
if (parent.isDebug()) {
System.out.println(" : Validate "+batch.size()+" codes from "+system+" for "+vsid);