mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-03-02 09:29:13 +00:00
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:
parent
9acaeeb6e3
commit
eb23fcc5e4
@ -101,7 +101,7 @@ import ca.uhn.fhir.parser.DataFormatException;
|
|||||||
|
|
||||||
public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerContext, ProfileKnowledgeProvider {
|
public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerContext, ProfileKnowledgeProvider {
|
||||||
|
|
||||||
public class PackageResourceLoader extends CanonicalResourceProxy {
|
public static class PackageResourceLoader extends CanonicalResourceProxy {
|
||||||
|
|
||||||
private String filename;
|
private String filename;
|
||||||
private IContextResourceLoader loader;
|
private IContextResourceLoader loader;
|
||||||
@ -429,7 +429,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||||||
loadedPackages.add(pi.id()+"#"+pi.version());
|
loadedPackages.add(pi.id()+"#"+pi.version());
|
||||||
|
|
||||||
|
|
||||||
if (types.length == 0 && loader != null) {
|
if ((types == null || types.length == 0) && loader != null) {
|
||||||
types = loader.getTypes();
|
types = loader.getTypes();
|
||||||
}
|
}
|
||||||
if (VersionUtilities.isR2Ver(pi.fhirVersion()) || !pi.canLazyLoad()) {
|
if (VersionUtilities.isR2Ver(pi.fhirVersion()) || !pi.canLazyLoad()) {
|
||||||
|
@ -132,8 +132,6 @@ public interface IResourceValidator {
|
|||||||
OPTIONAL, REQUIRED, PROHIBITED
|
OPTIONAL, REQUIRED, PROHIBITED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* how much to check displays for coded elements
|
* how much to check displays for coded elements
|
||||||
* @return
|
* @return
|
||||||
@ -214,6 +212,8 @@ public interface IResourceValidator {
|
|||||||
public boolean isCrumbTrails();
|
public boolean isCrumbTrails();
|
||||||
public void setCrumbTrails(boolean crumbTrails);
|
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
|
* Bundle validation rules allow for requesting particular entries in a bundle get validated against particular profiles
|
||||||
@ -223,6 +223,7 @@ public interface IResourceValidator {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public List<BundleValidationRule> getBundleValidationRules();
|
public List<BundleValidationRule> getBundleValidationRules();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate suite
|
* Validate suite
|
||||||
*
|
*
|
||||||
|
@ -147,13 +147,22 @@ public class VersionUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean versionsCompatible(String v1, String v2) {
|
public static boolean versionsCompatible(String v1, String v2) {
|
||||||
String mm1 = getMajMin(v1);
|
String[] v1l = v1.split("\\|");
|
||||||
String mm2 = getMajMin(v2);
|
String[] v2l = v2.split("\\|");
|
||||||
if (mm1 == null || mm2 == null) {
|
for (String vs1 : v1l) {
|
||||||
return false;
|
for (String vs2 : v2l) {
|
||||||
} else {
|
String mm1 = getMajMin(vs1);
|
||||||
return mm1.equals(mm2);
|
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) {
|
public static boolean isCorePackage(String s) {
|
||||||
|
@ -365,6 +365,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||||||
private ProfileUtilities profileUtilities;
|
private ProfileUtilities profileUtilities;
|
||||||
private boolean crumbTrails;
|
private boolean crumbTrails;
|
||||||
private List<BundleValidationRule> bundleValidationRules = new ArrayList<>();
|
private List<BundleValidationRule> bundleValidationRules = new ArrayList<>();
|
||||||
|
private boolean validateValueSetCodesOnTxServer;
|
||||||
|
|
||||||
public InstanceValidator(IWorkerContext theContext, IEvaluationContext hostServices) {
|
public InstanceValidator(IWorkerContext theContext, IEvaluationContext hostServices) {
|
||||||
super(theContext);
|
super(theContext);
|
||||||
@ -4824,4 +4825,14 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||||||
return bundleValidationRules ;
|
return bundleValidationRules ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValidateValueSetCodesOnTxServer() {
|
||||||
|
return validateValueSetCodesOnTxServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setValidateValueSetCodesOnTxServer(boolean value) {
|
||||||
|
this.validateValueSetCodesOnTxServer = value;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -114,7 +114,7 @@ public class ValueSetValidator extends BaseValidator {
|
|||||||
}
|
}
|
||||||
cc++;
|
cc++;
|
||||||
}
|
}
|
||||||
if (batch.size() > 0) {
|
if (parent.isValidateValueSetCodesOnTxServer() && batch.size() > 0) {
|
||||||
long t = System.currentTimeMillis();
|
long t = System.currentTimeMillis();
|
||||||
if (parent.isDebug()) {
|
if (parent.isDebug()) {
|
||||||
System.out.println(" : Validate "+batch.size()+" codes from "+system+" for "+vsid);
|
System.out.println(" : Validate "+batch.size()+" codes from "+system+" for "+vsid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user