Address review comments.

This commit is contained in:
Diederik Muylwyk 2019-09-26 20:15:55 -04:00
parent b6400764c4
commit 5f17fb30b4
10 changed files with 84 additions and 21 deletions

View File

@ -9,7 +9,6 @@ import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc;
import ca.uhn.fhir.jpa.dao.TransactionProcessor;
import ca.uhn.fhir.jpa.dao.dstu3.TransactionProcessorVersionAdapterDstu3;
import ca.uhn.fhir.jpa.provider.GraphQLProvider;
import ca.uhn.fhir.jpa.provider.dstu3.TerminologyUploaderProviderDstu3;
import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorDstu3;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryDstu3;
@ -21,6 +20,7 @@ import ca.uhn.fhir.jpa.util.ResourceCountCache;
import ca.uhn.fhir.jpa.validation.JpaValidationSupportChainDstu3;
import ca.uhn.fhir.validation.IValidatorModule;
import org.apache.commons.lang3.time.DateUtils;
import org.hl7.fhir.dstu3.hapi.ctx.DefaultProfileValidationSupport;
import org.hl7.fhir.dstu3.hapi.ctx.IValidationSupport;
import org.hl7.fhir.dstu3.hapi.validation.CachingValidationSupport;
import org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator;
@ -99,6 +99,11 @@ public class BaseDstu3Config extends BaseConfig {
return val;
}
@Bean
public DefaultProfileValidationSupport defaultProfileValidationSupport() {
return new DefaultProfileValidationSupport();
}
@Bean
public JpaValidationSupportChainDstu3 jpaValidationSupportChain() {
return new JpaValidationSupportChainDstu3();

View File

@ -8,7 +8,7 @@ import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc;
import ca.uhn.fhir.jpa.dao.TransactionProcessor;
import ca.uhn.fhir.jpa.dao.r4.TransactionProcessorVersionAdapterR4;
import ca.uhn.fhir.jpa.graphql.JpaStorageServices;
import ca.uhn.fhir.jpa.provider.GraphQLProvider;
import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorR4;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.jpa.searchparam.registry.SearchParamRegistryR4;
@ -20,14 +20,12 @@ import ca.uhn.fhir.jpa.util.ResourceCountCache;
import ca.uhn.fhir.jpa.validation.JpaValidationSupportChainR4;
import ca.uhn.fhir.validation.IValidatorModule;
import org.apache.commons.lang3.time.DateUtils;
import org.hl7.fhir.r4.hapi.ctx.DefaultProfileValidationSupport;
import org.hl7.fhir.r4.hapi.ctx.IValidationSupport;
import ca.uhn.fhir.jpa.provider.GraphQLProvider;
import org.hl7.fhir.r4.hapi.validation.CachingValidationSupport;
import org.hl7.fhir.r4.hapi.validation.FhirInstanceValidator;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.utils.GraphQLEngine;
import org.hl7.fhir.r5.utils.IResourceValidator;
import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -102,6 +100,11 @@ public class BaseR4Config extends BaseConfig {
return val;
}
@Bean
public DefaultProfileValidationSupport defaultProfileValidationSupport() {
return new DefaultProfileValidationSupport();
}
@Bean
public JpaValidationSupportChainR4 jpaValidationSupportChain() {
return new JpaValidationSupportChainR4();

View File

@ -20,6 +20,7 @@ import ca.uhn.fhir.jpa.util.ResourceCountCache;
import ca.uhn.fhir.jpa.validation.JpaValidationSupportChainR5;
import ca.uhn.fhir.validation.IValidatorModule;
import org.apache.commons.lang3.time.DateUtils;
import org.hl7.fhir.r5.hapi.ctx.DefaultProfileValidationSupport;
import org.hl7.fhir.r5.hapi.ctx.IValidationSupport;
import org.hl7.fhir.r5.hapi.validation.CachingValidationSupport;
import org.hl7.fhir.r5.hapi.validation.FhirInstanceValidator;
@ -99,6 +100,11 @@ public class BaseR5Config extends BaseConfig {
return val;
}
@Bean
public DefaultProfileValidationSupport defaultProfileValidationSupport() {
return new DefaultProfileValidationSupport();
}
@Bean
public JpaValidationSupportChainR5 jpaValidationSupportChain() {
return new JpaValidationSupportChainR5();

View File

@ -150,18 +150,26 @@ public class DaoConfig {
private StoreMetaSourceInformationEnum myStoreMetaSourceInformation = StoreMetaSourceInformationEnum.SOURCE_URI_AND_REQUEST_ID;
/**
* Do not change default of {@code true}!
*
* @since 4.1.0
*/
private boolean myPreExpandValueSets = true;
/**
* Do not change default of {@code 0}!
*
* @since 4.1.0
*/
private int myPreExpandValueSetsDefaultOffset = 0;
/**
* Do not change default of {@code 1000}!
*
* @since 4.1.0
*/
private int myPreExpandValueSetsDefaultCount = 1000;
/**
* Do not change default of {@code 1000}!
*
* @since 4.1.0
*/
private int myPreExpandValueSetsMaxCount = 1000;
@ -1699,6 +1707,8 @@ public class DaoConfig {
* <p>
* The default value for this setting is {@code true}.
* </p>
*
* @since 4.1.0
*/
public boolean isPreExpandValueSets() {
return myPreExpandValueSets;
@ -1712,6 +1722,8 @@ public class DaoConfig {
* <p>
* The default value for this setting is {@code true}.
* </p>
*
* @since 4.1.0
*/
public void setPreExpandValueSets(boolean thePreExpandValueSets) {
myPreExpandValueSets = thePreExpandValueSets;
@ -1725,6 +1737,8 @@ public class DaoConfig {
* <p>
* The default value for this setting is {@code 0}.
* </p>
*
* @since 4.1.0
*/
public int getPreExpandValueSetsDefaultOffset() {
return myPreExpandValueSetsDefaultOffset;
@ -1738,6 +1752,8 @@ public class DaoConfig {
* <p>
* The default value for this setting is {@code 1000}.
* </p>
*
* @since 4.1.0
*/
public int getPreExpandValueSetsDefaultCount() {
return myPreExpandValueSetsDefaultCount;
@ -1755,6 +1771,8 @@ public class DaoConfig {
* <p>
* The default value for this setting is {@code 1000}.
* </p>
*
* @since 4.1.0
*/
public void setPreExpandValueSetsDefaultCount(int thePreExpandValueSetsDefaultCount) {
myPreExpandValueSetsDefaultCount = Math.min(thePreExpandValueSetsDefaultCount, getPreExpandValueSetsMaxCount());
@ -1768,6 +1786,8 @@ public class DaoConfig {
* <p>
* The default value for this setting is {@code 1000}.
* </p>
*
* @since 4.1.0
*/
public int getPreExpandValueSetsMaxCount() {
return myPreExpandValueSetsMaxCount;
@ -1786,6 +1806,8 @@ public class DaoConfig {
* <p>
* The default value for this setting is {@code 1000}.
* </p>
*
* @since 4.1.0
*/
public void setPreExpandValueSetsMaxCount(int thePreExpandValueSetsMaxCount) {
myPreExpandValueSetsMaxCount = thePreExpandValueSetsMaxCount;

View File

@ -32,6 +32,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.util.ElementUtil;
import org.apache.commons.codec.binary.StringUtils;
import org.hl7.fhir.convertors.VersionConvertor_30_40;
import org.hl7.fhir.dstu3.hapi.ctx.DefaultProfileValidationSupport;
import org.hl7.fhir.dstu3.hapi.ctx.HapiWorkerContext;
import org.hl7.fhir.dstu3.hapi.ctx.IValidationSupport;
import org.hl7.fhir.dstu3.model.*;
@ -63,9 +64,13 @@ public class FhirResourceDaoValueSetDstu3 extends FhirResourceDaoDstu3<ValueSet>
@Autowired
private IHapiTerminologySvc myHapiTerminologySvc;
@Autowired
private DefaultProfileValidationSupport myDefaultProfileValidationSupport;
@Autowired
@Qualifier("myJpaValidationSupportChainDstu3")
private IValidationSupport myValidationSupport;
@Autowired
private IFhirResourceDaoCodeSystem<CodeSystem, Coding, CodeableConcept> myCodeSystemDao;
@ -314,11 +319,15 @@ public class FhirResourceDaoValueSetDstu3 extends FhirResourceDaoDstu3<ValueSet>
if (theId != null) {
vs = read(theId, theRequestDetails);
} else if (haveIdentifierParam) {
vs = myValidationSupport.fetchResource(getContext(), ValueSet.class, theValueSetIdentifier.getValue());
vs = myDefaultProfileValidationSupport.fetchValueSet(getContext(), theValueSetIdentifier.getValue());
if (vs == null) {
throw new InvalidRequestException("Unknown ValueSet identifier: " + theValueSetIdentifier.getValue());
vs = myValidationSupport.fetchValueSet(getContext(), theValueSetIdentifier.getValue());
if (vs == null) {
throw new InvalidRequestException("Unknown ValueSet identifier: " + theValueSetIdentifier.getValue());
}
} else {
isBuiltInValueSet = true;
}
isBuiltInValueSet = true;
} else {
if (theCode == null || theCode.isEmpty()) {
throw new InvalidRequestException("Either ValueSet ID or ValueSet identifier or system and code must be provided. Unable to validate.");

View File

@ -33,6 +33,7 @@ import org.apache.commons.codec.binary.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.hapi.ctx.DefaultProfileValidationSupport;
import org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext;
import org.hl7.fhir.r4.hapi.ctx.IValidationSupport;
import org.hl7.fhir.r4.model.*;
@ -57,6 +58,9 @@ public class FhirResourceDaoValueSetR4 extends FhirResourceDaoR4<ValueSet> imple
@Autowired
private IHapiTerminologySvc myHapiTerminologySvc;
@Autowired
private DefaultProfileValidationSupport myDefaultProfileValidationSupport;
@Autowired
@Qualifier("myJpaValidationSupportChainR4")
private IValidationSupport myValidationSupport;
@ -310,11 +314,15 @@ public class FhirResourceDaoValueSetR4 extends FhirResourceDaoR4<ValueSet> imple
if (theId != null) {
vs = read(theId, theRequestDetails);
} else if (haveIdentifierParam) {
vs = myValidationSupport.fetchResource(getContext(), ValueSet.class, theValueSetIdentifier.getValue());
vs = myDefaultProfileValidationSupport.fetchValueSet(getContext(), theValueSetIdentifier.getValue());
if (vs == null) {
throw new InvalidRequestException("Unknown ValueSet identifier: " + theValueSetIdentifier.getValue());
vs = myValidationSupport.fetchValueSet(getContext(), theValueSetIdentifier.getValue());
if (vs == null) {
throw new InvalidRequestException("Unknown ValueSet identifier: " + theValueSetIdentifier.getValue());
}
} else {
isBuiltInValueSet = true;
}
isBuiltInValueSet = true;
} else {
if (theCode == null || theCode.isEmpty()) {
throw new InvalidRequestException("Either ValueSet ID or ValueSet identifier or system and code must be provided. Unable to validate.");

View File

@ -33,6 +33,7 @@ import org.apache.commons.codec.binary.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r5.hapi.ctx.DefaultProfileValidationSupport;
import org.hl7.fhir.r5.hapi.ctx.HapiWorkerContext;
import org.hl7.fhir.r5.hapi.ctx.IValidationSupport;
import org.hl7.fhir.r5.model.*;
@ -57,6 +58,9 @@ public class FhirResourceDaoValueSetR5 extends FhirResourceDaoR5<ValueSet> imple
@Autowired
private IHapiTerminologySvc myHapiTerminologySvc;
@Autowired
private DefaultProfileValidationSupport myDefaultProfileValidationSupport;
@Autowired
@Qualifier("myJpaValidationSupportChainR5")
private IValidationSupport myValidationSupport;
@ -316,11 +320,15 @@ public class FhirResourceDaoValueSetR5 extends FhirResourceDaoR5<ValueSet> imple
if (theId != null) {
vs = read(theId, theRequestDetails);
} else if (haveIdentifierParam) {
vs = myValidationSupport.fetchResource(getContext(), ValueSet.class, theValueSetIdentifier.getValue());
vs = myDefaultProfileValidationSupport.fetchValueSet(getContext(), theValueSetIdentifier.getValue());
if (vs == null) {
throw new InvalidRequestException("Unknown ValueSet identifier: " + theValueSetIdentifier.getValue());
vs = myValidationSupport.fetchValueSet(getContext(), theValueSetIdentifier.getValue());
if (vs == null) {
throw new InvalidRequestException("Unknown ValueSet identifier: " + theValueSetIdentifier.getValue());
}
} else {
isBuiltInValueSet = true;
}
isBuiltInValueSet = true;
} else {
if (theCode == null || theCode.isEmpty()) {
throw new InvalidRequestException("Either ValueSet ID or ValueSet identifier or system and code must be provided. Unable to validate.");

View File

@ -38,7 +38,8 @@ public class JpaValidationSupportChainDstu3 extends ValidationSupportChain {
@Autowired
@Qualifier("myJpaValidationSupportDstu3")
public ca.uhn.fhir.jpa.dao.dstu3.IJpaValidationSupportDstu3 myJpaValidationSupportDstu3;
private DefaultProfileValidationSupport myDefaultProfileValidationSupport = new DefaultProfileValidationSupport();
@Autowired
private DefaultProfileValidationSupport myDefaultProfileValidationSupport;
@Autowired
private IHapiTerminologySvcDstu3 myTerminologyService;
@Autowired

View File

@ -20,10 +20,8 @@ package ca.uhn.fhir.jpa.validation;
* #L%
*/
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.term.IHapiTerminologySvcR4;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.hapi.ctx.DefaultProfileValidationSupport;
import org.hl7.fhir.r4.hapi.validation.SnapshotGeneratingValidationSupport;
@ -32,11 +30,13 @@ import org.hl7.fhir.r4.model.StructureDefinition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import ca.uhn.fhir.jpa.term.IHapiTerminologySvcR4;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
public class JpaValidationSupportChainR4 extends ValidationSupportChain {
private DefaultProfileValidationSupport myDefaultProfileValidationSupport = new DefaultProfileValidationSupport();
@Autowired
private DefaultProfileValidationSupport myDefaultProfileValidationSupport;
@Autowired
private FhirContext myFhirContext;

View File

@ -35,7 +35,8 @@ import javax.annotation.PreDestroy;
public class JpaValidationSupportChainR5 extends ValidationSupportChain {
private DefaultProfileValidationSupport myDefaultProfileValidationSupport = new DefaultProfileValidationSupport();
@Autowired
private DefaultProfileValidationSupport myDefaultProfileValidationSupport;
@Autowired
private FhirContext myFhirContext;