extends B
}
@VisibleForTesting
- public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) {
- myDaoConfig = theDaoConfig;
+ public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) {
+ myStorageSettings = theStorageSettings;
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java
index ae16e15e3c7..489eb8b68f9 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FulltextSearchSvcImpl.java
@@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.dao;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
import ca.uhn.fhir.jpa.dao.search.ExtendedHSearchClauseBuilder;
import ca.uhn.fhir.jpa.dao.search.ExtendedHSearchIndexExtractor;
@@ -31,7 +31,6 @@ import ca.uhn.fhir.jpa.dao.search.ExtendedHSearchSearchBuilder;
import ca.uhn.fhir.jpa.dao.search.IHSearchSortHelper;
import ca.uhn.fhir.jpa.dao.search.LastNOperation;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.model.search.ExtendedHSearchIndexData;
import ca.uhn.fhir.jpa.search.autocomplete.ValueSetAutocompleteOptions;
@@ -84,7 +83,11 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FulltextSearchSvcImpl.class);
private static final int DEFAULT_MAX_NON_PAGED_SIZE = 500;
-
+ final private ExtendedHSearchSearchBuilder myAdvancedIndexQueryBuilder = new ExtendedHSearchSearchBuilder();
+ @Autowired
+ ISearchParamExtractor mySearchParamExtractor;
+ @Autowired
+ IIdHelperService myIdHelperService;
@PersistenceContext(type = PersistenceContextType.TRANSACTION)
private EntityManager myEntityManager;
@Autowired
@@ -94,20 +97,9 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
@Autowired
private ISearchParamRegistry mySearchParamRegistry;
@Autowired
- private DaoConfig myDaoConfig;
- @Autowired
- ISearchParamExtractor mySearchParamExtractor;
- @Autowired
- IIdHelperService myIdHelperService;
-
- @Autowired
- ModelConfig myModelConfig;
-
+ private JpaStorageSettings myStorageSettings;
@Autowired
private IHSearchSortHelper myExtendedFulltextSortHelper;
-
- final private ExtendedHSearchSearchBuilder myAdvancedIndexQueryBuilder = new ExtendedHSearchSearchBuilder();
-
@Autowired(required = false)
private IHSearchEventListener myHSearchEventListener;
@@ -120,12 +112,13 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
super();
}
+ @Override
public ExtendedHSearchIndexData extractLuceneIndexData(IBaseResource theResource, ResourceIndexedSearchParams theNewParams) {
String resourceType = myFhirContext.getResourceType(theResource);
ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams(resourceType);
ExtendedHSearchIndexExtractor extractor = new ExtendedHSearchIndexExtractor(
- myDaoConfig, myFhirContext, activeSearchParams, mySearchParamExtractor, myModelConfig);
- return extractor.extract(theResource,theNewParams);
+ myStorageSettings, myFhirContext, activeSearchParams, mySearchParamExtractor);
+ return extractor.extract(theResource, theNewParams);
}
@Override
@@ -134,7 +127,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
// keep this in sync with the guts of doSearch
boolean requiresHibernateSearchAccess = myParams.containsKey(Constants.PARAM_CONTENT) || myParams.containsKey(Constants.PARAM_TEXT) || myParams.isLastN();
- requiresHibernateSearchAccess |= myDaoConfig.isAdvancedHSearchIndexing() && myAdvancedIndexQueryBuilder.isSupportsSomeOf(myParams);
+ requiresHibernateSearchAccess |= myStorageSettings.isAdvancedHSearchIndexing() && myAdvancedIndexQueryBuilder.isSupportsSomeOf(myParams);
return requiresHibernateSearchAccess;
}
@@ -186,10 +179,10 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
private SearchQueryOptionsStep, Long, SearchLoadingOptionsStep, ?, ?> getSearchQueryOptionsStep(
- String theResourceType, SearchParameterMap theParams, IResourcePersistentId theReferencingPid) {
+ String theResourceType, SearchParameterMap theParams, IResourcePersistentId theReferencingPid) {
dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH);
- var query= getSearchSession().search(ResourceTable.class)
+ var query = getSearchSession().search(ResourceTable.class)
// The document id is the PK which is pid. We use this instead of _myId to avoid fetching the doc body.
.select(
// adapt the String docRef.id() to the Long that it really is.
@@ -203,7 +196,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
if (theParams.getSort() != null) {
query.sort(
- f -> myExtendedFulltextSortHelper.getSortClauses(f, theParams.getSort(), theResourceType) );
+ f -> myExtendedFulltextSortHelper.getSortClauses(f, theParams.getSort(), theResourceType));
// indicate parameter was processed
theParams.setSort(null);
@@ -216,7 +209,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
private PredicateFinalStep buildWhereClause(SearchPredicateFactory f, String theResourceType,
SearchParameterMap theParams, IResourcePersistentId theReferencingPid) {
return f.bool(b -> {
- ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myModelConfig, b, f);
+ ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myStorageSettings, b, f);
/*
* Handle _content parameter (resource body content)
@@ -249,7 +242,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
/*
* Handle other supported parameters
*/
- if (myDaoConfig.isAdvancedHSearchIndexing() && theParams.getEverythingMode() == null) {
+ if (myStorageSettings.isAdvancedHSearchIndexing() && theParams.getEverythingMode() == null) {
myAdvancedIndexQueryBuilder.addAndConsumeAdvancedQueryClauses(builder, theResourceType, theParams, mySearchParamRegistry);
}
//DROP EARLY HERE IF BOOL IS EMPTY?
@@ -332,7 +325,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
validateHibernateSearchIsEnabled();
ensureElastic();
- ValueSetAutocompleteSearch autocomplete = new ValueSetAutocompleteSearch(myFhirContext, myModelConfig, getSearchSession());
+ ValueSetAutocompleteSearch autocomplete = new ValueSetAutocompleteSearch(myFhirContext, myStorageSettings, getSearchSession());
dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH);
return autocomplete.search(theOptions);
@@ -340,13 +333,13 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
/**
* Throws an error if configured with Lucene.
- *
+ *
* Some features only work with Elasticsearch.
* Lastn and the autocomplete search use nested aggregations which are Elasticsearch-only
*/
private void ensureElastic() {
try {
- getSearchSession().scope( ResourceTable.class )
+ getSearchSession().scope(ResourceTable.class)
.aggregation()
.extension(ElasticsearchExtension.get());
} catch (SearchException e) {
@@ -360,7 +353,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
public List lastN(SearchParameterMap theParams, Integer theMaximumResults) {
ensureElastic();
dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH);
- List pidList = new LastNOperation(getSearchSession(), myFhirContext, myModelConfig, mySearchParamRegistry)
+ List pidList = new LastNOperation(getSearchSession(), myFhirContext, myStorageSettings, mySearchParamRegistry)
.executeLastN(theParams, theMaximumResults);
return convertLongsToResourcePersistentIds(pidList);
}
@@ -384,7 +377,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
// order resource projections as per thePids
ArrayList pidList = new ArrayList<>(thePids);
List orderedAsPidsResourceDataList = rawResourceDataList.stream()
- .sorted( Ordering.explicit(pidList).onResultOf(ExtendedHSearchResourceProjection::getPid) ).collect( Collectors.toList() );
+ .sorted(Ordering.explicit(pidList).onResultOf(ExtendedHSearchResourceProjection::getPid)).collect(Collectors.toList());
return resourceProjectionsToResources(orderedAsPidsResourceDataList);
}
@@ -400,7 +393,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
private CompositeProjectionOptionsStep, ExtendedHSearchResourceProjection> buildResourceSelectClause(
- SearchProjectionFactory f) {
+ SearchProjectionFactory f) {
return f.composite(
ExtendedHSearchResourceProjection::new,
f.field("myId", Long.class),
@@ -433,12 +426,12 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
dispatchEvent(IHSearchEventListener.HSearchEventType.SEARCH);
var query = getSearchSession().search(ResourceTable.class)
- .select(this::buildResourceSelectClause)
- .where(f -> buildWhereClause(f, theResourceType, theParams, null));
+ .select(this::buildResourceSelectClause)
+ .where(f -> buildWhereClause(f, theResourceType, theParams, null));
if (theParams.getSort() != null) {
query.sort(
- f -> myExtendedFulltextSortHelper.getSortClauses(f, theParams.getSort(), theResourceType) );
+ f -> myExtendedFulltextSortHelper.getSortClauses(f, theParams.getSort(), theResourceType));
}
List extendedLuceneResourceProjections = query.fetchHits(offset, limit);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoObservation.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoObservation.java
index fc601168c52..147f87a3ed9 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoObservation.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoObservation.java
@@ -99,7 +99,7 @@ public class JpaResourceDaoObservation extends BaseHapi
ResourceTable retVal = super.updateEntity(theRequest, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion,
theTransactionDetails, theForceUpdate, theCreateNewHistoryEntry);
- if (getConfig().isLastNEnabled()) {
+ if (getStorageSettings().isLastNEnabled()) {
if (!retVal.isUnchangedInCurrentOperation()) {
if (retVal.getDeleted() == null) {
// Update indexes here for LastN operation.
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoValueSet.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoValueSet.java
index 63f0afc4ff5..fd4663f8f16 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoValueSet.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaResourceDaoValueSet.java
@@ -95,7 +95,7 @@ public class JpaResourceDaoValueSet extends BaseHapiFhi
if (isAutocompleteExtension) {
// this is a funky extension for NIH. Do our own thing and return.
- ValueSetAutocompleteOptions options = ValueSetAutocompleteOptions.validateAndParseOptions(myDaoConfig, theContext, theFilter, theCount, theId, theUrl, theValueSet);
+ ValueSetAutocompleteOptions options = ValueSetAutocompleteOptions.validateAndParseOptions(myStorageSettings, theContext, theFilter, theCount, theId, theUrl, theValueSet);
if (myFulltextSearch == null || myFulltextSearch.isDisabled()) {
throw new InvalidRequestException(Msg.code(2083) + " Autocomplete is not supported on this server, as the fulltext search service is not configured.");
} else {
@@ -119,7 +119,7 @@ public class JpaResourceDaoValueSet extends BaseHapiFhi
throw new InvalidRequestException(Msg.code(1134) + "$expand must EITHER be invoked at the instance level, or have a url specified, or have a ValueSet specified. Can not combine these options.");
}
- ValueSetExpansionOptions options = createValueSetExpansionOptions(myDaoConfig, theOffset, theCount, theIncludeHierarchy, theFilter, theDisplayLanguage);
+ ValueSetExpansionOptions options = createValueSetExpansionOptions(myStorageSettings, theOffset, theCount, theIncludeHierarchy, theFilter, theDisplayLanguage);
IValidationSupport.ValueSetExpansionOutcome outcome;
if (haveId) {
@@ -235,7 +235,7 @@ public class JpaResourceDaoValueSet extends BaseHapiFhi
boolean theUpdateVersion, TransactionDetails theTransactionDetails, boolean theForceUpdate, boolean theCreateNewHistoryEntry) {
ResourceTable retVal = super.updateEntity(theRequestDetails, theResource, theEntity, theDeletedTimestampOrNull, thePerformIndexing, theUpdateVersion, theTransactionDetails, theForceUpdate, theCreateNewHistoryEntry);
- if (getConfig().isPreExpandValueSets() && !retVal.isUnchangedInCurrentOperation()) {
+ if (getStorageSettings().isPreExpandValueSets() && !retVal.isUnchangedInCurrentOperation()) {
if (retVal.getDeleted() == null) {
ValueSet valueSet = myVersionCanonicalizer.valueSetToCanonical(theResource);
myTerminologySvc.storeTermValueSet(retVal, valueSet);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaStorageResourceParser.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaStorageResourceParser.java
index 45e53ec091a..bc823c92a07 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaStorageResourceParser.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/JpaStorageResourceParser.java
@@ -24,7 +24,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.IDao;
import ca.uhn.fhir.jpa.dao.data.IResourceHistoryTableDao;
import ca.uhn.fhir.jpa.entity.PartitionEntity;
@@ -59,7 +59,6 @@ import org.hl7.fhir.instance.model.api.IBaseCoding;
import org.hl7.fhir.instance.model.api.IBaseMetaType;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
-import org.hl7.fhir.r4.model.Bundle;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -82,7 +81,7 @@ public class JpaStorageResourceParser implements IJpaStorageResourceParser {
@Autowired
private FhirContext myContext;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@Autowired
private IResourceHistoryTableDao myResourceHistoryTableDao;
@Autowired
@@ -115,7 +114,7 @@ public class JpaStorageResourceParser implements IJpaStorageResourceParser {
resourceBytes = history.getResource();
resourceText = history.getResourceTextVc();
resourceEncoding = history.getEncoding();
- switch (myDaoConfig.getTagStorageMode()) {
+ switch (myStorageSettings.getTagStorageMode()) {
case VERSIONED:
default:
if (history.isHasTags()) {
@@ -158,7 +157,7 @@ public class JpaStorageResourceParser implements IJpaStorageResourceParser {
resourceBytes = history.getResource();
resourceEncoding = history.getEncoding();
resourceText = history.getResourceTextVc();
- switch (myDaoConfig.getTagStorageMode()) {
+ switch (myStorageSettings.getTagStorageMode()) {
case VERSIONED:
case NON_VERSIONED:
if (resource.isHasTags()) {
@@ -183,7 +182,7 @@ public class JpaStorageResourceParser implements IJpaStorageResourceParser {
version = view.getVersion();
provenanceRequestId = view.getProvenanceRequestId();
provenanceSourceUri = view.getProvenanceSourceUri();
- switch (myDaoConfig.getTagStorageMode()) {
+ switch (myStorageSettings.getTagStorageMode()) {
case VERSIONED:
case NON_VERSIONED:
if (theTagList != null) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/ObservationLastNIndexPersistSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/ObservationLastNIndexPersistSvc.java
index 487014d2a5e..7d777ca4043 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/ObservationLastNIndexPersistSvc.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/ObservationLastNIndexPersistSvc.java
@@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.dao;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeSearchParam;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken;
import ca.uhn.fhir.jpa.model.util.CodeSystemHash;
@@ -52,7 +52,7 @@ public class ObservationLastNIndexPersistSvc {
private IElasticsearchSvc myElasticsearchSvc;
@Autowired
- private DaoConfig myConfig;
+ private JpaStorageSettings myConfig;
@Autowired
private FhirContext myContext;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java
index b10f07b36aa..d3a6420c2e6 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java
@@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.dao;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome;
import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
@@ -92,7 +92,7 @@ public class TransactionProcessor extends BaseTransactionProcessor {
@Autowired
private PartitionSettings myPartitionSettings;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@Autowired
private FhirContext myFhirContext;
@Autowired
@@ -169,7 +169,7 @@ public class TransactionProcessor extends BaseTransactionProcessor {
for (JpaPid next : outcome) {
foundIds.add(next.getAssociatedResourceId().toUnqualifiedVersionless().getValue());
theTransactionDetails.addResolvedResourceId(next.getAssociatedResourceId(), next);
- if (myDaoConfig.getResourceClientIdStrategy() != DaoConfig.ClientIdStrategyEnum.ANY || !next.getAssociatedResourceId().isIdPartValidLong()) {
+ if (myStorageSettings.getResourceClientIdStrategy() != JpaStorageSettings.ClientIdStrategyEnum.ANY || !next.getAssociatedResourceId().isIdPartValidLong()) {
idsToPreFetch.add(next.getId());
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/JpaResourceExpungeService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/JpaResourceExpungeService.java
index 5ccae981bc5..bb514e896e0 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/JpaResourceExpungeService.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/expunge/JpaResourceExpungeService.java
@@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.dao.expunge;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Pointcut;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
import ca.uhn.fhir.jpa.dao.IJpaStorageResourceParser;
@@ -120,7 +120,7 @@ public class JpaResourceExpungeService implements IResourceExpungeService {
@Autowired
protected IResourceTableDao myResourceTableDao;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@Autowired
private FhirContext myFhirCtx;
@Autowired
@@ -214,7 +213,7 @@ public class IdHelperService implements IIdHelperService {
} else {
// is a forced id
// we must resolve!
- if (myDaoConfig.isDeleteEnabled()) {
+ if (myStorageSettings.isDeleteEnabled()) {
retVal = resolveResourceIdentity(theRequestPartitionId, theResourceType, id, theExcludeDeleted).getPersistentId();
retVals.put(id, retVal);
} else {
@@ -267,14 +266,14 @@ public class IdHelperService implements IIdHelperService {
/**
* Returns true if the given resource ID should be stored in a forced ID. Under default config
- * (meaning client ID strategy is {@link ca.uhn.fhir.jpa.api.config.DaoConfig.ClientIdStrategyEnum#ALPHANUMERIC})
+ * (meaning client ID strategy is {@link JpaStorageSettings.ClientIdStrategyEnum#ALPHANUMERIC})
* this will return true if the ID has any non-digit characters.
*
- * In {@link ca.uhn.fhir.jpa.api.config.DaoConfig.ClientIdStrategyEnum#ANY} mode it will always return true.
+ * In {@link JpaStorageSettings.ClientIdStrategyEnum#ANY} mode it will always return true.
*/
@Override
public boolean idRequiresForcedId(String theId) {
- return myDaoConfig.getResourceClientIdStrategy() == DaoConfig.ClientIdStrategyEnum.ANY || !isValidPid(theId);
+ return myStorageSettings.getResourceClientIdStrategy() == JpaStorageSettings.ClientIdStrategyEnum.ANY || !isValidPid(theId);
}
@Nonnull
@@ -319,7 +318,7 @@ public class IdHelperService implements IIdHelperService {
if (!theIds.isEmpty()) {
Set idsToCheck = new HashSet<>(theIds.size());
for (IIdType nextId : theIds) {
- if (myDaoConfig.getResourceClientIdStrategy() != DaoConfig.ClientIdStrategyEnum.ANY) {
+ if (myStorageSettings.getResourceClientIdStrategy() != JpaStorageSettings.ClientIdStrategyEnum.ANY) {
if (nextId.isIdPartValidLong()) {
if (!theOnlyForcedIds) {
JpaPid jpaPid = JpaPid.fromId(nextId.getIdPartAsLong());
@@ -445,7 +444,7 @@ public class IdHelperService implements IIdHelperService {
private ListMultimap organizeIdsByResourceType(Collection theIds) {
ListMultimap typeToIds = MultimapBuilder.hashKeys().arrayListValues().build();
for (IIdType nextId : theIds) {
- if (myDaoConfig.getResourceClientIdStrategy() == DaoConfig.ClientIdStrategyEnum.ANY || !isValidPid(nextId)) {
+ if (myStorageSettings.getResourceClientIdStrategy() == JpaStorageSettings.ClientIdStrategyEnum.ANY || !isValidPid(nextId)) {
if (nextId.hasResourceType()) {
typeToIds.put(nextId.getResourceType(), nextId.getIdPart());
} else {
@@ -468,7 +467,7 @@ public class IdHelperService implements IIdHelperService {
Map>> retVal = new HashMap<>();
RequestPartitionId requestPartitionId = replaceDefault(theRequestPartitionId);
- if (myDaoConfig.getResourceClientIdStrategy() != DaoConfig.ClientIdStrategyEnum.ANY) {
+ if (myStorageSettings.getResourceClientIdStrategy() != JpaStorageSettings.ClientIdStrategyEnum.ANY) {
List pids = theId
.stream()
.filter(t -> isValidPid(t))
@@ -485,7 +484,7 @@ public class IdHelperService implements IIdHelperService {
String nextResourceType = nextEntry.getKey();
Collection nextIds = nextEntry.getValue();
- if (!myDaoConfig.isDeleteEnabled()) {
+ if (!myStorageSettings.isDeleteEnabled()) {
for (Iterator forcedIdIterator = nextIds.iterator(); forcedIdIterator.hasNext(); ) {
String nextForcedId = forcedIdIterator.next();
String nextKey = nextResourceType + "/" + nextForcedId;
@@ -528,7 +527,7 @@ public class IdHelperService implements IIdHelperService {
}
retVal.get(forcedId).add(lookup);
- if (!myDaoConfig.isDeleteEnabled()) {
+ if (!myStorageSettings.isDeleteEnabled()) {
String key = resourceType + "/" + forcedId;
myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.RESOURCE_LOOKUP, key, lookup);
}
@@ -555,7 +554,7 @@ public class IdHelperService implements IIdHelperService {
}
private void resolvePids(@Nonnull RequestPartitionId theRequestPartitionId, List thePidsToResolve, Map>> theTargets) {
- if (!myDaoConfig.isDeleteEnabled()) {
+ if (!myStorageSettings.isDeleteEnabled()) {
for (Iterator forcedIdIterator = thePidsToResolve.iterator(); forcedIdIterator.hasNext(); ) {
Long nextPid = forcedIdIterator.next();
String nextKey = Long.toString(nextPid);
@@ -592,7 +591,7 @@ public class IdHelperService implements IIdHelperService {
theTargets.put(id, new ArrayList<>());
}
theTargets.get(id).add(t);
- if (!myDaoConfig.isDeleteEnabled()) {
+ if (!myStorageSettings.isDeleteEnabled()) {
String nextKey = t.getPersistentId().toString();
myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.RESOURCE_LOOKUP, nextKey, t);
}
@@ -657,7 +656,7 @@ public class IdHelperService implements IIdHelperService {
myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.PID_TO_FORCED_ID, theJpaPid.getId(), Optional.empty());
}
- if (!myDaoConfig.isDeleteEnabled()) {
+ if (!myStorageSettings.isDeleteEnabled()) {
JpaResourceLookup lookup = new JpaResourceLookup(theResourceType, theJpaPid.getId(), theDeletedAt);
String nextKey = theJpaPid.toString();
myMemoryCacheService.putAfterCommit(MemoryCacheService.CacheEnum.RESOURCE_LOOKUP, nextKey, lookup);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java
index eef691e37e2..ae2f850a1a3 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java
@@ -25,7 +25,7 @@ import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
import ca.uhn.fhir.jpa.dao.BaseStorageDao;
@@ -77,7 +77,7 @@ public class SearchParamWithInlineReferencesExtractor {
@Autowired
private MatchResourceUrlService myMatchResourceUrlService;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@Autowired
private FhirContext myContext;
@Autowired
@@ -120,8 +120,8 @@ public class SearchParamWithInlineReferencesExtractor {
mySearchParamExtractorService.extractFromResource(theRequestPartitionId, theRequest, theParams, theExistingParams, theEntity, theResource, theTransactionDetails, theFailOnInvalidReference);
ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType());
- if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.ENABLED) {
- theParams.findMissingSearchParams(myPartitionSettings, myDaoConfig.getModelConfig(), theEntity, activeSearchParams);
+ if (myStorageSettings.getIndexMissingFields() == JpaStorageSettings.IndexEnabledEnum.ENABLED) {
+ theParams.findMissingSearchParams(myPartitionSettings, myStorageSettings, theEntity, activeSearchParams);
}
/*
@@ -181,8 +181,8 @@ public class SearchParamWithInlineReferencesExtractor {
}
@VisibleForTesting
- public void setDaoConfig(DaoConfig theDaoConfig) {
- myDaoConfig = theDaoConfig;
+ public void setStorageSettings(JpaStorageSettings theStorageSettings) {
+ myStorageSettings = theStorageSettings;
}
@VisibleForTesting
@@ -203,11 +203,11 @@ public class SearchParamWithInlineReferencesExtractor {
* Handle references within the resource that are match URLs, for example references like "Patient?identifier=foo".
* These match URLs are resolved and replaced with the ID of the
* matching resource.
- *
+ *
* This method is *only* called from UPDATE path
*/
public void extractInlineReferences(ExtractInlineReferenceParams theParams) {
- if (!myDaoConfig.isAllowInlineMatchUrlReferences()) {
+ if (!myStorageSettings.isAllowInlineMatchUrlReferences()) {
return;
}
IBaseResource resource = theParams.getResource();
@@ -283,7 +283,7 @@ public class SearchParamWithInlineReferencesExtractor {
/*
* String Uniques
*/
- if (myDaoConfig.isUniqueIndexesEnabled()) {
+ if (myStorageSettings.isUniqueIndexesEnabled()) {
for (ResourceIndexedComboStringUnique next : myDaoSearchParamSynchronizer.subtract(theExistingParams.myComboStringUniques, theParams.myComboStringUniques)) {
ourLog.debug("Removing unique index: {}", next);
myEntityManager.remove(next);
@@ -291,7 +291,7 @@ public class SearchParamWithInlineReferencesExtractor {
}
boolean haveNewStringUniqueParams = false;
for (ResourceIndexedComboStringUnique next : myDaoSearchParamSynchronizer.subtract(theParams.myComboStringUniques, theExistingParams.myComboStringUniques)) {
- if (myDaoConfig.isUniqueIndexesCheckedBeforeSave()) {
+ if (myStorageSettings.isUniqueIndexesCheckedBeforeSave()) {
ResourceIndexedComboStringUnique existing = myResourceIndexedCompositeStringUniqueDao.findByQueryString(next.getIndexString());
if (existing != null) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchClauseBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchClauseBuilder.java
index 069288c8d99..8e76ca759b6 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchClauseBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchClauseBuilder.java
@@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.dao.search;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
+import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers;
@@ -97,15 +97,15 @@ public class ExtendedHSearchClauseBuilder {
final FhirContext myFhirContext;
public final BooleanPredicateClausesStep> myRootClause;
- public final ModelConfig myModelConfig;
+ public final StorageSettings myStorageSettings;
final PathContext myRootContext;
final List ordinalSearchPrecisions = Arrays.asList(TemporalPrecisionEnum.YEAR, TemporalPrecisionEnum.MONTH, TemporalPrecisionEnum.DAY);
- public ExtendedHSearchClauseBuilder(FhirContext myFhirContext, ModelConfig theModelConfig,
+ public ExtendedHSearchClauseBuilder(FhirContext myFhirContext, StorageSettings theStorageSettings,
BooleanPredicateClausesStep> theRootClause, SearchPredicateFactory thePredicateFactory) {
this.myFhirContext = myFhirContext;
- this.myModelConfig = theModelConfig;
+ this.myStorageSettings = theStorageSettings;
this.myRootClause = theRootClause;
myRootContext = PathContext.buildRootContext(theRootClause, thePredicateFactory);
}
@@ -534,7 +534,7 @@ public class ExtendedHSearchClauseBuilder {
ParamPrefixEnum activePrefix = qtyParam.getPrefix() == null ? ParamPrefixEnum.EQUAL : qtyParam.getPrefix();
String quantityElement = joinPath(thePathContext.getContextPath(), INDEX_TYPE_QUANTITY);
- if (myModelConfig.getNormalizedQuantitySearchLevel() == NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED) {
+ if (myStorageSettings.getNormalizedQuantitySearchLevel() == NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED) {
QuantityParam canonicalQty = UcumServiceUtil.toCanonicalQuantityOrNull(qtyParam);
if (canonicalQty != null) {
String valueFieldPath = joinPath(quantityElement, QTY_VALUE_NORM);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractor.java
index 5dd62f851e9..517b0eaf998 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractor.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/ExtendedHSearchIndexExtractor.java
@@ -22,8 +22,7 @@ package ca.uhn.fhir.jpa.dao.search;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeSearchParam;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity;
import ca.uhn.fhir.jpa.model.entity.ResourceLink;
@@ -59,32 +58,30 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
*/
public class ExtendedHSearchIndexExtractor {
- private final DaoConfig myDaoConfig;
+ private final JpaStorageSettings myJpaStorageSettings;
private final FhirContext myContext;
private final ResourceSearchParams myParams;
private final ISearchParamExtractor mySearchParamExtractor;
- private final ModelConfig myModelConfig;
- public ExtendedHSearchIndexExtractor(DaoConfig theDaoConfig, FhirContext theContext, ResourceSearchParams theActiveParams,
- ISearchParamExtractor theSearchParamExtractor, ModelConfig theModelConfig) {
- myDaoConfig = theDaoConfig;
+ public ExtendedHSearchIndexExtractor(JpaStorageSettings theJpaStorageSettings, FhirContext theContext, ResourceSearchParams theActiveParams,
+ ISearchParamExtractor theSearchParamExtractor) {
+ myJpaStorageSettings = theJpaStorageSettings;
myContext = theContext;
myParams = theActiveParams;
mySearchParamExtractor = theSearchParamExtractor;
- myModelConfig = theModelConfig;
}
@Nonnull
public ExtendedHSearchIndexData extract(IBaseResource theResource, ResourceIndexedSearchParams theNewParams) {
- ExtendedHSearchIndexData retVal = new ExtendedHSearchIndexData(myContext, myModelConfig, theResource);
+ ExtendedHSearchIndexData retVal = new ExtendedHSearchIndexData(myContext, myJpaStorageSettings, theResource);
- if(myDaoConfig.isStoreResourceInHSearchIndex()) {
+ if (myJpaStorageSettings.isStoreResourceInHSearchIndex()) {
retVal.setRawResourceData(myContext.newJsonParser().encodeResourceToString(theResource));
}
retVal.setForcedId(theResource.getIdElement().getIdPart());
- // todo add a flag ot DaoConfig to suppress this
+ // todo add a flag ot StorageSettings to suppress this
extractAutocompleteTokens(theResource, retVal);
theNewParams.myStringParams.stream()
@@ -127,8 +124,8 @@ public class ExtendedHSearchIndexExtractor {
if (theResource.getMeta().getLastUpdated() != null) {
int ordinal = ResourceIndexedSearchParamDate.calculateOrdinalValue(theResource.getMeta().getLastUpdated()).intValue();
- retVal.addDateIndexData("_lastUpdated", theResource.getMeta().getLastUpdated(), ordinal,
- theResource.getMeta().getLastUpdated(), ordinal);
+ retVal.addDateIndexData("_lastUpdated", theResource.getMeta().getLastUpdated(), ordinal,
+ theResource.getMeta().getLastUpdated(), ordinal);
}
@@ -158,9 +155,9 @@ public class ExtendedHSearchIndexExtractor {
// Consider 2 cases for references
// Case 1: Resource Type and Resource ID is known
// Case 2: Resource is unknown and referred by canonical url reference
- if(!Strings.isNullOrEmpty(nextLink.getTargetResourceId())) {
+ if (!Strings.isNullOrEmpty(nextLink.getTargetResourceId())) {
qualifiedTargetResourceId = nextLink.getTargetResourceType() + "/" + nextLink.getTargetResourceId();
- } else if(!Strings.isNullOrEmpty(nextLink.getTargetResourceUrl())) {
+ } else if (!Strings.isNullOrEmpty(nextLink.getTargetResourceUrl())) {
qualifiedTargetResourceId = nextLink.getTargetResourceUrl();
}
retVal.addResourceLinkIndexData(nextParamName, qualifiedTargetResourceId);
@@ -171,16 +168,6 @@ public class ExtendedHSearchIndexExtractor {
return retVal;
}
- @Nonnull
- public static DateSearchIndexData convertDate(ResourceIndexedSearchParamDate nextParam) {
- return new DateSearchIndexData(nextParam.getValueLow(), nextParam.getValueLowDateOrdinal(), nextParam.getValueHigh(), nextParam.getValueHighDateOrdinal());
- }
-
- @Nonnull
- public static QuantitySearchIndexData convertQuantity(ResourceIndexedSearchParamQuantity nextParam) {
- return new QuantitySearchIndexData(nextParam.getUnits(), nextParam.getSystem(), nextParam.getValue().doubleValue());
- }
-
@Nonnull
private CompositeSearchIndexData buildCompositeIndexData(ResourceIndexedSearchParamComposite theSearchParamComposite) {
return new HSearchCompositeSearchIndexDataImpl(theSearchParamComposite);
@@ -192,35 +179,35 @@ public class ExtendedHSearchIndexExtractor {
private void extractAutocompleteTokens(IBaseResource theResource, ExtendedHSearchIndexData theRetVal) {
// we need to re-index token params to match up display with codes.
myParams.values().stream()
- .filter(p->p.getParamType() == RestSearchParameterTypeEnum.TOKEN)
+ .filter(p -> p.getParamType() == RestSearchParameterTypeEnum.TOKEN)
// TODO it would be nice to reuse TokenExtractor
- .forEach(p-> mySearchParamExtractor.extractValues(p.getPath(), theResource)
- .forEach(nextValue->indexTokenValue(theRetVal, p, nextValue)
- ));
+ .forEach(p -> mySearchParamExtractor.extractValues(p.getPath(), theResource)
+ .forEach(nextValue -> indexTokenValue(theRetVal, p, nextValue)
+ ));
}
private void indexTokenValue(ExtendedHSearchIndexData theRetVal, RuntimeSearchParam p, IBase nextValue) {
String nextType = mySearchParamExtractor.toRootTypeName(nextValue);
String spName = p.getName();
switch (nextType) {
- case "CodeableConcept":
- addToken_CodeableConcept(theRetVal, spName, nextValue);
- break;
- case "Coding":
- addToken_Coding(theRetVal, spName, (IBaseCoding) nextValue);
- break;
+ case "CodeableConcept":
+ addToken_CodeableConcept(theRetVal, spName, nextValue);
+ break;
+ case "Coding":
+ addToken_Coding(theRetVal, spName, (IBaseCoding) nextValue);
+ break;
// TODO share this with TokenExtractor and introduce a ITokenIndexer interface.
- // Ignore unknown types for now.
- // This is just for autocomplete, and we are focused on Observation.code, category, combo-code, etc.
+ // Ignore unknown types for now.
+ // This is just for autocomplete, and we are focused on Observation.code, category, combo-code, etc.
// case "Identifier":
// mySearchParamExtractor.addToken_Identifier(myResourceTypeName, params, searchParam, value);
// break;
// case "ContactPoint":
// mySearchParamExtractor.addToken_ContactPoint(myResourceTypeName, params, searchParam, value);
// break;
- default:
- break;
- }
+ default:
+ break;
+ }
}
private void addToken_CodeableConcept(ExtendedHSearchIndexData theRetVal, String theSpName, IBase theValue) {
@@ -234,4 +221,14 @@ public class ExtendedHSearchIndexExtractor {
theRetVal.addTokenIndexData(theSpName, theNextValue);
}
+ @Nonnull
+ public static DateSearchIndexData convertDate(ResourceIndexedSearchParamDate nextParam) {
+ return new DateSearchIndexData(nextParam.getValueLow(), nextParam.getValueLowDateOrdinal(), nextParam.getValueHigh(), nextParam.getValueHighDateOrdinal());
+ }
+
+ @Nonnull
+ public static QuantitySearchIndexData convertQuantity(ResourceIndexedSearchParamQuantity nextParam) {
+ return new QuantitySearchIndexData(nextParam.getUnits(), nextParam.getSystem(), nextParam.getValue().doubleValue());
+ }
+
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/LastNOperation.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/LastNOperation.java
index 7e6cc7e9b1f..963ebe47e45 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/LastNOperation.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/LastNOperation.java
@@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.dao.search;
*/
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
+import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.jpa.searchparam.util.LastNParameterHelper;
@@ -39,15 +39,15 @@ public class LastNOperation {
public static final String OBSERVATION_RES_TYPE = "Observation";
private final SearchSession mySession;
private final FhirContext myFhirContext;
- private final ModelConfig myModelConfig;
+ private final StorageSettings myStorageSettings;
private final ISearchParamRegistry mySearchParamRegistry;
private final ExtendedHSearchSearchBuilder myExtendedHSearchSearchBuilder = new ExtendedHSearchSearchBuilder();
- public LastNOperation(SearchSession theSession, FhirContext theFhirContext, ModelConfig theModelConfig,
+ public LastNOperation(SearchSession theSession, FhirContext theFhirContext, StorageSettings theStorageSettings,
ISearchParamRegistry theSearchParamRegistry) {
mySession = theSession;
myFhirContext = theFhirContext;
- myModelConfig = theModelConfig;
+ myStorageSettings = theStorageSettings;
mySearchParamRegistry = theSearchParamRegistry;
}
@@ -61,7 +61,7 @@ public class LastNOperation {
.where(f -> f.bool(b -> {
// Must match observation type
b.must(f.match().field("myResourceType").matching(OBSERVATION_RES_TYPE));
- ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myModelConfig, b, f);
+ ExtendedHSearchClauseBuilder builder = new ExtendedHSearchClauseBuilder(myFhirContext, myStorageSettings, b, f);
myExtendedHSearchSearchBuilder.addAndConsumeAdvancedQueryClauses(builder, OBSERVATION_RES_TYPE, theParams.clone(), mySearchParamRegistry);
}))
.aggregation(observationsByCodeKey, f -> f.fromJson(lastNAggregation.toAggregation()))
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/package-info.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/package-info.java
index 26f258cfa8e..400287ef5fb 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/package-info.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/search/package-info.java
@@ -31,7 +31,7 @@
* @see ca.uhn.fhir.jpa.dao.search.ExtendedHSearchSearchBuilder
* @see ca.uhn.fhir.jpa.model.search.SearchParamTextPropertyBinder
*
- * Activated by {@link ca.uhn.fhir.jpa.api.config.DaoConfig#setAdvancedHSearchIndexing(boolean)}.
+ * Activated by {@link ca.uhn.fhir.jpa.api.config.JpaStorageSettings#setAdvancedHSearchIndexing(boolean)}.
*/
package ca.uhn.fhir.jpa.dao.search;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictService.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictService.java
index c654b2eba1e..611eea13936 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictService.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/DeleteConflictService.java
@@ -25,7 +25,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Pointcut;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.model.DeleteConflict;
import ca.uhn.fhir.jpa.api.model.DeleteConflictList;
import ca.uhn.fhir.jpa.dao.BaseStorageDao;
@@ -61,7 +61,7 @@ public class DeleteConflictService {
@Autowired
DeleteConflictFinderService myDeleteConflictFinderService;
@Autowired
- DaoConfig myDaoConfig;
+ JpaStorageSettings myStorageSettings;
@Autowired
private FhirContext myFhirContext;
@@ -75,7 +75,7 @@ public class DeleteConflictService {
}
private DeleteConflictOutcome handleConflicts(RequestDetails theRequest, DeleteConflictList theDeleteConflicts, ResourceTable theEntity, boolean theForValidate, List theResultList, TransactionDetails theTransactionDetails) {
- if (!myDaoConfig.isEnforceReferentialIntegrityOnDelete() && !theForValidate) {
+ if (!myStorageSettings.isEnforceReferentialIntegrityOnDelete() && !theForValidate) {
ourLog.debug("Deleting {} resource dependencies which can no longer be satisfied", theResultList.size());
myResourceLinkDao.deleteAll(theResultList);
return null;
@@ -128,7 +128,7 @@ public class DeleteConflictService {
int shouldRetryCount = Math.min(outcome.getShouldRetryCount(), MAX_RETRY_ATTEMPTS);
if (!(retryCount < shouldRetryCount)) break;
newConflicts = new DeleteConflictList(newConflicts);
- outcome = findAndHandleConflicts(theRequest, newConflicts, theEntity, theForValidate, myDaoConfig.getMaximumDeleteConflictQueryCount(), theTransactionDetails);
+ outcome = findAndHandleConflicts(theRequest, newConflicts, theEntity, theForValidate, myStorageSettings.getMaximumDeleteConflictQueryCount(), theTransactionDetails);
++retryCount;
}
theDeleteConflicts.addAll(newConflicts);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSqlBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSqlBuilder.java
index aa9e9a00d68..955de2f3ce2 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSqlBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/delete/batch2/DeleteExpungeSqlBuilder.java
@@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.delete.batch2;
*/
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
import ca.uhn.fhir.jpa.dao.data.IResourceLinkDao;
import ca.uhn.fhir.jpa.dao.expunge.ResourceForeignKey;
@@ -44,13 +44,13 @@ public class DeleteExpungeSqlBuilder {
public static final String THREAD_PREFIX = "delete-expunge";
private final ResourceTableFKProvider myResourceTableFKProvider;
- private final DaoConfig myDaoConfig;
+ private final JpaStorageSettings myStorageSettings;
private final IIdHelperService myIdHelper;
private final IResourceLinkDao myResourceLinkDao;
- public DeleteExpungeSqlBuilder(ResourceTableFKProvider theResourceTableFKProvider, DaoConfig theDaoConfig, IIdHelperService theIdHelper, IResourceLinkDao theResourceLinkDao) {
+ public DeleteExpungeSqlBuilder(ResourceTableFKProvider theResourceTableFKProvider, JpaStorageSettings theStorageSettings, IIdHelperService theIdHelper, IResourceLinkDao theResourceLinkDao) {
myResourceTableFKProvider = theResourceTableFKProvider;
- myDaoConfig = theDaoConfig;
+ myStorageSettings = theStorageSettings;
myIdHelper = theIdHelper;
myResourceLinkDao = theResourceLinkDao;
}
@@ -78,7 +78,7 @@ public class DeleteExpungeSqlBuilder {
}
public void validateOkToDeleteAndExpunge(List thePids) {
- if (!myDaoConfig.isEnforceReferentialIntegrityOnDelete()) {
+ if (!myStorageSettings.isEnforceReferentialIntegrityOnDelete()) {
ourLog.info("Referential integrity on delete disabled. Skipping referential integrity check.");
return;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java
index 33b2d190fca..bf682ab110f 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/HapiFhirJpaMigrationTasks.java
@@ -31,7 +31,7 @@ import ca.uhn.fhir.jpa.migrate.tasks.api.BaseMigrationTasks;
import ca.uhn.fhir.jpa.migrate.tasks.api.Builder;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
+import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString;
@@ -1710,7 +1710,7 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks {
spidxString
.addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.28")
.setColumnName("HASH_NORM_PREFIX")
- .addCalculator("HASH_NORM_PREFIX", t -> ResourceIndexedSearchParamString.calculateHashNormalized(new PartitionSettings(), RequestPartitionId.defaultPartition(), new ModelConfig(), t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_VALUE_NORMALIZED")))
+ .addCalculator("HASH_NORM_PREFIX", t -> ResourceIndexedSearchParamString.calculateHashNormalized(new PartitionSettings(), RequestPartitionId.defaultPartition(), new StorageSettings(), t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_VALUE_NORMALIZED")))
.addCalculator("HASH_EXACT", t -> ResourceIndexedSearchParamString.calculateHashExact(new PartitionSettings(), (ca.uhn.fhir.jpa.model.entity.PartitionablePartitionId) null, t.getResourceType(), t.getParamName(), t.getString("SP_VALUE_EXACT")))
);
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaCapabilityStatementProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaCapabilityStatementProvider.java
index 0d76ae25369..8d4129d4d1c 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaCapabilityStatementProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaCapabilityStatementProvider.java
@@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.provider;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.server.RestfulServer;
@@ -51,7 +51,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class JpaCapabilityStatementProvider extends ServerCapabilityStatementProvider {
private final FhirContext myContext;
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
private String myImplementationDescription;
private boolean myIncludeResourceCounts;
private IFhirSystemDao, ?> mySystemDao;
@@ -59,17 +59,17 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro
/**
* Constructor
*/
- public JpaCapabilityStatementProvider(@Nonnull RestfulServer theRestfulServer, @Nonnull IFhirSystemDao, ?> theSystemDao, @Nonnull DaoConfig theDaoConfig, @Nonnull ISearchParamRegistry theSearchParamRegistry, IValidationSupport theValidationSupport) {
+ public JpaCapabilityStatementProvider(@Nonnull RestfulServer theRestfulServer, @Nonnull IFhirSystemDao, ?> theSystemDao, @Nonnull JpaStorageSettings theStorageSettings, @Nonnull ISearchParamRegistry theSearchParamRegistry, IValidationSupport theValidationSupport) {
super(theRestfulServer, theSearchParamRegistry, theValidationSupport);
Validate.notNull(theRestfulServer);
Validate.notNull(theSystemDao);
- Validate.notNull(theDaoConfig);
+ Validate.notNull(theStorageSettings);
Validate.notNull(theSearchParamRegistry);
myContext = theRestfulServer.getFhirContext();
mySystemDao = theSystemDao;
- myDaoConfig = theDaoConfig;
+ myStorageSettings = theStorageSettings;
setIncludeResourceCounts(true);
}
@@ -91,9 +91,9 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro
protected void postProcessRest(FhirTerser theTerser, IBase theRest) {
super.postProcessRest(theTerser, theRest);
- if (myDaoConfig.getSupportedSubscriptionTypes().contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) {
- if (isNotBlank(myDaoConfig.getWebsocketContextPath())) {
- ExtensionUtil.setExtension(myContext, theRest, Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL, "uri", myDaoConfig.getWebsocketContextPath());
+ if (myStorageSettings.getSupportedSubscriptionTypes().contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) {
+ if (isNotBlank(myStorageSettings.getWebsocketContextPath())) {
+ ExtensionUtil.setExtension(myContext, theRest, Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL, "uri", myStorageSettings.getWebsocketContextPath());
}
}
@@ -105,7 +105,7 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro
theTerser.addElement(theResource, "versioning", ResourceVersionPolicy.VERSIONEDUPDATE.toCode());
- if (myDaoConfig.isAllowMultipleDelete()) {
+ if (myStorageSettings.isAllowMultipleDelete()) {
theTerser.addElement(theResource, "conditionalDelete", ConditionalDeleteStatus.MULTIPLE.toCode());
} else {
theTerser.addElement(theResource, "conditionalDelete", ConditionalDeleteStatus.SINGLE.toCode());
@@ -132,8 +132,8 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro
myIncludeResourceCounts = theIncludeResourceCounts;
}
- public void setDaoConfig(DaoConfig myDaoConfig) {
- this.myDaoConfig = myDaoConfig;
+ public void setStorageSettings(JpaStorageSettings theStorageSettings) {
+ this.myStorageSettings = theStorageSettings;
}
@CoverageIgnore
@@ -148,6 +148,6 @@ public class JpaCapabilityStatementProvider extends ServerCapabilityStatementPro
@Override
protected boolean searchParamEnabled(String theSearchParam) {
- return !Constants.PARAM_FILTER.equals(theSearchParam) || myDaoConfig.isFilterParameterEnabled();
+ return !Constants.PARAM_FILTER.equals(theSearchParam) || myStorageSettings.isFilterParameterEnabled();
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java
index c045458dbc0..3bcb29103a8 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaConformanceProviderDstu2.java
@@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.provider;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.util.ResourceCountCache;
import ca.uhn.fhir.model.api.ExtensionDt;
@@ -58,7 +58,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class JpaConformanceProviderDstu2 extends ServerConformanceProvider {
private volatile Conformance myCachedValue;
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
private String myImplementationDescription;
private boolean myIncludeResourceCounts;
private RestfulServer myRestfulServer;
@@ -78,11 +78,11 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider {
/**
* Constructor
*/
- public JpaConformanceProviderDstu2(RestfulServer theRestfulServer, IFhirSystemDao theSystemDao, DaoConfig theDaoConfig) {
+ public JpaConformanceProviderDstu2(RestfulServer theRestfulServer, IFhirSystemDao theSystemDao, JpaStorageSettings theStorageSettings) {
super(theRestfulServer);
myRestfulServer = theRestfulServer;
mySystemDao = theSystemDao;
- myDaoConfig = theDaoConfig;
+ myStorageSettings = theStorageSettings;
super.setCache(false);
setIncludeResourceCounts(true);
}
@@ -105,7 +105,7 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider {
for (RestResource nextResource : nextRest.getResource()) {
ConditionalDeleteStatusEnum conditionalDelete = nextResource.getConditionalDeleteElement().getValueAsEnum();
- if (conditionalDelete == ConditionalDeleteStatusEnum.MULTIPLE_DELETES_SUPPORTED && myDaoConfig.isAllowMultipleDelete() == false) {
+ if (conditionalDelete == ConditionalDeleteStatusEnum.MULTIPLE_DELETES_SUPPORTED && myStorageSettings.isAllowMultipleDelete() == false) {
nextResource.setConditionalDelete(ConditionalDeleteStatusEnum.SINGLE_DELETES_SUPPORTED);
}
@@ -131,11 +131,11 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider {
}
}
- if (myDaoConfig.getSupportedSubscriptionTypes().contains(Subscription.SubscriptionChannelType.WEBSOCKET)) {
- if (isNotBlank(myDaoConfig.getWebsocketContextPath())) {
+ if (myStorageSettings.getSupportedSubscriptionTypes().contains(Subscription.SubscriptionChannelType.WEBSOCKET)) {
+ if (isNotBlank(myStorageSettings.getWebsocketContextPath())) {
ExtensionDt websocketExtension = new ExtensionDt();
websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL);
- websocketExtension.setValue(new UriDt(myDaoConfig.getWebsocketContextPath()));
+ websocketExtension.setValue(new UriDt(myStorageSettings.getWebsocketContextPath()));
retVal.getRestFirstRep().addUndeclaredExtension(websocketExtension);
}
}
@@ -151,8 +151,8 @@ public class JpaConformanceProviderDstu2 extends ServerConformanceProvider {
return myIncludeResourceCounts;
}
- public void setDaoConfig(DaoConfig myDaoConfig) {
- this.myDaoConfig = myDaoConfig;
+ public void setStorageSettings(JpaStorageSettings theStorageSettings) {
+ this.myStorageSettings = theStorageSettings;
}
@CoverageIgnore
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProvider.java
index 3896b15d031..9aa357b3c9b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/ValueSetOperationProvider.java
@@ -26,7 +26,7 @@ import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.context.support.ValidationSupportContext;
import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet;
import ca.uhn.fhir.jpa.config.JpaConfig;
@@ -39,6 +39,7 @@ import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import ca.uhn.fhir.util.ParametersUtil;
+import com.google.common.annotations.VisibleForTesting;
import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain;
import org.hl7.fhir.instance.model.api.IBaseCoding;
import org.hl7.fhir.instance.model.api.IBaseParameters;
@@ -61,8 +62,6 @@ public class ValueSetOperationProvider extends BaseJpaProvider {
@Autowired
protected IValidationSupport myValidationSupport;
@Autowired
- private DaoConfig myDaoConfig;
- @Autowired
private DaoRegistry myDaoRegistry;
@Autowired
private ITermReadSvc myTermReadSvc;
@@ -70,24 +69,13 @@ public class ValueSetOperationProvider extends BaseJpaProvider {
@Qualifier(JpaConfig.JPA_VALIDATION_SUPPORT_CHAIN)
private ValidationSupportChain myValidationSupportChain;
- public void setValidationSupport(IValidationSupport theValidationSupport) {
- myValidationSupport = theValidationSupport;
- }
-
- public void setDaoConfig(DaoConfig theDaoConfig) {
- myDaoConfig = theDaoConfig;
- }
-
- public void setDaoRegistry(DaoRegistry theDaoRegistry) {
+ @VisibleForTesting
+ public void setDaoRegistryForUnitTest(DaoRegistry theDaoRegistry) {
myDaoRegistry = theDaoRegistry;
}
- public void setTermReadSvc(ITermReadSvc theTermReadSvc) {
- myTermReadSvc = theTermReadSvc;
- }
-
- public void setValidationSupportChain(ValidationSupportChain theValidationSupportChain) {
- myValidationSupportChain = theValidationSupportChain;
+ public void setValidationSupport(IValidationSupport theValidationSupport) {
+ myValidationSupport = theValidationSupport;
}
@Operation(name = JpaConstants.OPERATION_EXPAND, idempotent = true, typeName = "ValueSet")
@@ -200,8 +188,8 @@ public class ValueSetOperationProvider extends BaseJpaProvider {
}
- public static ValueSetExpansionOptions createValueSetExpansionOptions(DaoConfig theDaoConfig, IPrimitiveType theOffset, IPrimitiveType theCount, IPrimitiveType theIncludeHierarchy, IPrimitiveType theFilter, IPrimitiveType theDisplayLanguage) {
- int offset = theDaoConfig.getPreExpandValueSetsDefaultOffset();
+ public static ValueSetExpansionOptions createValueSetExpansionOptions(JpaStorageSettings theStorageSettings, IPrimitiveType theOffset, IPrimitiveType theCount, IPrimitiveType theIncludeHierarchy, IPrimitiveType theFilter, IPrimitiveType theDisplayLanguage) {
+ int offset = theStorageSettings.getPreExpandValueSetsDefaultOffset();
if (theOffset != null && theOffset.hasValue()) {
if (theOffset.getValue() >= 0) {
offset = theOffset.getValue();
@@ -210,7 +198,7 @@ public class ValueSetOperationProvider extends BaseJpaProvider {
}
}
- int count = theDaoConfig.getPreExpandValueSetsDefaultCount();
+ int count = theStorageSettings.getPreExpandValueSetsDefaultCount();
if (theCount != null && theCount.hasValue()) {
if (theCount.getValue() >= 0) {
count = theCount.getValue();
@@ -218,7 +206,7 @@ public class ValueSetOperationProvider extends BaseJpaProvider {
throw new InvalidRequestException(Msg.code(1136) + "count parameter for $expand operation must be >= 0 when specified. count: " + theCount.getValue());
}
}
- int countMax = theDaoConfig.getPreExpandValueSetsMaxCount();
+ int countMax = theStorageSettings.getPreExpandValueSetsMaxCount();
if (count > countMax) {
ourLog.warn("count parameter for $expand operation of {} exceeds maximum value of {}; using maximum value.", count, countMax);
count = countMax;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java
index 7e0a1e63d9f..d1518ca1d6a 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaConformanceProviderDstu3.java
@@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.provider.dstu3;
*/
import ca.uhn.fhir.context.RuntimeSearchParam;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
@@ -59,7 +59,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.server.ServerCapabilityStatementProvider {
private volatile CapabilityStatement myCachedValue;
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
private ISearchParamRegistry mySearchParamRegistry;
private String myImplementationDescription;
private boolean myIncludeResourceCounts;
@@ -81,11 +81,11 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se
/**
* Constructor
*/
- public JpaConformanceProviderDstu3(RestfulServer theRestfulServer, IFhirSystemDao theSystemDao, DaoConfig theDaoConfig, ISearchParamRegistry theSearchParamRegistry) {
+ public JpaConformanceProviderDstu3(RestfulServer theRestfulServer, IFhirSystemDao theSystemDao, JpaStorageSettings theStorageSettings, ISearchParamRegistry theSearchParamRegistry) {
super(theRestfulServer);
myRestfulServer = theRestfulServer;
mySystemDao = theSystemDao;
- myDaoConfig = theDaoConfig;
+ myStorageSettings = theStorageSettings;
myServerConfiguration = theRestfulServer.createConfiguration();
super.setCache(false);
setSearchParamRegistry(theSearchParamRegistry);
@@ -114,7 +114,7 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se
nextResource.setVersioning(ResourceVersionPolicy.VERSIONEDUPDATE);
ConditionalDeleteStatus conditionalDelete = nextResource.getConditionalDelete();
- if (conditionalDelete == ConditionalDeleteStatus.MULTIPLE && myDaoConfig.isAllowMultipleDelete() == false) {
+ if (conditionalDelete == ConditionalDeleteStatus.MULTIPLE && myStorageSettings.isAllowMultipleDelete() == false) {
nextResource.setConditionalDelete(ConditionalDeleteStatus.SINGLE);
}
@@ -172,11 +172,11 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se
massage(retVal);
- if (myDaoConfig.getSupportedSubscriptionTypes().contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) {
- if (isNotBlank(myDaoConfig.getWebsocketContextPath())) {
+ if (myStorageSettings.getSupportedSubscriptionTypes().contains(org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.WEBSOCKET)) {
+ if (isNotBlank(myStorageSettings.getWebsocketContextPath())) {
Extension websocketExtension = new Extension();
websocketExtension.setUrl(Constants.CAPABILITYSTATEMENT_WEBSOCKET_URL);
- websocketExtension.setValue(new UriType(myDaoConfig.getWebsocketContextPath()));
+ websocketExtension.setValue(new UriType(myStorageSettings.getWebsocketContextPath()));
retVal.getRestFirstRep().addExtension(websocketExtension);
}
}
@@ -218,7 +218,7 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se
protected boolean searchParamEnabled(String theSearchParam) {
// Borrowed from hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/ServerCapabilityStatementProvider.java
- return !Constants.PARAM_FILTER.equals(theSearchParam) || myDaoConfig.isFilterParameterEnabled();
+ return !Constants.PARAM_FILTER.equals(theSearchParam) || myStorageSettings.isFilterParameterEnabled();
}
@@ -275,8 +275,8 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se
// nothing
}
- public void setDaoConfig(DaoConfig myDaoConfig) {
- this.myDaoConfig = myDaoConfig;
+ public void setStorageSettings(JpaStorageSettings theStorageSettings) {
+ this.myStorageSettings = theStorageSettings;
}
@CoverageIgnore
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java
index 52ac51e2cad..dbc45228ccb 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java
@@ -25,7 +25,7 @@ import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc;
@@ -100,7 +100,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
@Autowired
private RequestPartitionHelperSvc myRequestPartitionHelperSvc;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@Autowired
private MemoryCacheService myMemoryCacheService;
@Autowired
@@ -271,7 +271,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
boolean haveOffset = mySearchEntity.getLastUpdatedLow() != null || mySearchEntity.getLastUpdatedHigh() != null;
- switch (myDaoConfig.getHistoryCountMode()) {
+ switch (myStorageSettings.getHistoryCountMode()) {
case COUNT_ACCURATE: {
int count = supplier.apply(key);
mySearchEntity.setTotalCount(count);
@@ -391,7 +391,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
List includedPidList = new ArrayList<>();
if (mySearchEntity.getSearchType() == SearchTypeEnum.SEARCH) {
- Integer maxIncludes = myDaoConfig.getMaximumIncludesToLoadPerPage();
+ Integer maxIncludes = myStorageSettings.getMaximumIncludesToLoadPerPage();
// Load _revincludes
Set includedPids = theSearchBuilder.loadIncludes(myContext, myEntityManager, thePids, mySearchEntity.toRevIncludesList(), true, mySearchEntity.getLastUpdated(), myUuid, myRequest, maxIncludes);
@@ -432,8 +432,8 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
}
@VisibleForTesting
- public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) {
- myDaoConfig = theDaoConfig;
+ public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) {
+ myStorageSettings = theStorageSettings;
}
@VisibleForTesting
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java
index a828159b31e..16916368829 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java
@@ -26,7 +26,7 @@ import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IDao;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
@@ -99,7 +99,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchCoordinatorSvcImpl.class);
private final FhirContext myContext;
- private final DaoConfig myDaoConfig;
+ private final JpaStorageSettings myStorageSettings;
private final IInterceptorBroadcaster myInterceptorBroadcaster;
private final HapiTransactionService myTxService;
private final ISearchCacheSvc mySearchCacheSvc;
@@ -128,7 +128,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
*/
public SearchCoordinatorSvcImpl(
FhirContext theContext,
- DaoConfig theDaoConfig,
+ JpaStorageSettings theStorageSettings,
IInterceptorBroadcaster theInterceptorBroadcaster,
HapiTransactionService theTxService,
ISearchCacheSvc theSearchCacheSvc,
@@ -145,7 +145,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
) {
super();
myContext = theContext;
- myDaoConfig = theDaoConfig;
+ myStorageSettings = theStorageSettings;
myInterceptorBroadcaster = theInterceptorBroadcaster;
myTxService = theTxService;
mySearchCacheSvc = theSearchCacheSvc;
@@ -369,7 +369,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
if (cacheStatus != SearchCacheStatusEnum.NOT_TRIED) {
if (theParams.getEverythingMode() == null) {
- if (myDaoConfig.getReuseCachedSearchResultsForMillis() != null) {
+ if (myStorageSettings.getReuseCachedSearchResultsForMillis() != null) {
PersistedJpaBundleProvider foundSearchProvider = findCachedQuery(theParams, theResourceType, theRequestDetails, queryString, theRequestPartitionId);
if (foundSearchProvider != null) {
foundSearchProvider.setCacheStatus(SearchCacheStatusEnum.HIT);
@@ -525,7 +525,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
@Nullable
private Search findSearchToUseOrNull(String theQueryString, String theResourceType, RequestPartitionId theRequestPartitionId) {
// createdCutoff is in recent past
- final Instant createdCutoff = Instant.now().minus(myDaoConfig.getReuseCachedSearchResultsForMillis(), ChronoUnit.MILLIS);
+ final Instant createdCutoff = Instant.now().minus(myStorageSettings.getReuseCachedSearchResultsForMillis(), ChronoUnit.MILLIS);
Optional candidate = mySearchCacheSvc.findCandidatesForReuse(theResourceType, theQueryString, createdCutoff, theRequestPartitionId);
return candidate.orElse(null);
@@ -537,8 +537,8 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
if (theCacheControlDirective != null && theCacheControlDirective.isNoStore()) {
if (theCacheControlDirective.getMaxResults() != null) {
loadSynchronousUpTo = theCacheControlDirective.getMaxResults();
- if (loadSynchronousUpTo > myDaoConfig.getCacheControlNoStoreMaxResultsUpperLimit()) {
- throw new InvalidRequestException(Msg.code(1165) + Constants.HEADER_CACHE_CONTROL + " header " + Constants.CACHE_CONTROL_MAX_RESULTS + " value must not exceed " + myDaoConfig.getCacheControlNoStoreMaxResultsUpperLimit());
+ if (loadSynchronousUpTo > myStorageSettings.getCacheControlNoStoreMaxResultsUpperLimit()) {
+ throw new InvalidRequestException(Msg.code(1165) + Constants.HEADER_CACHE_CONTROL + " header " + Constants.CACHE_CONTROL_MAX_RESULTS + " value must not exceed " + myStorageSettings.getCacheControlNoStoreMaxResultsUpperLimit());
}
} else {
loadSynchronousUpTo = 100;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchStrategyFactory.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchStrategyFactory.java
index eeb42e94b13..6fe52be9056 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchStrategyFactory.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchStrategyFactory.java
@@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.search;
* #L%
*/
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc;
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
@@ -37,7 +37,7 @@ import java.util.function.Supplier;
* Figure out how we're going to run the query up front, and build a branchless strategy object.
*/
public class SearchStrategyFactory {
- private final DaoConfig myDaoConfig;
+ private final JpaStorageSettings myStorageSettings;
@Nullable
private final IFulltextSearchSvc myFulltextSearchSvc;
@@ -52,16 +52,16 @@ public class SearchStrategyFactory {
// public class JPAHybridHSearchSavedSearch implements ISearchStrategy {};
// public class SavedSearchAdaptorStrategy implements ISearchStrategy {};
- public SearchStrategyFactory(DaoConfig theDaoConfig, @Nullable IFulltextSearchSvc theFulltextSearchSvc) {
- myDaoConfig = theDaoConfig;
+ public SearchStrategyFactory(JpaStorageSettings theStorageSettings, @Nullable IFulltextSearchSvc theFulltextSearchSvc) {
+ myStorageSettings = theStorageSettings;
myFulltextSearchSvc = theFulltextSearchSvc;
}
public boolean isSupportsHSearchDirect(String theResourceType, SearchParameterMap theParams, RequestDetails theRequestDetails) {
return
myFulltextSearchSvc != null &&
- myDaoConfig.isStoreResourceInHSearchIndex() &&
- myDaoConfig.isAdvancedHSearchIndexing() &&
+ myStorageSettings.isStoreResourceInHSearchIndex() &&
+ myStorageSettings.isAdvancedHSearchIndexing() &&
myFulltextSearchSvc.supportsAllOf(theParams) &&
theParams.getSummaryMode() == null &&
theParams.getSearchTotalMode() == null;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java
index 6daed999f1b..34aa8043b8b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java
@@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.search;
* #L%
*/
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.model.sched.HapiJob;
import ca.uhn.fhir.jpa.model.sched.IHasScheduledJobs;
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
@@ -44,7 +44,7 @@ import static ca.uhn.fhir.jpa.search.cache.DatabaseSearchCacheSvcImpl.SEARCH_CLE
public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc, IHasScheduledJobs {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StaleSearchDeletingSvcImpl.class);
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@Autowired
private ISearchCacheSvc mySearchCacheSvc;
@@ -75,7 +75,7 @@ public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc, IHas
@Transactional(propagation = Propagation.NEVER)
@Override
public synchronized void schedulePollForStaleSearches() {
- if (!myDaoConfig.isSchedulingDisabled() && myDaoConfig.isEnableTaskStaleSearchCleanup()) {
+ if (!myStorageSettings.isSchedulingDisabled() && myStorageSettings.isEnableTaskStaleSearchCleanup()) {
pollForStaleSearchesAndDeleteThem();
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImpl.java
index eb153db5baa..e0c77d25840 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SynchronousSearchSvcImpl.java
@@ -26,7 +26,7 @@ import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.dao.IResultIterator;
@@ -68,7 +68,7 @@ public class SynchronousSearchSvcImpl implements ISynchronousSearchSvc {
private FhirContext myContext;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@Autowired
private SearchBuilderFactory mySearchBuilderFactory;
@@ -93,7 +93,7 @@ public class SynchronousSearchSvcImpl implements ISynchronousSearchSvc {
searchRuntimeDetails.setLoadSynchronous(true);
boolean theParamWantOnlyCount = isWantOnlyCount(theParams);
- boolean theParamOrConfigWantCount = nonNull(theParams.getSearchTotalMode()) ? isWantCount(theParams) : isWantCount(myDaoConfig.getDefaultTotalMode());
+ boolean theParamOrConfigWantCount = nonNull(theParams.getSearchTotalMode()) ? isWantCount(theParams) : isWantCount(myStorageSettings.getDefaultTotalMode());
boolean wantCount = theParamWantOnlyCount || theParamOrConfigWantCount;
// Execute the query and make sure we return distinct results
@@ -166,7 +166,7 @@ public class SynchronousSearchSvcImpl implements ISynchronousSearchSvc {
*/
// _includes
- Integer maxIncludes = myDaoConfig.getMaximumIncludesToLoadPerPage();
+ Integer maxIncludes = myStorageSettings.getMaximumIncludesToLoadPerPage();
final Set includedPids = theSb.loadIncludes(myContext, myEntityManager, pids, theParams.getRevIncludes(), true, theParams.getLastUpdated(), "(synchronous)", theRequestDetails, maxIncludes);
if (maxIncludes != null) {
maxIncludes -= includedPids.size();
@@ -245,8 +245,8 @@ public class SynchronousSearchSvcImpl implements ISynchronousSearchSvc {
return theLoadSynchronousUpTo;
} else if (theParams.getCount() != null) {
return theParams.getCount();
- } else if (myDaoConfig.getFetchSizeDefaultMaximum() != null) {
- return myDaoConfig.getFetchSizeDefaultMaximum();
+ } else if (myStorageSettings.getFetchSizeDefaultMaximum() != null) {
+ return myStorageSettings.getFetchSizeDefaultMaximum();
}
return null;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteSearch.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteSearch.java
index 7973ffdac18..7b9a8206055 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteSearch.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/TokenAutocompleteSearch.java
@@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.search.autocomplete;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.dao.search.ExtendedHSearchClauseBuilder;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
+import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
import com.google.gson.JsonObject;
import org.hibernate.search.backend.elasticsearch.ElasticsearchExtension;
@@ -48,12 +48,12 @@ class TokenAutocompleteSearch {
private static final AggregationKey AGGREGATION_KEY = AggregationKey.of("autocomplete");
private final FhirContext myFhirContext;
- private final ModelConfig myModelConfig;
+ private final StorageSettings myStorageSettings;
private final SearchSession mySession;
- public TokenAutocompleteSearch(FhirContext theFhirContext, ModelConfig theModelConfig, SearchSession theSession) {
+ public TokenAutocompleteSearch(FhirContext theFhirContext, StorageSettings theStorageSettings, SearchSession theSession) {
myFhirContext = theFhirContext;
- myModelConfig = theModelConfig;
+ myStorageSettings = theStorageSettings;
mySession = theSession;
}
@@ -74,7 +74,7 @@ class TokenAutocompleteSearch {
// compose the query json
SearchQueryOptionsStep, ?, SearchLoadingOptionsStep, ?, ?> query = mySession.search(ResourceTable.class)
.where(predFactory -> predFactory.bool(boolBuilder -> {
- ExtendedHSearchClauseBuilder clauseBuilder = new ExtendedHSearchClauseBuilder(myFhirContext, myModelConfig, boolBuilder, predFactory);
+ ExtendedHSearchClauseBuilder clauseBuilder = new ExtendedHSearchClauseBuilder(myFhirContext, myStorageSettings, boolBuilder, predFactory);
// we apply resource-level predicates here, at the top level
if (isNotBlank(theResourceName)) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptions.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptions.java
index fb83caee64c..c2cb1b5bbb1 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptions.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteOptions.java
@@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.search.autocomplete;
*/
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.rest.param.TokenParamModifier;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -68,7 +68,7 @@ public class ValueSetAutocompleteOptions {
}
public static ValueSetAutocompleteOptions validateAndParseOptions(
- DaoConfig theDaoConfig,
+ JpaStorageSettings theStorageSettings,
IPrimitiveType theContext,
IPrimitiveType theFilter,
IPrimitiveType theCount,
@@ -82,7 +82,7 @@ public class ValueSetAutocompleteOptions {
if (haveId || haveIdentifier || haveValueSet) {
throw new InvalidRequestException(Msg.code(2020) + "$expand with contexDirection='existing' is only supported at the type leve. It is not supported at instance level, with a url specified, or with a ValueSet .");
}
- if (!theDaoConfig.isAdvancedHSearchIndexing()) {
+ if (!theStorageSettings.isAdvancedHSearchIndexing()) {
throw new InvalidRequestException(Msg.code(2022) + "$expand with contexDirection='existing' requires Extended Lucene Indexing.");
}
if (theContext == null || theContext.isEmpty()) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearch.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearch.java
index 55ce0353d39..4abf32164e6 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearch.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/autocomplete/ValueSetAutocompleteSearch.java
@@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.search.autocomplete;
*/
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
+import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.rest.param.TokenParam;
import org.hibernate.search.mapper.orm.session.SearchSession;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -35,14 +35,14 @@ import java.util.List;
*/
public class ValueSetAutocompleteSearch {
private final FhirContext myFhirContext;
- private final ModelConfig myModelConfig;
+ private final StorageSettings myStorageSettings;
private final TokenAutocompleteSearch myAutocompleteSearch;
static final int DEFAULT_SIZE = 30;
- public ValueSetAutocompleteSearch(FhirContext theFhirContext, ModelConfig theModelConfig, SearchSession theSession) {
+ public ValueSetAutocompleteSearch(FhirContext theFhirContext, StorageSettings theStorageSettings, SearchSession theSession) {
myFhirContext = theFhirContext;
- myModelConfig = theModelConfig;
- myAutocompleteSearch = new TokenAutocompleteSearch(myFhirContext, myModelConfig, theSession);
+ myStorageSettings = theStorageSettings;
+ myAutocompleteSearch = new TokenAutocompleteSearch(myFhirContext, myStorageSettings, theSession);
}
public IBaseResource search(ValueSetAutocompleteOptions theOptions) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java
index dba5fd1e2a8..84bd37f653a 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/QueryStack.java
@@ -25,11 +25,10 @@ import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.exception.TokenParamFormatInvalidRequestException;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.dao.BaseStorageDao;
import ca.uhn.fhir.jpa.dao.predicate.SearchFilterParser;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel;
import ca.uhn.fhir.jpa.model.entity.TagTypeEnum;
import ca.uhn.fhir.jpa.model.util.UcumServiceUtil;
@@ -137,13 +136,12 @@ public class QueryStack {
private static final Logger ourLog = LoggerFactory.getLogger(QueryStack.class);
- private final ModelConfig myModelConfig;
private final FhirContext myFhirContext;
private final SearchQueryBuilder mySqlBuilder;
private final SearchParameterMap mySearchParameters;
private final ISearchParamRegistry mySearchParamRegistry;
private final PartitionSettings myPartitionSettings;
- private final DaoConfig myDaoConfig;
+ private final JpaStorageSettings myStorageSettings;
private final EnumSet myReusePredicateBuilderTypes;
private Map myJoinMap;
// used for _offset queries with sort, should be removed once the fix is applied to the async path too.
@@ -152,24 +150,22 @@ public class QueryStack {
/**
* Constructor
*/
- public QueryStack(SearchParameterMap theSearchParameters, DaoConfig theDaoConfig, ModelConfig theModelConfig, FhirContext theFhirContext, SearchQueryBuilder theSqlBuilder, ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings) {
- this(theSearchParameters, theDaoConfig, theModelConfig, theFhirContext, theSqlBuilder, theSearchParamRegistry, thePartitionSettings, EnumSet.of(PredicateBuilderTypeEnum.DATE));
+ public QueryStack(SearchParameterMap theSearchParameters, JpaStorageSettings theStorageSettings, FhirContext theFhirContext, SearchQueryBuilder theSqlBuilder, ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings) {
+ this(theSearchParameters, theStorageSettings, theFhirContext, theSqlBuilder, theSearchParamRegistry, thePartitionSettings, EnumSet.of(PredicateBuilderTypeEnum.DATE));
}
/**
* Constructor
*/
- private QueryStack(SearchParameterMap theSearchParameters, DaoConfig theDaoConfig, ModelConfig theModelConfig, FhirContext theFhirContext, SearchQueryBuilder theSqlBuilder, ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings, EnumSet theReusePredicateBuilderTypes) {
+ private QueryStack(SearchParameterMap theSearchParameters, JpaStorageSettings theStorageSettings, FhirContext theFhirContext, SearchQueryBuilder theSqlBuilder, ISearchParamRegistry theSearchParamRegistry, PartitionSettings thePartitionSettings, EnumSet theReusePredicateBuilderTypes) {
myPartitionSettings = thePartitionSettings;
assert theSearchParameters != null;
- assert theDaoConfig != null;
- assert theModelConfig != null;
+ assert theStorageSettings != null;
assert theFhirContext != null;
assert theSqlBuilder != null;
mySearchParameters = theSearchParameters;
- myDaoConfig = theDaoConfig;
- myModelConfig = theModelConfig;
+ myStorageSettings = theStorageSettings;
myFhirContext = theFhirContext;
mySqlBuilder = theSqlBuilder;
mySearchParamRegistry = theSearchParamRegistry;
@@ -398,7 +394,7 @@ public class QueryStack {
// TODO - Change this when we have HFJ_SPIDX_MISSING table
/**
* How we search depends on if the
- * {@link DaoConfig#getIndexMissingFields()} property
+ * {@link JpaStorageSettings#getIndexMissingFields()} property
* is Enabled or Disabled.
*
* If it is, we will use the SP_MISSING values set into the various
@@ -422,7 +418,7 @@ public class QueryStack {
* that do not have a missing field (:missing=false) for much the same reason.
*/
SearchQueryBuilder sqlBuilder = theParams.getSqlBuilder();
- if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.DISABLED) {
+ if (myStorageSettings.getIndexMissingFields() == JpaStorageSettings.IndexEnabledEnum.DISABLED) {
// new search
return createMissingPredicateForUnindexedMissingFields(theParams, sqlBuilder);
} else {
@@ -884,7 +880,7 @@ public class QueryStack {
.collect(Collectors.toList());
BaseQuantityPredicateBuilder join = null;
- boolean normalizedSearchEnabled = myModelConfig.getNormalizedQuantitySearchLevel().equals(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED);
+ boolean normalizedSearchEnabled = myStorageSettings.getNormalizedQuantitySearchLevel().equals(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_SUPPORTED);
if (normalizedSearchEnabled) {
List normalizedQuantityParams = quantityParams
.stream()
@@ -1258,7 +1254,7 @@ public class QueryStack {
.collect(Collectors.toSet()));
// discrete -> contained -> discrete
updateMapOfReferenceLinks(referenceLinks, Lists.newArrayList(mergePaths(nextChain.get(0).getPath(), nextChain.get(1).getPath())), leafNodes);
- if (myModelConfig.isIndexOnContainedResourcesRecursively()) {
+ if (myStorageSettings.isIndexOnContainedResourcesRecursively()) {
// discrete -> contained -> contained
updateMapOfReferenceLinks(referenceLinks, Lists.newArrayList(),
leafNodes
@@ -1285,7 +1281,7 @@ public class QueryStack {
.stream()
.map(t -> t.withPathPrefix(nextChain.get(2).getResourceType(), nextChain.get(2).getSearchParameterName()))
.collect(Collectors.toSet()));
- if (myModelConfig.isIndexOnContainedResourcesRecursively()) {
+ if (myStorageSettings.isIndexOnContainedResourcesRecursively()) {
// discrete -> contained -> contained -> discrete
updateMapOfReferenceLinks(referenceLinks, Lists.newArrayList(mergePaths(nextChain.get(0).getPath(), nextChain.get(1).getPath(), nextChain.get(2).getPath())), leafNodes);
// discrete -> discrete -> contained -> contained
@@ -1390,7 +1386,7 @@ public class QueryStack {
}
private Condition createPredicateSource(@Nullable DbColumn theSourceJoinColumn, List extends IQueryParameterType> theList) {
- if (myDaoConfig.getStoreMetaSourceInformation() == DaoConfig.StoreMetaSourceInformationEnum.NONE) {
+ if (myStorageSettings.getStoreMetaSourceInformation() == JpaStorageSettings.StoreMetaSourceInformationEnum.NONE) {
String msg = myFhirContext.getLocalizer().getMessage(QueryStack.class, "sourceParamDisabled");
throw new InvalidRequestException(Msg.code(1216) + msg);
}
@@ -1568,10 +1564,10 @@ public class QueryStack {
if (id.isText()) {
// Check whether the :text modifier is actually enabled here
- boolean tokenTextIndexingEnabled = BaseSearchParamExtractor.tokenTextIndexingEnabledForSearchParam(myModelConfig, theSearchParam);
+ boolean tokenTextIndexingEnabled = BaseSearchParamExtractor.tokenTextIndexingEnabledForSearchParam(myStorageSettings, theSearchParam);
if (!tokenTextIndexingEnabled) {
String msg;
- if (myModelConfig.isSuppressStringIndexingInTokens()) {
+ if (myStorageSettings.isSuppressStringIndexingInTokens()) {
msg = myFhirContext.getLocalizer().getMessage(QueryStack.class, "textModifierDisabledForServer");
} else {
msg = myFhirContext.getLocalizer().getMessage(QueryStack.class, "textModifierDisabledForSearchParam");
@@ -1680,7 +1676,7 @@ public class QueryStack {
}
public QueryStack newChildQueryFactoryWithFullBuilderReuse() {
- return new QueryStack(mySearchParameters, myDaoConfig, myModelConfig, myFhirContext, mySqlBuilder, mySearchParamRegistry, myPartitionSettings, EnumSet.allOf(PredicateBuilderTypeEnum.class));
+ return new QueryStack(mySearchParameters, myStorageSettings, myFhirContext, mySqlBuilder, mySearchParamRegistry, myPartitionSettings, EnumSet.allOf(PredicateBuilderTypeEnum.class));
}
@Nullable
@@ -1700,7 +1696,7 @@ public class QueryStack {
case Constants.PARAM_TAG:
case Constants.PARAM_PROFILE:
case Constants.PARAM_SECURITY:
- if (myDaoConfig.getTagStorageMode() == DaoConfig.TagStorageModeEnum.INLINE) {
+ if (myStorageSettings.getTagStorageMode() == JpaStorageSettings.TagStorageModeEnum.INLINE) {
return createPredicateSearchParameter(theSourceJoinColumn, theResourceName, theParamName, theAndOrParams, theRequest, theRequestPartitionId);
} else {
return createPredicateTag(theSourceJoinColumn, theAndOrParams, theParamName, theRequestPartitionId);
@@ -1812,7 +1808,7 @@ public class QueryStack {
}
if (filter != null) {
- if (!myDaoConfig.isFilterParameterEnabled()) {
+ if (!myStorageSettings.isFilterParameterEnabled()) {
throw new InvalidRequestException(Msg.code(1222) + Constants.PARAM_FILTER + " parameter is disabled on this server");
}
@@ -1834,7 +1830,7 @@ public class QueryStack {
}
private boolean isEligibleForContainedResourceSearch(List extends IQueryParameterType> nextAnd) {
- return myModelConfig.isIndexOnContainedResources() &&
+ return myStorageSettings.isIndexOnContainedResources() &&
nextAnd.stream()
.filter(t -> t instanceof ReferenceParam)
.map(t -> ((ReferenceParam) t).getChain())
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java
index 6dc277c5be0..7184310d9ab 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java
@@ -30,7 +30,7 @@ import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IDao;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
@@ -50,7 +50,6 @@ import ca.uhn.fhir.jpa.interceptor.JpaPreResourceAccessDetails;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.model.entity.IBaseResourceEntity;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.model.entity.ResourceTag;
import ca.uhn.fhir.jpa.model.search.SearchRuntimeDetails;
import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage;
@@ -70,7 +69,6 @@ import ca.uhn.fhir.jpa.util.QueryChunker;
import ca.uhn.fhir.jpa.util.QueryParameterUtils;
import ca.uhn.fhir.jpa.util.SqlQueryList;
import ca.uhn.fhir.model.api.IQueryParameterType;
-import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
@@ -162,14 +160,13 @@ public class SearchBuilder implements ISearchBuilder {
private final HapiFhirLocalContainerEntityManagerFactoryBean myEntityManagerFactory;
private final SqlObjectFactory mySqlBuilderFactory;
private final HibernatePropertiesProvider myDialectProvider;
- private final ModelConfig myModelConfig;
private final ISearchParamRegistry mySearchParamRegistry;
private final PartitionSettings myPartitionSettings;
private final DaoRegistry myDaoRegistry;
private final IResourceSearchViewDao myResourceSearchViewDao;
private final FhirContext myContext;
private final IIdHelperService myIdHelperService;
- private final DaoConfig myDaoConfig;
+ private final JpaStorageSettings myStorageSettings;
private final IDao myCallingDao;
@PersistenceContext(type = PersistenceContextType.TRANSACTION)
protected EntityManager myEntityManager;
@@ -195,11 +192,10 @@ public class SearchBuilder implements ISearchBuilder {
public SearchBuilder(
IDao theDao,
String theResourceName,
- DaoConfig theDaoConfig,
+ JpaStorageSettings theStorageSettings,
HapiFhirLocalContainerEntityManagerFactoryBean theEntityManagerFactory,
SqlObjectFactory theSqlBuilderFactory,
HibernatePropertiesProvider theDialectProvider,
- ModelConfig theModelConfig,
ISearchParamRegistry theSearchParamRegistry,
PartitionSettings thePartitionSettings,
IInterceptorBroadcaster theInterceptorBroadcaster,
@@ -213,12 +209,11 @@ public class SearchBuilder implements ISearchBuilder {
myCallingDao = theDao;
myResourceName = theResourceName;
myResourceType = theResourceType;
- myDaoConfig = theDaoConfig;
+ myStorageSettings = theStorageSettings;
myEntityManagerFactory = theEntityManagerFactory;
mySqlBuilderFactory = theSqlBuilderFactory;
myDialectProvider = theDialectProvider;
- myModelConfig = theModelConfig;
mySearchParamRegistry = theSearchParamRegistry;
myPartitionSettings = thePartitionSettings;
myInterceptorBroadcaster = theInterceptorBroadcaster;
@@ -281,7 +276,7 @@ public class SearchBuilder implements ISearchBuilder {
* parameters all have no modifiers.
*/
private boolean isCompositeUniqueSpCandidate() {
- return myDaoConfig.isUniqueIndexesEnabled() &&
+ return myStorageSettings.isUniqueIndexesEnabled() &&
myParams.getEverythingMode() == null &&
myParams.isAllParametersHaveNoModifier();
}
@@ -442,7 +437,7 @@ public class SearchBuilder implements ISearchBuilder {
private List executeLastNAgainstIndex(Integer theMaximumResults) {
// Can we use our hibernate search generated index on resource to support lastN?:
- if (myDaoConfig.isAdvancedHSearchIndexing()) {
+ if (myStorageSettings.isAdvancedHSearchIndexing()) {
if (myFulltextSearchSvc == null) {
throw new InvalidRequestException(Msg.code(2027) + "LastN operation is not enabled on this service, can not process this request");
}
@@ -529,8 +524,8 @@ public class SearchBuilder implements ISearchBuilder {
private Optional createChunkedQuery(SearchParameterMap theParams, SortSpec sort, Integer theOffset, Integer theMaximumResults, boolean theCountOnlyFlag, RequestDetails theRequest, List thePidList) {
String sqlBuilderResourceName = myParams.getEverythingMode() == null ? myResourceName : null;
- SearchQueryBuilder sqlBuilder = new SearchQueryBuilder(myContext, myDaoConfig.getModelConfig(), myPartitionSettings, myRequestPartitionId, sqlBuilderResourceName, mySqlBuilderFactory, myDialectProvider, theCountOnlyFlag);
- QueryStack queryStack3 = new QueryStack(theParams, myDaoConfig, myDaoConfig.getModelConfig(), myContext, sqlBuilder, mySearchParamRegistry, myPartitionSettings);
+ SearchQueryBuilder sqlBuilder = new SearchQueryBuilder(myContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, sqlBuilderResourceName, mySqlBuilderFactory, myDialectProvider, theCountOnlyFlag);
+ QueryStack queryStack3 = new QueryStack(theParams, myStorageSettings, myContext, sqlBuilder, mySearchParamRegistry, myPartitionSettings);
if (theParams.keySet().size() > 1 || theParams.getSort() != null || theParams.keySet().contains(Constants.PARAM_HAS) || isPotentiallyContainedReferenceParameterExistsAtRoot(theParams)) {
List activeComboParams = mySearchParamRegistry.getActiveComboSearchParams(myResourceName, theParams.keySet());
@@ -554,7 +549,7 @@ public class SearchBuilder implements ISearchBuilder {
// is basically a reverse-include search. For type/Everything (as opposed to instance/Everything)
// the one problem with this approach is that it doesn't catch Patients that have absolutely
// nothing linked to them. So we do one additional query to make sure we catch those too.
- SearchQueryBuilder fetchPidsSqlBuilder = new SearchQueryBuilder(myContext, myDaoConfig.getModelConfig(), myPartitionSettings, myRequestPartitionId, myResourceName, mySqlBuilderFactory, myDialectProvider, theCountOnlyFlag);
+ SearchQueryBuilder fetchPidsSqlBuilder = new SearchQueryBuilder(myContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, myResourceName, mySqlBuilderFactory, myDialectProvider, theCountOnlyFlag);
GeneratedSql allTargetsSql = fetchPidsSqlBuilder.generate(theOffset, myMaxResultsToFetch);
String sql = allTargetsSql.getSql();
Object[] args = allTargetsSql.getBindVariables().toArray(new Object[0]);
@@ -696,7 +691,7 @@ public class SearchBuilder implements ISearchBuilder {
}
private boolean isPotentiallyContainedReferenceParameterExistsAtRoot(SearchParameterMap theParams) {
- return myModelConfig.isIndexOnContainedResources() && theParams.values().stream()
+ return myStorageSettings.isIndexOnContainedResources() && theParams.values().stream()
.flatMap(Collection::stream)
.flatMap(Collection::stream)
.anyMatch(t -> t instanceof ReferenceParam);
@@ -843,7 +838,7 @@ public class SearchBuilder implements ISearchBuilder {
Map resourcePidToVersion = null;
for (JpaPid next : thePids) {
- if (next.getVersion() != null && myModelConfig.isRespectVersionsForSearchIncludes()) {
+ if (next.getVersion() != null && myStorageSettings.isRespectVersionsForSearchIncludes()) {
if (resourcePidToVersion == null) {
resourcePidToVersion = new HashMap<>();
}
@@ -999,8 +994,8 @@ public class SearchBuilder implements ISearchBuilder {
*/
private boolean isLoadingFromElasticSearchSupported(Collection thePids) {
// is storage enabled?
- return myDaoConfig.isStoreResourceInHSearchIndex() &&
- myDaoConfig.isAdvancedHSearchIndexing() &&
+ return myStorageSettings.isStoreResourceInHSearchIndex() &&
+ myStorageSettings.isAdvancedHSearchIndexing() &&
// we don't support history
thePids.stream().noneMatch(p -> p.getVersion() != null) &&
// skip the complexity for metadata in dstu2
@@ -1010,7 +1005,7 @@ public class SearchBuilder implements ISearchBuilder {
private List loadResourcesFromElasticSearch(Collection thePids) {
// Do we use the fulltextsvc via hibernate-search to load resources or be backwards compatible with older ES only impl
// to handle lastN?
- if (myDaoConfig.isAdvancedHSearchIndexing() && myDaoConfig.isStoreResourceInHSearchIndex()) {
+ if (myStorageSettings.isAdvancedHSearchIndexing() && myStorageSettings.isStoreResourceInHSearchIndex()) {
List pidList = thePids.stream().map(pid -> (pid).getId()).collect(Collectors.toList());
List resources = myFulltextSearchSvc.getResources(pidList);
@@ -1041,7 +1036,7 @@ public class SearchBuilder implements ISearchBuilder {
String findPidFieldName = theReverseMode ? MY_SOURCE_RESOURCE_PID : MY_TARGET_RESOURCE_PID;
String findResourceTypeFieldName = theReverseMode ? MY_SOURCE_RESOURCE_TYPE : MY_TARGET_RESOURCE_TYPE;
String findVersionFieldName = null;
- if (!theReverseMode && myModelConfig.isRespectVersionsForSearchIncludes()) {
+ if (!theReverseMode && myStorageSettings.isRespectVersionsForSearchIncludes()) {
findVersionFieldName = MY_TARGET_RESOURCE_VERSION;
}
@@ -1567,7 +1562,7 @@ public class SearchBuilder implements ISearchBuilder {
} else if (myParams.getOffset() != null && myParams.getCount() != null) {
myMaxResultsToFetch = myParams.getCount();
} else {
- myMaxResultsToFetch = myDaoConfig.getFetchSizeDefaultMaximum();
+ myMaxResultsToFetch = myStorageSettings.getFetchSizeDefaultMaximum();
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BasePredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BasePredicateBuilder.java
index a328fb7fb0e..6ecaf6b8836 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BasePredicateBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/BasePredicateBuilder.java
@@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.search.builder.predicate;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
+import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryBuilder;
import ca.uhn.fhir.rest.param.ParamPrefixEnum;
import com.healthmarketscience.sqlbuilder.BinaryCondition;
@@ -55,8 +55,8 @@ public abstract class BasePredicateBuilder {
return mySearchSqlBuilder.getResourceType();
}
- ModelConfig getModelConfig() {
- return mySearchSqlBuilder.getModelConfig();
+ StorageSettings getStorageSettings() {
+ return mySearchSqlBuilder.getStorageSettings();
}
@Nonnull
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/DatePredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/DatePredicateBuilder.java
index 7ad2dd2a2b8..eb3d71240d0 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/DatePredicateBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/DatePredicateBuilder.java
@@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.search.builder.predicate;
*/
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.dao.predicate.SearchFilterParser;
import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryBuilder;
import ca.uhn.fhir.model.api.IQueryParameterType;
@@ -49,7 +49,7 @@ public class DatePredicateBuilder extends BaseSearchParamPredicateBuilder {
private final DbColumn myColumnValueLowDateOrdinal;
private final DbColumn myColumnValueHighDateOrdinal;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
/**
* Constructor
@@ -64,8 +64,8 @@ public class DatePredicateBuilder extends BaseSearchParamPredicateBuilder {
}
@VisibleForTesting
- public void setDaoConfigForUnitTest(DaoConfig theDaoConfig) {
- myDaoConfig = theDaoConfig;
+ public void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) {
+ myStorageSettings = theStorageSettings;
}
public Condition createPredicateDateWithoutIdentityPredicate(IQueryParameterType theParam,
@@ -109,10 +109,10 @@ public class DatePredicateBuilder extends BaseSearchParamPredicateBuilder {
Comparable> genericUpperBound;
/*
- * If all present search parameters are of DAY precision, and {@link ca.uhn.fhir.jpa.model.entity.ModelConfig#getUseOrdinalDatesForDayPrecisionSearches()} is true,
+ * If all present search parameters are of DAY precision, and {@link ca.uhn.fhir.jpa.model.entity.StorageSettings#getUseOrdinalDatesForDayPrecisionSearches()} is true,
* then we attempt to use the ordinal field for date comparisons instead of the date field.
*/
- boolean isOrdinalComparison = isNullOrDatePrecision(lowerBound) && isNullOrDatePrecision(upperBound) && myDaoConfig.getModelConfig().getUseOrdinalDatesForDayPrecisionSearches();
+ boolean isOrdinalComparison = isNullOrDatePrecision(lowerBound) && isNullOrDatePrecision(upperBound) && myStorageSettings.getUseOrdinalDatesForDayPrecisionSearches();
Condition lt;
Condition gt;
@@ -144,12 +144,12 @@ public class DatePredicateBuilder extends BaseSearchParamPredicateBuilder {
// use lower bound first
if (lowerBoundInstant != null) {
lb = this.createPredicate(lowValueField, ParamPrefixEnum.LESSTHAN_OR_EQUALS, genericLowerBound);
- if (myDaoConfig.isAccountForDateIndexNulls()) {
+ if (myStorageSettings.isAccountForDateIndexNulls()) {
lb = ComboCondition.or(lb, this.createPredicate(highValueField, ParamPrefixEnum.LESSTHAN_OR_EQUALS, genericLowerBound));
}
} else if (upperBoundInstant != null) {
ub = this.createPredicate(lowValueField, ParamPrefixEnum.LESSTHAN_OR_EQUALS, genericUpperBound);
- if (myDaoConfig.isAccountForDateIndexNulls()) {
+ if (myStorageSettings.isAccountForDateIndexNulls()) {
ub = ComboCondition.or(ub, this.createPredicate(highValueField, ParamPrefixEnum.LESSTHAN_OR_EQUALS, genericUpperBound));
}
} else {
@@ -159,12 +159,12 @@ public class DatePredicateBuilder extends BaseSearchParamPredicateBuilder {
// use upper bound first, e.g value between 6 and 10
if (upperBoundInstant != null) {
ub = this.createPredicate(highValueField, ParamPrefixEnum.GREATERTHAN_OR_EQUALS, genericUpperBound);
- if (myDaoConfig.isAccountForDateIndexNulls()) {
+ if (myStorageSettings.isAccountForDateIndexNulls()) {
ub = ComboCondition.or(ub, this.createPredicate(lowValueField, ParamPrefixEnum.GREATERTHAN_OR_EQUALS, genericUpperBound));
}
} else if (lowerBoundInstant != null) {
lb = this.createPredicate(highValueField, ParamPrefixEnum.GREATERTHAN_OR_EQUALS, genericLowerBound);
- if (myDaoConfig.isAccountForDateIndexNulls()) {
+ if (myStorageSettings.isAccountForDateIndexNulls()) {
lb = ComboCondition.or(lb, this.createPredicate(lowValueField, ParamPrefixEnum.GREATERTHAN_OR_EQUALS, genericLowerBound));
}
} else {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ICanMakeMissingParamPredicate.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ICanMakeMissingParamPredicate.java
index ed481ca2c7b..4d847d17037 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ICanMakeMissingParamPredicate.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ICanMakeMissingParamPredicate.java
@@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.search.builder.predicate;
* #L%
*/
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.search.builder.models.MissingQueryParameterPredicateParams;
import com.healthmarketscience.sqlbuilder.Condition;
@@ -29,7 +29,7 @@ public interface ICanMakeMissingParamPredicate {
* Creates the condition for searching for a missing field
* for a given SearchParameter type.
*
- * Only use if {@link DaoConfig#getIndexMissingFields()} is disabled
+ * Only use if {@link JpaStorageSettings#getIndexMissingFields()} is disabled
*/
Condition createPredicateParamMissingValue(MissingQueryParameterPredicateParams theParams);
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceLinkPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceLinkPredicateBuilder.java
index 94bde557a48..73f9c46af6b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceLinkPredicateBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/ResourceLinkPredicateBuilder.java
@@ -32,7 +32,7 @@ import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IDao;
import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
@@ -114,7 +114,7 @@ public class ResourceLinkPredicateBuilder
private final boolean myReversed;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@Autowired
private IInterceptorBroadcaster myInterceptorBroadcaster;
@Autowired
@@ -195,7 +195,7 @@ public class ResourceLinkPredicateBuilder
IIdType dt = new IdDt(ref.getBaseUrl(), ref.getResourceType(), ref.getIdPart(), null);
if (dt.hasBaseUrl()) {
- if (myDaoConfig.getTreatBaseUrlsAsLocal().contains(dt.getBaseUrl())) {
+ if (myStorageSettings.getTreatBaseUrlsAsLocal().contains(dt.getBaseUrl())) {
dt = dt.toUnqualified();
targetIds.add(dt);
} else {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/StringPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/StringPredicateBuilder.java
index d47d3776015..5fe66ae74b2 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/StringPredicateBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/StringPredicateBuilder.java
@@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.search.builder.predicate;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.RuntimeSearchParam;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.dao.predicate.SearchFilterParser;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString;
import ca.uhn.fhir.jpa.util.QueryParameterUtils;
@@ -51,7 +51,7 @@ public class StringPredicateBuilder extends BaseSearchParamPredicateBuilder {
private final DbColumn myColumnHashIdentity;
private final DbColumn myColumnHashExact;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
/**
* Constructor
@@ -94,7 +94,7 @@ public class StringPredicateBuilder extends BaseSearchParamPredicateBuilder {
StringParam id = (StringParam) theParameter;
rawSearchTerm = id.getValue();
if (id.isContains()) {
- if (!myDaoConfig.isAllowContainsSearches()) {
+ if (!myStorageSettings.isAllowContainsSearches()) {
throw new MethodNotAllowedException(Msg.code(1258) + ":contains modifier is disabled on this server");
}
} else {
@@ -122,7 +122,7 @@ public class StringPredicateBuilder extends BaseSearchParamPredicateBuilder {
String likeExpression;
if ((theParameter instanceof StringParam) &&
(((((StringParam) theParameter).isContains()) &&
- (myDaoConfig.isAllowContainsSearches())) ||
+ (myStorageSettings.isAllowContainsSearches())) ||
(operation == SearchFilterParser.CompareOperation.co))) {
likeExpression = createLeftAndRightMatchLikeExpression(normalizedString);
} else if ((operation != SearchFilterParser.CompareOperation.ne) &&
@@ -174,7 +174,7 @@ public class StringPredicateBuilder extends BaseSearchParamPredicateBuilder {
@Nonnull
public Condition createPredicateNormalLike(String theResourceType, String theParamName, String theNormalizedString, String theLikeExpression) {
- Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionSettings(), getRequestPartitionId(), getModelConfig(), theResourceType, theParamName, theNormalizedString);
+ Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionSettings(), getRequestPartitionId(), getStorageSettings(), theResourceType, theParamName, theNormalizedString);
Condition hashPredicate = BinaryCondition.equalTo(myColumnHashNormPrefix, generatePlaceholder(hash));
Condition valuePredicate = BinaryCondition.like(myColumnValueNormalized, generatePlaceholder(theLikeExpression));
return ComboCondition.and(hashPredicate, valuePredicate);
@@ -182,7 +182,7 @@ public class StringPredicateBuilder extends BaseSearchParamPredicateBuilder {
@Nonnull
public Condition createPredicateNormal(String theResourceType, String theParamName, String theNormalizedString) {
- Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionSettings(), getRequestPartitionId(), getModelConfig(), theResourceType, theParamName, theNormalizedString);
+ Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionSettings(), getRequestPartitionId(), getStorageSettings(), theResourceType, theParamName, theNormalizedString);
Condition hashPredicate = BinaryCondition.equalTo(myColumnHashNormPrefix, generatePlaceholder(hash));
Condition valuePredicate = BinaryCondition.equalTo(myColumnValueNormalized, generatePlaceholder(theNormalizedString));
return ComboCondition.and(hashPredicate, valuePredicate);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java
index 91a3d86cd2e..48fcc05c98d 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/predicate/TokenPredicateBuilder.java
@@ -32,14 +32,13 @@ import ca.uhn.fhir.context.support.ValidationSupportContext;
import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.dao.predicate.SearchFilterParser;
import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken;
-import ca.uhn.fhir.jpa.util.QueryParameterUtils;
import ca.uhn.fhir.jpa.search.builder.sql.SearchQueryBuilder;
import ca.uhn.fhir.jpa.term.api.ITermReadSvc;
+import ca.uhn.fhir.jpa.util.QueryParameterUtils;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
@@ -67,9 +66,6 @@ import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
-import static ca.uhn.fhir.jpa.util.QueryParameterUtils.toAndPredicate;
-import static ca.uhn.fhir.jpa.util.QueryParameterUtils.toEqualToOrInPredicate;
-import static ca.uhn.fhir.jpa.util.QueryParameterUtils.toOrPredicate;
import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
@@ -88,11 +84,9 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder {
@Autowired
private ITermReadSvc myTerminologySvc;
@Autowired
- private ModelConfig myModelConfig;
- @Autowired
private FhirContext myContext;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
/**
* Constructor
@@ -181,7 +175,7 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder {
if (modifier == TokenParamModifier.IN || modifier == TokenParamModifier.NOT_IN) {
if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU2)) {
ValueSetExpansionOptions valueSetExpansionOptions = new ValueSetExpansionOptions();
- valueSetExpansionOptions.setCount(myDaoConfig.getMaximumExpansionSize());
+ valueSetExpansionOptions.setCount(myStorageSettings.getMaximumExpansionSize());
IValidationSupport.ValueSetExpansionOutcome expanded = myValidationSupport.expandValueSet(new ValidationSupportContext(myValidationSupport), valueSetExpansionOptions, code);
codes.addAll(extractValueSetCodes(expanded.getValueSet()));
@@ -200,7 +194,7 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder {
validateHaveSystemAndCodeForToken(paramName, code, system);
codes.addAll(myTerminologySvc.findCodesBelow(system, code));
} else if (modifier == TokenParamModifier.OF_TYPE) {
- if (!myModelConfig.isIndexIdentifierOfType()) {
+ if (!myStorageSettings.isIndexIdentifierOfType()) {
throw new MethodNotAllowedException(Msg.code(2012) + "The :of-type modifier is not enabled on this server");
}
if (isBlank(system) || isBlank(code)) {
@@ -270,7 +264,7 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder {
BaseRuntimeElementCompositeDefinition> expansionDef = (BaseRuntimeElementCompositeDefinition>) myContext.getElementDefinition(expansion.getClass());
BaseRuntimeChildDefinition containsChild = expansionDef.getChildByName("contains");
List contains = containsChild.getAccessor().getValues(expansion);
-
+
BaseRuntimeChildDefinition.IAccessor systemAccessor = null;
BaseRuntimeChildDefinition.IAccessor codeAccessor = null;
for (IBase nextContains : contains) {
@@ -282,13 +276,13 @@ public class TokenPredicateBuilder extends BaseSearchParamPredicateBuilder {
}
String system = systemAccessor
.getFirstValueOrNull(nextContains)
- .map(t->(IPrimitiveType>)t)
- .map(t->t.getValueAsString())
+ .map(t -> (IPrimitiveType>) t)
+ .map(t -> t.getValueAsString())
.orElse(null);
String code = codeAccessor
.getFirstValueOrNull(nextContains)
- .map(t->(IPrimitiveType>)t)
- .map(t->t.getValueAsString())
+ .map(t -> (IPrimitiveType>) t)
+ .map(t -> t.getValueAsString())
.orElse(null);
if (isNotBlank(system) && isNotBlank(code)) {
retVal.add(new FhirVersionIndependentConcept(system, code));
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilder.java
index e3605e4970c..d098599650e 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/sql/SearchQueryBuilder.java
@@ -26,7 +26,7 @@ import ca.uhn.fhir.interceptor.model.RequestPartitionId;
import ca.uhn.fhir.jpa.config.HibernatePropertiesProvider;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
-import ca.uhn.fhir.jpa.model.entity.ModelConfig;
+import ca.uhn.fhir.jpa.model.entity.StorageSettings;
import ca.uhn.fhir.jpa.search.builder.QueryStack;
import ca.uhn.fhir.jpa.search.builder.predicate.BaseJoiningPredicateBuilder;
import ca.uhn.fhir.jpa.search.builder.predicate.ComboNonUniqueSearchParameterPredicateBuilder;
@@ -97,7 +97,7 @@ public class SearchQueryBuilder {
private final PartitionSettings myPartitionSettings;
private final RequestPartitionId myRequestPartitionId;
private final String myResourceType;
- private final ModelConfig myModelConfig;
+ private final StorageSettings myStorageSettings;
private final FhirContext myFhirContext;
private final SqlObjectFactory mySqlBuilderFactory;
private final boolean myCountQuery;
@@ -113,16 +113,16 @@ public class SearchQueryBuilder {
/**
* Constructor
*/
- public SearchQueryBuilder(FhirContext theFhirContext, ModelConfig theModelConfig, PartitionSettings thePartitionSettings, RequestPartitionId theRequestPartitionId, String theResourceType, SqlObjectFactory theSqlBuilderFactory, HibernatePropertiesProvider theDialectProvider, boolean theCountQuery) {
- this(theFhirContext, theModelConfig, thePartitionSettings, theRequestPartitionId, theResourceType, theSqlBuilderFactory, UUID.randomUUID() + "-", theDialectProvider.getDialect(), theCountQuery, new ArrayList<>());
+ public SearchQueryBuilder(FhirContext theFhirContext, StorageSettings theStorageSettings, PartitionSettings thePartitionSettings, RequestPartitionId theRequestPartitionId, String theResourceType, SqlObjectFactory theSqlBuilderFactory, HibernatePropertiesProvider theDialectProvider, boolean theCountQuery) {
+ this(theFhirContext, theStorageSettings, thePartitionSettings, theRequestPartitionId, theResourceType, theSqlBuilderFactory, UUID.randomUUID() + "-", theDialectProvider.getDialect(), theCountQuery, new ArrayList<>());
}
/**
* Constructor for child SQL Builders
*/
- private SearchQueryBuilder(FhirContext theFhirContext, ModelConfig theModelConfig, PartitionSettings thePartitionSettings, RequestPartitionId theRequestPartitionId, String theResourceType, SqlObjectFactory theSqlBuilderFactory, String theBindVariableSubstitutionBase, Dialect theDialect, boolean theCountQuery, ArrayList theBindVariableValues) {
+ private SearchQueryBuilder(FhirContext theFhirContext, StorageSettings theStorageSettings, PartitionSettings thePartitionSettings, RequestPartitionId theRequestPartitionId, String theResourceType, SqlObjectFactory theSqlBuilderFactory, String theBindVariableSubstitutionBase, Dialect theDialect, boolean theCountQuery, ArrayList theBindVariableValues) {
myFhirContext = theFhirContext;
- myModelConfig = theModelConfig;
+ myStorageSettings = theStorageSettings;
myPartitionSettings = thePartitionSettings;
myRequestPartitionId = theRequestPartitionId;
myResourceType = theResourceType;
@@ -438,12 +438,6 @@ public class SearchQueryBuilder {
mySelect.addJoins(SelectQuery.JoinType.INNER, join);
}
- public void addJoinWithCustomOnCondition(DbTable theFromTable, DbTable theToTable, DbColumn theFromColumn, DbColumn theToColumn, Condition theCondition) {
- Join join = new DbJoin(mySpec, theFromTable, theToTable, new DbColumn[]{theFromColumn}, new DbColumn[]{theToColumn});
- // add hashIdentity codition here
- mySelect.addJoins(SelectQuery.JoinType.INNER, join);
- }
-
/**
* Generate and return the SQL generated by this builder
*/
@@ -598,7 +592,7 @@ public class SearchQueryBuilder {
public List generatePlaceholders(Collection> theValues) {
return theValues
.stream()
- .map(t -> generatePlaceholder(t))
+ .map(this::generatePlaceholder)
.collect(Collectors.toList());
}
@@ -627,8 +621,8 @@ public class SearchQueryBuilder {
return myResourceType;
}
- public ModelConfig getModelConfig() {
- return myModelConfig;
+ public StorageSettings getStorageSettings() {
+ return myStorageSettings;
}
public void addPredicate(@Nonnull Condition theCondition) {
@@ -708,13 +702,17 @@ public class SearchQueryBuilder {
return BinaryCondition.greaterThanOrEq(theColumn, generatePlaceholder(theValue));
case NOT_EQUAL:
return BinaryCondition.notEqualTo(theColumn, generatePlaceholder(theValue));
+ case STARTS_AFTER:
+ case APPROXIMATE:
+ case ENDS_BEFORE:
+ case EQUAL:
default:
throw new IllegalArgumentException(Msg.code(1263));
}
}
public SearchQueryBuilder newChildSqlBuilder() {
- return new SearchQueryBuilder(myFhirContext, myModelConfig, myPartitionSettings, myRequestPartitionId, myResourceType, mySqlBuilderFactory, myBindVariableSubstitutionBase, myDialect, false, myBindVariableValues);
+ return new SearchQueryBuilder(myFhirContext, myStorageSettings, myPartitionSettings, myRequestPartitionId, myResourceType, mySqlBuilderFactory, myBindVariableSubstitutionBase, myDialect, false, myBindVariableValues);
}
public SelectQuery getSelect() {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchContinuationTask.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchContinuationTask.java
index 18098c4f82a..6d4bec2f6a1 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchContinuationTask.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchContinuationTask.java
@@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.search.builder.tasks;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.dao.SearchBuilderFactory;
import ca.uhn.fhir.jpa.model.dao.JpaPid;
import ca.uhn.fhir.jpa.dao.tx.HapiTransactionService;
@@ -50,7 +50,7 @@ public class SearchContinuationTask extends SearchTask {
IInterceptorBroadcaster theInterceptorBroadcaster,
SearchBuilderFactory theSearchBuilderFactory,
ISearchResultCacheSvc theSearchResultCacheSvc,
- DaoConfig theDaoConfig,
+ JpaStorageSettings theStorageSettings,
ISearchCacheSvc theSearchCacheSvc,
IPagingProvider thePagingProvider,
ExceptionService theExceptionSvc
@@ -62,7 +62,7 @@ public class SearchContinuationTask extends SearchTask {
theInterceptorBroadcaster,
theSearchBuilderFactory,
theSearchResultCacheSvc,
- theDaoConfig,
+ theStorageSettings,
theSearchCacheSvc,
thePagingProvider
);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchTask.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchTask.java
index 04c77c6fea3..759457b8d3f 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchTask.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/tasks/SearchTask.java
@@ -26,7 +26,7 @@ import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.IDao;
import ca.uhn.fhir.jpa.dao.IResultIterator;
import ca.uhn.fhir.jpa.dao.ISearchBuilder;
@@ -124,7 +124,7 @@ public class SearchTask implements Callable {
private final IInterceptorBroadcaster myInterceptorBroadcaster;
private final SearchBuilderFactory mySearchBuilderFactory;
protected final ISearchResultCacheSvc mySearchResultCacheSvc;
- private final DaoConfig myDaoConfig;
+ private final JpaStorageSettings myStorageSettings;
private final ISearchCacheSvc mySearchCacheSvc;
private final IPagingProvider myPagingProvider;
@@ -138,7 +138,7 @@ public class SearchTask implements Callable {
IInterceptorBroadcaster theInterceptorBroadcaster,
SearchBuilderFactory theSearchBuilderFactory,
ISearchResultCacheSvc theSearchResultCacheSvc,
- DaoConfig theDaoConfig,
+ JpaStorageSettings theStorageSettings,
ISearchCacheSvc theSearchCacheSvc,
IPagingProvider thePagingProvider
) {
@@ -148,7 +148,7 @@ public class SearchTask implements Callable {
myInterceptorBroadcaster = theInterceptorBroadcaster;
mySearchBuilderFactory = theSearchBuilderFactory;
mySearchResultCacheSvc = theSearchResultCacheSvc;
- myDaoConfig = theDaoConfig;
+ myStorageSettings = theStorageSettings;
mySearchCacheSvc = theSearchCacheSvc;
myPagingProvider = thePagingProvider;
@@ -341,9 +341,9 @@ public class SearchTask implements Callable {
numSynced = mySyncedPids.size();
}
- if (myDaoConfig.getCountSearchResultsUpTo() == null ||
- myDaoConfig.getCountSearchResultsUpTo() <= 0 ||
- myDaoConfig.getCountSearchResultsUpTo() <= numSynced) {
+ if (myStorageSettings.getCountSearchResultsUpTo() == null ||
+ myStorageSettings.getCountSearchResultsUpTo() <= 0 ||
+ myStorageSettings.getCountSearchResultsUpTo() <= numSynced) {
myInitialCollectionLatch.countDown();
}
@@ -487,7 +487,7 @@ public class SearchTask implements Callable {
* before doing anything else.
*/
boolean myParamWantOnlyCount = isWantOnlyCount(myParams);
- boolean myParamOrDefaultWantCount = nonNull(myParams.getSearchTotalMode()) ? isWantCount(myParams) : SearchParameterMapCalculator.isWantCount(myDaoConfig.getDefaultTotalMode());
+ boolean myParamOrDefaultWantCount = nonNull(myParams.getSearchTotalMode()) ? isWantCount(myParams) : SearchParameterMapCalculator.isWantCount(myStorageSettings.getDefaultTotalMode());
if (myParamWantOnlyCount || myParamOrDefaultWantCount) {
ourLog.trace("Performing count");
@@ -524,7 +524,7 @@ public class SearchTask implements Callable {
/*
* Figure out how many results we're actually going to fetch from the
* database in this pass. This calculation takes into consideration the
- * "pre-fetch thresholds" specified in DaoConfig#getSearchPreFetchThresholds()
+ * "pre-fetch thresholds" specified in StorageSettings#getSearchPreFetchThresholds()
* as well as the value of the _count parameter.
*/
int currentlyLoaded = defaultIfNull(mySearch.getNumFound(), 0);
@@ -535,7 +535,7 @@ public class SearchTask implements Callable {
minWanted += currentlyLoaded;
}
- for (Iterator iter = myDaoConfig.getSearchPreFetchThresholds().iterator(); iter.hasNext(); ) {
+ for (Iterator iter = myStorageSettings.getSearchPreFetchThresholds().iterator(); iter.hasNext(); ) {
int next = iter.next();
if (next != -1 && next <= currentlyLoaded) {
continue;
@@ -599,9 +599,9 @@ public class SearchTask implements Callable {
boolean shouldSync = myUnsyncedPids.size() >= syncSize;
- if (myDaoConfig.getCountSearchResultsUpTo() != null &&
- myDaoConfig.getCountSearchResultsUpTo() > 0 &&
- myDaoConfig.getCountSearchResultsUpTo() < myUnsyncedPids.size()) {
+ if (myStorageSettings.getCountSearchResultsUpTo() != null &&
+ myStorageSettings.getCountSearchResultsUpTo() > 0 &&
+ myStorageSettings.getCountSearchResultsUpTo() < myUnsyncedPids.size()) {
shouldSync = false;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/cache/DatabaseSearchCacheSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/cache/DatabaseSearchCacheSvcImpl.java
index 61309724438..6e1d5128a1f 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/cache/DatabaseSearchCacheSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/cache/DatabaseSearchCacheSvcImpl.java
@@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.search.cache;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.dao.data.ISearchDao;
import ca.uhn.fhir.jpa.dao.data.ISearchIncludeDao;
import ca.uhn.fhir.jpa.dao.data.ISearchResultDao;
@@ -81,7 +81,7 @@ public class DatabaseSearchCacheSvcImpl implements ISearchCacheSvc {
@Autowired
private PlatformTransactionManager myTxManager;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@VisibleForTesting
public void setCutoffSlackForUnitTest(long theCutoffSlack) {
@@ -156,13 +156,13 @@ public class DatabaseSearchCacheSvcImpl implements ISearchCacheSvc {
@Transactional(propagation = Propagation.NEVER)
@Override
public void pollForStaleSearchesAndDeleteThem() {
- if (!myDaoConfig.isExpireSearchResults()) {
+ if (!myStorageSettings.isExpireSearchResults()) {
return;
}
- long cutoffMillis = myDaoConfig.getExpireSearchResultsAfterMillis();
- if (myDaoConfig.getReuseCachedSearchResultsForMillis() != null) {
- cutoffMillis = cutoffMillis + myDaoConfig.getReuseCachedSearchResultsForMillis();
+ long cutoffMillis = myStorageSettings.getExpireSearchResultsAfterMillis();
+ if (myStorageSettings.getReuseCachedSearchResultsForMillis() != null) {
+ cutoffMillis = cutoffMillis + myStorageSettings.getReuseCachedSearchResultsForMillis();
}
final Date cutoff = new Date((now() - cutoffMillis) - myCutoffSlack);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java
index 3bc53c3412f..ee58c5e4db9 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/elastic/IndexNamePrefixLayoutStrategy.java
@@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.search.elastic;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.search.backend.elasticsearch.index.layout.IndexLayoutStrategy;
import org.hibernate.search.backend.elasticsearch.logging.impl.Log;
@@ -37,43 +37,48 @@ import java.util.regex.Pattern;
/**
* This class instructs hibernate search on how to create index names for indexed entities.
* In our case, we use this class to add an optional prefix to all indices which are created, which can be controlled via
- * {@link DaoConfig#setHSearchIndexPrefix(String)}.
+ * {@link JpaStorageSettings#setHSearchIndexPrefix(String)}.
*/
@Service
public class IndexNamePrefixLayoutStrategy implements IndexLayoutStrategy {
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
static final Log log = LoggerFactory.make(Log.class, MethodHandles.lookup());
public static final String NAME = "prefix";
public static final Pattern UNIQUE_KEY_EXTRACTION_PATTERN = Pattern.compile("(.*)-\\d{6}");
+ @Override
public String createInitialElasticsearchIndexName(String hibernateSearchIndexName) {
return addPrefixIfNecessary(hibernateSearchIndexName + "-000001");
}
+ @Override
public String createWriteAlias(String hibernateSearchIndexName) {
return addPrefixIfNecessary(hibernateSearchIndexName +"-write");
}
+ @Override
public String createReadAlias(String hibernateSearchIndexName) {
return addPrefixIfNecessary(hibernateSearchIndexName + "-read");
}
private String addPrefixIfNecessary(String theCandidateName) {
- validateDaoConfigIsPresent();
- if (!StringUtils.isBlank(myDaoConfig.getHSearchIndexPrefix())) {
- return myDaoConfig.getHSearchIndexPrefix() + "-" + theCandidateName;
+ validateStorageSettingsIsPresent();
+ if (!StringUtils.isBlank(myStorageSettings.getHSearchIndexPrefix())) {
+ return myStorageSettings.getHSearchIndexPrefix() + "-" + theCandidateName;
} else {
return theCandidateName;
}
}
+ @Override
public String extractUniqueKeyFromHibernateSearchIndexName(String hibernateSearchIndexName) {
return hibernateSearchIndexName;
}
+ @Override
public String extractUniqueKeyFromElasticsearchIndexName(String elasticsearchIndexName) {
Matcher matcher = UNIQUE_KEY_EXTRACTION_PATTERN.matcher(elasticsearchIndexName);
if (!matcher.matches()) {
@@ -85,16 +90,16 @@ public class IndexNamePrefixLayoutStrategy implements IndexLayoutStrategy {
}
private String removePrefixIfNecessary(String theCandidateUniqueKey) {
- validateDaoConfigIsPresent();
- if (!StringUtils.isBlank(myDaoConfig.getHSearchIndexPrefix())) {
- return theCandidateUniqueKey.replace(myDaoConfig.getHSearchIndexPrefix() + "-", "");
+ validateStorageSettingsIsPresent();
+ if (!StringUtils.isBlank(myStorageSettings.getHSearchIndexPrefix())) {
+ return theCandidateUniqueKey.replace(myStorageSettings.getHSearchIndexPrefix() + "-", "");
} else {
return theCandidateUniqueKey;
}
}
- private void validateDaoConfigIsPresent() {
- if (myDaoConfig == null) {
- throw new ConfigurationException(Msg.code(1168) + "While attempting to boot HAPI FHIR, the Hibernate Search bootstrapper failed to find the DaoConfig. This probably means Hibernate Search has been recently upgraded, or somebody modified HapiFhirLocalContainerEntityManagerFactoryBean.");
+ private void validateStorageSettingsIsPresent() {
+ if (myStorageSettings == null) {
+ throw new ConfigurationException(Msg.code(1168) + "While attempting to boot HAPI FHIR, the Hibernate Search bootstrapper failed to find the StorageSettings. This probably means Hibernate Search has been recently upgraded, or somebody modified HapiFhirLocalContainerEntityManagerFactoryBean.");
}
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java
index b8ad52ad179..ac49b3a5ded 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java
@@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.search.reindex;
import ca.uhn.fhir.batch2.model.JobInstanceStartRequest;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
import ca.uhn.fhir.jpa.dao.data.IForcedIdDao;
@@ -94,7 +94,7 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc, IHasSc
@Autowired
private IResourceReindexJobDao myReindexJobDao;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@Autowired
private PlatformTransactionManager myTxManager;
private TransactionTemplate myTxTemplate;
@@ -116,8 +116,8 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc, IHasSc
private ResourceReindexer myResourceReindexer;
@VisibleForTesting
- void setDaoConfigForUnitTest(DaoConfig theDaoConfig) {
- myDaoConfig = theDaoConfig;
+ void setStorageSettingsForUnitTest(JpaStorageSettings theStorageSettings) {
+ myStorageSettings = theStorageSettings;
}
@VisibleForTesting
@@ -133,7 +133,7 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc, IHasSc
public void initExecutor() {
// Create the threadpool executor used for reindex jobs
- int reindexThreadCount = myDaoConfig.getReindexThreadCount();
+ int reindexThreadCount = myStorageSettings.getReindexThreadCount();
RejectedExecutionHandler rejectHandler = new BlockPolicy();
myTaskExecutor = new ThreadPoolExecutor(0, reindexThreadCount,
0L, TimeUnit.MILLISECONDS,
@@ -202,7 +202,7 @@ public class ResourceReindexingSvcImpl implements IResourceReindexingSvc, IHasSc
@Override
@Transactional(propagation = Propagation.NEVER)
public Integer runReindexingPass() {
- if (myDaoConfig.isSchedulingDisabled() || !myDaoConfig.isEnableTaskPreExpandValueSets()) {
+ if (myStorageSettings.isSchedulingDisabled() || !myStorageSettings.isEnableTaskPreExpandValueSets()) {
return null;
}
if (myIndexingLock.tryLock()) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/warm/CacheWarmingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/warm/CacheWarmingSvcImpl.java
index e8d5eb0a1f2..dca2291a6c1 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/warm/CacheWarmingSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/warm/CacheWarmingSvcImpl.java
@@ -24,7 +24,7 @@ import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.i18n.Msg;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.model.WarmCacheEntry;
@@ -55,7 +55,7 @@ public class CacheWarmingSvcImpl implements ICacheWarmingSvc, IHasScheduledJobs
private static final Logger ourLog = LoggerFactory.getLogger(CacheWarmingSvcImpl.class);
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
private Map myCacheEntryToNextRefresh = new LinkedHashMap<>();
@Autowired
private FhirContext myCtx;
@@ -131,7 +131,7 @@ public class CacheWarmingSvcImpl implements ICacheWarmingSvc, IHasScheduledJobs
public synchronized Set initCacheMap() {
myCacheEntryToNextRefresh.clear();
- List warmCacheEntries = myDaoConfig.getWarmCacheEntries();
+ List warmCacheEntries = myStorageSettings.getWarmCacheEntries();
for (WarmCacheEntry next : warmCacheEntries) {
// Validate
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java
index 7542fa79cd4..1f39d5e894d 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java
@@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.sp;
* #L%
*/
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.dao.data.ISearchParamPresentDao;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
@@ -46,17 +46,17 @@ public class SearchParamPresenceSvcImpl implements ISearchParamPresenceSvc {
@Autowired
private PartitionSettings myPartitionSettings;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@VisibleForTesting
- public void setDaoConfig(DaoConfig theDaoConfig) {
- myDaoConfig = theDaoConfig;
+ public void setStorageSettings(JpaStorageSettings theStorageSettings) {
+ myStorageSettings = theStorageSettings;
}
@Override
public AddRemoveCount updatePresence(ResourceTable theResource, Map theParamNameToPresence) {
AddRemoveCount retVal = new AddRemoveCount();
- if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.DISABLED) {
+ if (myStorageSettings.getIndexMissingFields() == JpaStorageSettings.IndexEnabledEnum.DISABLED) {
return retVal;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java
index 5adb6e5a300..15486da8827 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermCodeSystemStorageSvcImpl.java
@@ -24,7 +24,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.svc.IIdHelperService;
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
@@ -120,7 +120,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc {
@Autowired
private ITermReadSvc myTerminologySvc;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
@Autowired
private IResourceTableDao myResourceTableDao;
@@ -499,7 +499,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc {
termConceptProperty.setConcept(theConceptToAdd);
termConceptProperty.setCodeSystemVersion(theCsv);
});
- if (theStatisticsTracker.getUpdatedConceptCount() <= myDaoConfig.getDeferIndexingForCodesystemsOfSize()) {
+ if (theStatisticsTracker.getUpdatedConceptCount() <= myStorageSettings.getDeferIndexingForCodesystemsOfSize()) {
saveConcept(conceptToAdd);
Long nextConceptPid = conceptToAdd.getId();
Validate.notNull(nextConceptPid);
@@ -522,7 +522,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc {
conceptToAdd.getParents().add(parentLink);
ourLog.info("Saving parent/child link - Parent[{}] Child[{}]", parentLink.getParent().getCode(), parentLink.getChild().getCode());
- if (theStatisticsTracker.getUpdatedConceptCount() <= myDaoConfig.getDeferIndexingForCodesystemsOfSize()) {
+ if (theStatisticsTracker.getUpdatedConceptCount() <= myStorageSettings.getDeferIndexingForCodesystemsOfSize()) {
myConceptParentChildLinkDao.save(parentLink);
} else {
myDeferredStorageSvc.addConceptLinkToStorageQueue(parentLink);
@@ -574,7 +574,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc {
theConcept.setCodeSystemVersion(theCodeSystem);
theConcept.setIndexStatus(BaseHapiFhirDao.INDEX_STATUS_INDEXED);
- if (theConceptsStack.size() <= myDaoConfig.getDeferIndexingForCodesystemsOfSize()) {
+ if (theConceptsStack.size() <= myStorageSettings.getDeferIndexingForCodesystemsOfSize()) {
saveConcept(theConcept);
} else {
myDeferredStorageSvc.addConceptToStorageQueue(theConcept);
@@ -585,7 +585,7 @@ public class TermCodeSystemStorageSvcImpl implements ITermCodeSystemStorageSvc {
}
for (TermConceptParentChildLink next : theConcept.getChildren()) {
- if (theConceptsStack.size() <= myDaoConfig.getDeferIndexingForCodesystemsOfSize()) {
+ if (theConceptsStack.size() <= myStorageSettings.getDeferIndexingForCodesystemsOfSize()) {
saveConceptLink(next);
} else {
myDeferredStorageSvc.addConceptLinkToStorageQueue(next);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java
index 582bf435fc8..6ea9f5b3697 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermDeferredStorageSvcImpl.java
@@ -374,7 +374,7 @@ public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc, IHas
request.setParameters(parameters);
Batch2JobStartResponse response = myJobCoordinator.startInstance(request);
- myJobExecutions.add(response.getJobId());
+ myJobExecutions.add(response.getInstanceId());
}
private void deleteTermCodeSystemOffline(Long theCodeSystemPid) {
@@ -384,7 +384,7 @@ public class TermDeferredStorageSvcImpl implements ITermDeferredStorageSvc, IHas
request.setParameters(parameters);
request.setJobDefinitionId(TERM_CODE_SYSTEM_DELETE_JOB_NAME);
Batch2JobStartResponse response = myJobCoordinator.startInstance(request);
- myJobExecutions.add(response.getJobId());
+ myJobExecutions.add(response.getInstanceId());
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java
index eb35ef43202..38860db808c 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcImpl.java
@@ -28,7 +28,7 @@ import ca.uhn.fhir.context.support.ValidationSupportContext;
import ca.uhn.fhir.context.support.ValueSetExpansionOptions;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.model.RequestPartitionId;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IDao;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
@@ -235,7 +235,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
@Autowired
private ITermCodeSystemVersionDao myCodeSystemVersionDao;
@Autowired
- private DaoConfig myDaoConfig;
+ private JpaStorageSettings myStorageSettings;
private TransactionTemplate myTxTemplate;
@Autowired
private PlatformTransactionManager myTransactionManager;
@@ -350,8 +350,8 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
private boolean addToSet(Set theSetToPopulate, TermConcept theConcept) {
boolean retVal = theSetToPopulate.add(theConcept);
if (retVal) {
- if (theSetToPopulate.size() >= myDaoConfig.getMaximumExpansionSize()) {
- String msg = myContext.getLocalizer().getMessage(TermReadSvcImpl.class, "expansionTooLarge", myDaoConfig.getMaximumExpansionSize());
+ if (theSetToPopulate.size() >= myStorageSettings.getMaximumExpansionSize()) {
+ String msg = myContext.getLocalizer().getMessage(TermReadSvcImpl.class, "expansionTooLarge", myStorageSettings.getMaximumExpansionSize());
throw new ExpansionTooCostlyException(Msg.code(885) + msg);
}
}
@@ -432,7 +432,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
int count = expansionOptions.getCount();
ValueSetExpansionComponentWithConceptAccumulator accumulator = new ValueSetExpansionComponentWithConceptAccumulator(myContext, count, expansionOptions.isIncludeHierarchy());
- accumulator.setHardExpansionMaximumSize(myDaoConfig.getMaximumExpansionSize());
+ accumulator.setHardExpansionMaximumSize(myStorageSettings.getMaximumExpansionSize());
accumulator.setSkipCountRemaining(offset);
accumulator.setIdentifier(UUID.randomUUID().toString());
accumulator.setTimestamp(new Date());
@@ -535,7 +535,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
offset = Math.min(offset, theTermValueSet.getTotalConcepts().intValue());
Integer count = theAccumulator.getCapacityRemaining();
- count = defaultIfNull(count, myDaoConfig.getMaximumExpansionSize());
+ count = defaultIfNull(count, myStorageSettings.getMaximumExpansionSize());
int conceptsExpanded = 0;
int designationsExpanded = 0;
@@ -1900,7 +1900,7 @@ public class TermReadSvcImpl implements ITermReadSvc, IHasScheduledJobs {
@Override
public synchronized void preExpandDeferredValueSetsToTerminologyTables() {
- if (!myDaoConfig.isEnableTaskPreExpandValueSets()) {
+ if (!myStorageSettings.isEnableTaskPreExpandValueSets()) {
return;
}
if (isNotSafeToPreExpandValueSets()) {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImplTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImplTest.java
index 81b01008578..9da78f5ee94 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImplTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/bulk/export/svc/BulkDataExportJobSchedulingHelperImplTest.java
@@ -4,7 +4,7 @@ import ca.uhn.fhir.batch2.api.IJobPersistence;
import ca.uhn.fhir.batch2.model.JobInstance;
import ca.uhn.fhir.batch2.model.StatusEnum;
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.jpa.api.config.DaoConfig;
+import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.api.model.BulkExportJobResults;
@@ -49,32 +49,24 @@ import static org.mockito.Mockito.when;
@ExtendWith(MockitoExtension.class)
public class BulkDataExportJobSchedulingHelperImplTest {
+ private final FhirContext myFhirContext = FhirContext.forR4Cached();
@Mock
- private DaoConfig myDaoConfig;
-
+ private JpaStorageSettings myStorageSettings;
@Mock
private PlatformTransactionManager myTxManager;
-
@Mock
private TransactionTemplate myTxTemplate;
-
@Mock
private IJobPersistence myJpaJobPersistence;
-
@Mock
private BulkExportHelperService myBulkExportHelperSvc;
-
@Mock
private DaoRegistry myDaoRegistry;
-
@Mock
private IFhirResourceDao myBinaryDao;
-
@Captor
private ArgumentCaptor myCutoffCaptor;
-
private BulkDataExportJobSchedulingHelperImpl myBulkDataExportJobSchedulingHelper;
- private final FhirContext myFhirContext = FhirContext.forR4Cached();
@Test
public void testPurgeExpiredFilesDisabledDoesNothing() {
@@ -225,7 +217,7 @@ public class BulkDataExportJobSchedulingHelperImplTest {
public void purgeExpiredFilesMultipleJobsMultipleBinariesTwoHourRetention() {
final int expectedRetentionHours = 2;
final int numBinariesPerJob = 3;
- final List