improve search parameter registry logging (#3452)

* Startup log cleanup.  Use cached fhir contexts.

* improve logging

* improve logging

* add full comparator

* wrap resource search param map

* rename wrapped map methods

* add fixmes

* further searchparam encapsulation

* fix regression found by test

* improve logging

* pre-review cleanup

* pre-review cleanup

* bump hapi version

* license

* since I'm bumping hapi-fhir now, improve the api dependency

* licenses
This commit is contained in:
Ken Stevens 2022-03-09 19:57:38 -05:00 committed by GitHub
parent 7eb1bd14d1
commit dfd99c5471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
90 changed files with 337 additions and 221 deletions

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -3,14 +3,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<packaging>pom</packaging>
<name>HAPI FHIR BOM</name>
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,4 @@
---
type: add
issue: 3452
title: "Improve logging so it is clear when a new search parameter has been loaded into the cache."

View File

@ -11,7 +11,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,6 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeChildResourceDefinition;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
@ -76,7 +75,6 @@ import ca.uhn.fhir.parser.LenientErrorHandler;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.InterceptorInvocationTimingEnum;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.api.server.storage.TransactionDetails;
@ -87,6 +85,7 @@ import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.rest.server.util.CompositeInterceptorBroadcaster;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.CoverageIgnore;
import ca.uhn.fhir.util.HapiExtensions;
import ca.uhn.fhir.util.MetaUtil;
@ -112,6 +111,7 @@ import org.hl7.fhir.instance.model.api.IDomainResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.model.Bundle.HTTPVerb;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
@ -150,7 +150,6 @@ import java.util.HashSet;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.UUID;
@ -1399,19 +1398,9 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> extends BaseStora
* those by path and not by parameter name.
*/
if (thePerformIndexing && newParams != null) {
Map<String, Boolean> presentSearchParams = new HashMap<>();
for (String nextKey : newParams.getPopulatedResourceLinkParameters()) {
presentSearchParams.put(nextKey, Boolean.TRUE);
}
Set<Entry<String, RuntimeSearchParam>> activeSearchParams = mySearchParamRegistry.getActiveSearchParams(entity.getResourceType()).entrySet();
for (Entry<String, RuntimeSearchParam> nextSpEntry : activeSearchParams) {
if (nextSpEntry.getValue().getParamType() == RestSearchParameterTypeEnum.REFERENCE) {
if (!presentSearchParams.containsKey(nextSpEntry.getKey())) {
presentSearchParams.put(nextSpEntry.getKey(), Boolean.FALSE);
}
}
}
AddRemoveCount presenceCount = mySearchParamPresenceSvc.updatePresence(entity, presentSearchParams);
Map<String, Boolean> searchParamPresenceMap = getSearchParamPresenceMap(entity, newParams);
AddRemoveCount presenceCount = mySearchParamPresenceSvc.updatePresence(entity, searchParamPresenceMap);
// Interceptor broadcast: JPA_PERFTRACE_INFO
if (!presenceCount.isEmpty()) {
@ -1467,6 +1456,23 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> extends BaseStora
return entity;
}
@NotNull
private Map<String, Boolean> getSearchParamPresenceMap(ResourceTable entity, ResourceIndexedSearchParams newParams) {
Map<String, Boolean> retval = new HashMap<>();
for (String nextKey : newParams.getPopulatedResourceLinkParameters()) {
retval.put(nextKey, Boolean.TRUE);
}
ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams(entity.getResourceType());
activeSearchParams.getReferenceSearchParamNames().forEach(key -> {
if (!retval.containsKey(key)) {
retval.put(key, Boolean.FALSE);
}
});
return retval;
}
private void createHistoryEntry(RequestDetails theRequest, IBaseResource theResource, ResourceTable theEntity, EncodedResource theChanged) {
boolean versionedTags = getConfig().getTagStorageMode() == DaoConfig.TagStorageModeEnum.VERSIONED;
final ResourceHistoryTable historyEntry = theEntity.toHistory(versionedTags);

View File

@ -21,7 +21,6 @@ package ca.uhn.fhir.jpa.dao;
*/
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.dao.data.IForcedIdDao;
@ -43,6 +42,7 @@ import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import org.hibernate.search.backend.elasticsearch.ElasticsearchExtension;
import org.hibernate.search.mapper.orm.Search;
import org.hibernate.search.mapper.orm.session.SearchSession;
@ -60,7 +60,6 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceContextType;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
@ -94,7 +93,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
public ExtendedLuceneIndexData extractLuceneIndexData(IBaseResource theResource, ResourceIndexedSearchParams theNewParams) {
String resourceType = myFhirContext.getResourceType(theResource);
Map<String, RuntimeSearchParam> activeSearchParams = mySearchParamRegistry.getActiveSearchParams(resourceType);
ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams(resourceType);
ExtendedLuceneIndexExtractor extractor = new ExtendedLuceneIndexExtractor(myFhirContext, activeSearchParams, mySearchParamExtractor);
return extractor.extract(theResource,theNewParams);
}

View File

@ -20,11 +20,11 @@ package ca.uhn.fhir.jpa.dao.index;
* #L%
*/
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.ComboSearchParamType;
import ca.uhn.fhir.context.FhirContext;
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.svc.IIdHelperService;
@ -50,6 +50,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.FhirTerser;
import ca.uhn.fhir.util.StringUtil;
import ca.uhn.fhir.util.UrlUtil;
@ -71,7 +72,6 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
@ -128,7 +128,7 @@ public class SearchParamWithInlineReferencesExtractor {
mySearchParamExtractorService.extractFromResource(theRequestPartitionId, theRequest, theParams, theEntity, theResource, theTransactionDetails, theFailOnInvalidReference);
Set<Map.Entry<String, RuntimeSearchParam>> activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType()).entrySet();
ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType());
if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.ENABLED) {
theParams.findMissingSearchParams(myPartitionSettings, myDaoConfig.getModelConfig(), theEntity, activeSearchParams);
}

View File

@ -27,6 +27,7 @@ import ca.uhn.fhir.jpa.model.search.ExtendedLuceneIndexData;
import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor;
import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseCoding;
import org.hl7.fhir.instance.model.api.IBaseResource;
@ -47,10 +48,10 @@ import java.util.Map;
public class ExtendedLuceneIndexExtractor {
private final FhirContext myContext;
private final Map<String, RuntimeSearchParam> myParams;
private final ResourceSearchParams myParams;
private final ISearchParamExtractor mySearchParamExtractor;
public ExtendedLuceneIndexExtractor(FhirContext theContext, Map<String, RuntimeSearchParam> theActiveParams, ISearchParamExtractor theSearchParamExtractor) {
public ExtendedLuceneIndexExtractor(FhirContext theContext, ResourceSearchParams theActiveParams, ISearchParamExtractor theSearchParamExtractor) {
myContext = theContext;
myParams = theActiveParams;
mySearchParamExtractor = theSearchParamExtractor;

View File

@ -27,6 +27,7 @@ import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.CoverageIgnore;
import ca.uhn.fhir.util.ExtensionConstants;
import org.hl7.fhir.dstu3.model.Bundle;
@ -116,7 +117,7 @@ public class JpaConformanceProviderDstu3 extends org.hl7.fhir.dstu3.hapi.rest.se
nextResource.getSearchParam().clear();
String resourceName = nextResource.getType();
Map<String, RuntimeSearchParam> searchParams = mySearchParamRegistry.getActiveSearchParams(resourceName);
ResourceSearchParams searchParams = mySearchParamRegistry.getActiveSearchParams(resourceName);
for (RuntimeSearchParam runtimeSp : searchParams.values()) {
CapabilityStatementRestResourceSearchParamComponent confSp = nextResource.addSearchParam();

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -24,6 +24,8 @@ import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import com.google.common.annotations.VisibleForTesting;
import org.hl7.fhir.instance.model.api.IBaseResource;
import java.util.Set;
/**
* This component holds an in-memory list of all registered {@link IResourceChangeListener} instances along
* with their caches and other details needed to maintain those caches. Register an {@link IResourceChangeListener} instance
@ -80,4 +82,8 @@ public interface IResourceChangeListenerRegistry {
void requestRefreshIfWatching(IBaseResource theResource);
/**
* @return a set of resource names watched by the registered listeners
*/
Set<String> getWatchedResourceNames();
}

View File

@ -43,10 +43,6 @@ public class ResourceChangeEvent implements IResourceChangeEvent {
myDeletedResourceIds = copyFrom(theDeletedResourceIds);
}
public static ResourceChangeEvent fromCreatedResourceIds(Collection<IIdType> theCreatedResourceIds) {
return new ResourceChangeEvent(theCreatedResourceIds, Collections.emptyList(), Collections.emptyList());
}
public static ResourceChangeEvent fromCreatedUpdatedDeletedResourceIds(List<IIdType> theCreatedResourceIds, List<IIdType> theUpdatedResourceIds, List<IIdType> theDeletedResourceIds) {
return new ResourceChangeEvent(theCreatedResourceIds, theUpdatedResourceIds, theDeletedResourceIds);
}

View File

@ -114,7 +114,7 @@ public class ResourceChangeListenerCache implements IResourceChangeListenerCache
return retval;
}
private boolean isTimeToRefresh() {
protected boolean isTimeToRefresh() {
return myNextRefreshTime.isBefore(now());
}

View File

@ -35,7 +35,9 @@ import org.springframework.stereotype.Component;
import javax.annotation.Nonnull;
import java.util.Iterator;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.stream.Collectors;
/**
* This component holds an in-memory list of all registered {@link IResourceChangeListener} instances along
@ -142,6 +144,13 @@ public class ResourceChangeListenerRegistryImpl implements IResourceChangeListen
}
}
@Override
public Set<String> getWatchedResourceNames() {
return myListenerEntries.stream()
.map(ResourceChangeListenerCache::getResourceName)
.collect(Collectors.toSet());
}
@Override
@VisibleForTesting
public void clearListenersForUnitTest() {

View File

@ -43,20 +43,18 @@ import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.rest.param.QuantityParam;
import ca.uhn.fhir.rest.param.ReferenceParam;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import org.apache.commons.lang3.StringUtils;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.Predicate;
import javax.annotation.Nonnull;
import static org.apache.commons.lang3.StringUtils.compare;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
@ -343,7 +341,7 @@ public final class ResourceIndexedSearchParams {
'}';
}
public void findMissingSearchParams(PartitionSettings thePartitionSettings, ModelConfig theModelConfig, ResourceTable theEntity, Set<Entry<String, RuntimeSearchParam>> theActiveSearchParams) {
public void findMissingSearchParams(PartitionSettings thePartitionSettings, ModelConfig theModelConfig, ResourceTable theEntity, ResourceSearchParams theActiveSearchParams) {
findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.STRING, myStringParams);
findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.NUMBER, myNumberParams);
findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.QUANTITY, myQuantityParams);
@ -354,15 +352,15 @@ public final class ResourceIndexedSearchParams {
}
@SuppressWarnings("unchecked")
private <RT extends BaseResourceIndexedSearchParam> void findMissingSearchParams(PartitionSettings thePartitionSettings, ModelConfig theModelConfig, ResourceTable theEntity, Set<Map.Entry<String, RuntimeSearchParam>> activeSearchParams, RestSearchParameterTypeEnum type,
Collection<RT> paramCollection) {
for (Map.Entry<String, RuntimeSearchParam> nextEntry : activeSearchParams) {
String nextParamName = nextEntry.getKey();
private <RT extends BaseResourceIndexedSearchParam> void findMissingSearchParams(PartitionSettings thePartitionSettings, ModelConfig theModelConfig, ResourceTable theEntity, ResourceSearchParams activeSearchParams, RestSearchParameterTypeEnum type,
Collection<RT> paramCollection) {
for (String nextParamName : activeSearchParams.getSearchParamNames()) {
if (nextParamName == null || nextParamName.startsWith("_")) {
continue;
}
if (nextEntry.getValue().getParamType() == type) {
RuntimeSearchParam searchParam = activeSearchParams.get(nextParamName);
if (searchParam.getParamType() == type) {
boolean haveParam = false;
for (BaseResourceIndexedSearchParam nextParam : paramCollection) {
if (nextParam.getParamName().equals(nextParamName)) {
@ -394,7 +392,7 @@ public final class ResourceIndexedSearchParams {
param = new ResourceIndexedSearchParamUri();
break;
case SPECIAL:
if (BaseSearchParamExtractor.COORDS_INDEX_PATHS.contains(nextEntry.getValue().getPath())) {
if (BaseSearchParamExtractor.COORDS_INDEX_PATHS.contains(searchParam.getPath())) {
param = new ResourceIndexedSearchParamCoords();
break;
} else {

View File

@ -28,6 +28,7 @@ import ca.uhn.fhir.interceptor.api.Pointcut;
import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -81,11 +82,11 @@ public class JpaSearchParamCache {
* Loop through parameters and find JPA params
*/
for (String theResourceName : theActiveSearchParams.getResourceNameKeys()) {
Map<String, RuntimeSearchParam> searchParamMap = theActiveSearchParams.getSearchParamMap(theResourceName);
ResourceSearchParams searchParams = theActiveSearchParams.getSearchParamMap(theResourceName);
List<RuntimeSearchParam> comboSearchParams = resourceNameToComboSearchParams.computeIfAbsent(theResourceName, k -> new ArrayList<>());
Collection<RuntimeSearchParam> nextSearchParamsForResourceName = searchParamMap.values();
Collection<RuntimeSearchParam> nextSearchParamsForResourceName = searchParams.values();
ourLog.trace("Resource {} has {} params", theResourceName, searchParamMap.size());
ourLog.trace("Resource {} has {} params", theResourceName, searchParams.size());
for (RuntimeSearchParam nextCandidate : nextSearchParamsForResourceName) {

View File

@ -24,6 +24,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.BundleUtil;
import ca.uhn.fhir.util.ClasspathUtil;
import org.apache.commons.lang3.Validate;
@ -33,7 +34,6 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@ -42,7 +42,7 @@ import java.util.stream.Stream;
public class ReadOnlySearchParamCache {
// resourceName -> searchParamName -> searchparam
protected final Map<String, Map<String, RuntimeSearchParam>> myResourceNameToSpNameToSp;
protected final Map<String, ResourceSearchParams> myResourceNameToSpNameToSp;
protected final Map<String, RuntimeSearchParam> myUrlToParam;
/**
@ -65,12 +65,12 @@ public class ReadOnlySearchParamCache {
return myResourceNameToSpNameToSp.values().stream().flatMap(entry -> entry.values().stream());
}
protected Map<String, RuntimeSearchParam> getSearchParamMap(String theResourceName) {
Map<String, RuntimeSearchParam> retVal = myResourceNameToSpNameToSp.get(theResourceName);
if (retVal == null) {
return Collections.emptyMap();
protected ResourceSearchParams getSearchParamMap(String theResourceName) {
ResourceSearchParams retval = myResourceNameToSpNameToSp.get(theResourceName);
if (retval == null) {
return ResourceSearchParams.empty(theResourceName);
}
return Collections.unmodifiableMap(myResourceNameToSpNameToSp.get(theResourceName));
return retval.readOnly();
}
public int size() {
@ -100,6 +100,7 @@ public class ReadOnlySearchParamCache {
}
if (allSearchParameterBundle != null) {
// For each SearchParameter resource in the bundle of all search parameters defined in this version of FHIR
for (IBaseResource next : BundleUtil.toListOfResources(theFhirContext, allSearchParameterBundle)) {
RuntimeSearchParam nextCanonical = theCanonicalizer.canonicalizeSearchParameter(next);
@ -127,26 +128,29 @@ public class ReadOnlySearchParamCache {
base = resourceNames;
}
// Add it to our return value if permitted by the pattern parameters
for (String nextResourceName : base) {
Map<String, RuntimeSearchParam> nameToParam = retVal.myResourceNameToSpNameToSp.computeIfAbsent(nextResourceName, t -> new HashMap<>());
ResourceSearchParams resourceSearchParams = retVal.myResourceNameToSpNameToSp.computeIfAbsent(nextResourceName, t -> new ResourceSearchParams(nextResourceName));
String nextParamName = nextCanonical.getName();
if (theSearchParamPatternsToInclude == null || searchParamMatchesAtLeastOnePattern(theSearchParamPatternsToInclude, nextResourceName, nextParamName)) {
nameToParam.putIfAbsent(nextParamName, nextCanonical);
resourceSearchParams.addSearchParamIfAbsent(nextParamName, nextCanonical);
}
}
}
}
}
// Now grab all the runtime search parameters from the resource definitions
for (String resourceName : resourceNames) {
RuntimeResourceDefinition nextResDef = theFhirContext.getResourceDefinition(resourceName);
String nextResourceName = nextResDef.getName();
Map<String, RuntimeSearchParam> nameToParam = retVal.myResourceNameToSpNameToSp.computeIfAbsent(nextResourceName, t -> new HashMap<>());
ResourceSearchParams resourceSearchParams = retVal.myResourceNameToSpNameToSp.computeIfAbsent(nextResourceName, t -> new ResourceSearchParams(nextResourceName));
for (RuntimeSearchParam nextSp : nextResDef.getSearchParams()) {
String nextParamName = nextSp.getName();
// Add it to our return value if permitted by the pattern parameters
if (theSearchParamPatternsToInclude == null || searchParamMatchesAtLeastOnePattern(theSearchParamPatternsToInclude, nextResourceName, nextParamName)) {
nameToParam.putIfAbsent(nextParamName, nextSp);
resourceSearchParams.addSearchParamIfAbsent(nextParamName, nextSp);
}
}
}

View File

@ -21,10 +21,10 @@ package ca.uhn.fhir.jpa.searchparam.registry;
*/
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@ -37,7 +37,8 @@ public class RuntimeSearchParamCache extends ReadOnlySearchParamCache {
}
public void add(String theResourceName, String theName, RuntimeSearchParam theSearchParam) {
getSearchParamMap(theResourceName).put(theName, theSearchParam);
ResourceSearchParams resourceSearchParams = getSearchParamMap(theResourceName);
resourceSearchParams.put(theName, theSearchParam);
String uri = theSearchParam.getUri();
if (isNotBlank(uri)) {
RuntimeSearchParam existingForUrl = myUrlToParam.get(uri);
@ -65,8 +66,8 @@ public class RuntimeSearchParamCache extends ReadOnlySearchParamCache {
}
private void putAll(ReadOnlySearchParamCache theReadOnlySearchParamCache) {
Set<Map.Entry<String, Map<String, RuntimeSearchParam>>> builtInSps = theReadOnlySearchParamCache.myResourceNameToSpNameToSp.entrySet();
for (Map.Entry<String, Map<String, RuntimeSearchParam>> nextBuiltInEntry : builtInSps) {
Set<Map.Entry<String, ResourceSearchParams>> builtInSps = theReadOnlySearchParamCache.myResourceNameToSpNameToSp.entrySet();
for (Map.Entry<String, ResourceSearchParams> nextBuiltInEntry : builtInSps) {
for (RuntimeSearchParam nextParam : nextBuiltInEntry.getValue().values()) {
String nextResourceName = nextBuiltInEntry.getKey();
String nextParamName = nextParam.getName();
@ -79,7 +80,7 @@ public class RuntimeSearchParamCache extends ReadOnlySearchParamCache {
public RuntimeSearchParam get(String theResourceName, String theParamName) {
RuntimeSearchParam retVal = null;
Map<String, RuntimeSearchParam> params = myResourceNameToSpNameToSp.get(theResourceName);
ResourceSearchParams params = myResourceNameToSpNameToSp.get(theResourceName);
if (params != null) {
retVal = params.get(theParamName);
}
@ -91,11 +92,11 @@ public class RuntimeSearchParamCache extends ReadOnlySearchParamCache {
}
@Override
protected Map<String, RuntimeSearchParam> getSearchParamMap(String theResourceName) {
return myResourceNameToSpNameToSp.computeIfAbsent(theResourceName, k -> new HashMap<>());
protected ResourceSearchParams getSearchParamMap(String theResourceName) {
return myResourceNameToSpNameToSp.computeIfAbsent(theResourceName, k -> new ResourceSearchParams(theResourceName));
}
public static RuntimeSearchParamCache fromReadOnlySearchParmCache(ReadOnlySearchParamCache theBuiltInSearchParams) {
public static RuntimeSearchParamCache fromReadOnlySearchParamCache(ReadOnlySearchParamCache theBuiltInSearchParams) {
RuntimeSearchParamCache retVal = new RuntimeSearchParamCache();
retVal.putAll(theBuiltInSearchParams);
return retVal;

View File

@ -35,6 +35,7 @@ import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.SearchParameterUtil;
import ca.uhn.fhir.util.StopWatch;
import com.google.common.annotations.VisibleForTesting;
@ -46,8 +47,6 @@ import org.hl7.fhir.instance.model.api.IIdType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -56,8 +55,8 @@ import javax.annotation.PreDestroy;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.apache.commons.lang3.StringUtils.isBlank;
@ -72,7 +71,7 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry, IResourceC
private static final Logger ourLog = LoggerFactory.getLogger(SearchParamRegistryImpl.class);
private static final int MAX_MANAGED_PARAM_COUNT = 10000;
private static final long REFRESH_INTERVAL = DateUtils.MILLIS_PER_HOUR;
private static final long REFRESH_INTERVAL = DateUtils.MILLIS_PER_MINUTE;
private final JpaSearchParamCache myJpaSearchParamCache = new JpaSearchParamCache();
@Autowired
@ -114,7 +113,7 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry, IResourceC
@Nonnull
@Override
public Map<String, RuntimeSearchParam> getActiveSearchParams(String theResourceName) {
public ResourceSearchParams getActiveSearchParams(String theResourceName) {
requiresActiveSearchParams();
return getActiveSearchParams().getSearchParamMap(theResourceName);
}
@ -169,7 +168,7 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry, IResourceC
StopWatch sw = new StopWatch();
ReadOnlySearchParamCache builtInSearchParams = getBuiltInSearchParams();
RuntimeSearchParamCache searchParams = RuntimeSearchParamCache.fromReadOnlySearchParmCache(builtInSearchParams);
RuntimeSearchParamCache searchParams = RuntimeSearchParamCache.fromReadOnlySearchParamCache(builtInSearchParams);
long overriddenCount = overrideBuiltinSearchParamsWithActiveJpaSearchParams(searchParams, theJpaSearchParams);
ourLog.trace("Have overridden {} built-in search parameters", overriddenCount);
removeInactiveSearchParams(searchParams);
@ -198,8 +197,8 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry, IResourceC
private void removeInactiveSearchParams(RuntimeSearchParamCache theSearchParams) {
for (String resourceName : theSearchParams.getResourceNameKeys()) {
Map<String, RuntimeSearchParam> map = theSearchParams.getSearchParamMap(resourceName);
map.entrySet().removeIf(entry -> entry.getValue().getStatus() != RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE);
ResourceSearchParams resourceSearchParams = theSearchParams.getSearchParamMap(resourceName);
resourceSearchParams.removeInactive();
}
}
@ -240,6 +239,7 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry, IResourceC
}
String name = runtimeSp.getName();
theSearchParams.add(nextBaseName, name, runtimeSp);
ourLog.debug("Adding search parameter {}.{} to SearchParamRegistry", nextBaseName, StringUtils.defaultString(name, "[composite]"));
retval++;
@ -316,17 +316,26 @@ public class SearchParamRegistryImpl implements ISearchParamRegistry, IResourceC
ResourceChangeResult result = ResourceChangeResult.fromResourceChangeEvent(theResourceChangeEvent);
if (result.created > 0) {
ourLog.info("Adding {} search parameters to SearchParamRegistry", result.created);
ourLog.info("Adding {} search parameters to SearchParamRegistry: {}", result.created, unqualified(theResourceChangeEvent.getCreatedResourceIds()));
}
if (result.updated > 0) {
ourLog.info("Updating {} search parameters in SearchParamRegistry", result.updated);
ourLog.info("Updating {} search parameters in SearchParamRegistry: {}", result.updated, unqualified(theResourceChangeEvent.getUpdatedResourceIds()));
}
if (result.created > 0) {
ourLog.info("Deleting {} search parameters from SearchParamRegistry", result.deleted);
if (result.deleted > 0) {
ourLog.info("Deleting {} search parameters from SearchParamRegistry: {}", result.deleted, unqualified(theResourceChangeEvent.getDeletedResourceIds()));
}
rebuildActiveSearchParams();
}
private String unqualified(List<IIdType> theIds) {
Iterator<String> unqualifiedIds = theIds.stream()
.map(IIdType::toUnqualifiedVersionless)
.map(IIdType::getValue)
.iterator();
return StringUtils.join(unqualifiedIds, ", ");
}
@Override
public void handleInit(Collection<IIdType> theResourceIds) {
List<IBaseResource> searchParams = new ArrayList<>();

View File

@ -1,22 +1,20 @@
package ca.uhn.fhir.jpa.searchparam;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamString;
import ca.uhn.fhir.jpa.searchparam.extractor.SearchParamExtractorDstu3;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.StopWatch;
import org.hl7.fhir.dstu3.model.Patient;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.eq;
@ -43,12 +41,11 @@ public class IndexStressTest {
SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), new PartitionSettings(), ctx, searchParamRegistry);
extractor.start();
Map<String, RuntimeSearchParam> spMap = ctx
.getResourceDefinition("Patient")
ResourceSearchParams resourceSearchParams = new ResourceSearchParams("Patient");
ctx.getResourceDefinition("Patient")
.getSearchParams()
.stream()
.collect(Collectors.toMap(RuntimeSearchParam::getName, t -> t));
when(searchParamRegistry.getActiveSearchParams(eq("Patient"))).thenReturn(spMap);
.forEach(t -> resourceSearchParams.put(t.getName(), t));
when(searchParamRegistry.getActiveSearchParams(eq("Patient"))).thenReturn(resourceSearchParams);
Set<ResourceIndexedSearchParamString> params = extractor.extractSearchParamStrings(p);

View File

@ -20,6 +20,7 @@ import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistryController;
import ca.uhn.fhir.jpa.searchparam.registry.ReadOnlySearchParamCache;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.StringUtil;
import ca.uhn.fhir.util.TestUtil;
import com.google.common.collect.Sets;
@ -36,9 +37,7 @@ import org.junit.jupiter.api.Test;
import javax.annotation.Nullable;
import java.text.Normalizer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@ -255,16 +254,16 @@ public class SearchParamExtractorDstu3Test {
}
@Override
public Map<String, RuntimeSearchParam> getActiveSearchParams(String theResourceName) {
public ResourceSearchParams getActiveSearchParams(String theResourceName) {
RuntimeResourceDefinition nextResDef = ourCtx.getResourceDefinition(theResourceName);
Map<String, RuntimeSearchParam> sps = new HashMap<>();
ResourceSearchParams retval = new ResourceSearchParams(theResourceName);
for (RuntimeSearchParam nextSp : nextResDef.getSearchParams()) {
sps.put(nextSp.getName(), nextSp);
retval.put(nextSp.getName(), nextSp);
}
for (RuntimeSearchParam next : myAddedSearchParams) {
sps.put(next.getName(), next);
retval.put(next.getName(), next);
}
return sps;
return retval;
}
@Override

View File

@ -23,6 +23,7 @@ import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistryController;
import ca.uhn.fhir.jpa.searchparam.registry.ReadOnlySearchParamCache;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
import org.hl7.fhir.instance.model.api.IBaseResource;
@ -34,9 +35,7 @@ import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@ -269,16 +268,16 @@ public class SearchParamExtractorMegaTest {
}
@Override
public Map<String, RuntimeSearchParam> getActiveSearchParams(String theResourceName) {
public ResourceSearchParams getActiveSearchParams(String theResourceName) {
RuntimeResourceDefinition nextResDef = myCtx.getResourceDefinition(theResourceName);
Map<String, RuntimeSearchParam> sps = new HashMap<>();
ResourceSearchParams retval = new ResourceSearchParams(theResourceName);
for (RuntimeSearchParam nextSp : nextResDef.getSearchParams()) {
sps.put(nextSp.getName(), nextSp);
retval.put(nextSp.getName(), nextSp);
}
for (RuntimeSearchParam next : myAddedSearchParams) {
sps.put(next.getName(), next);
retval.put(next.getName(), next);
}
return sps;
return retval;
}
@Override

View File

@ -23,6 +23,7 @@ import ca.uhn.fhir.rest.server.SimpleBundleProvider;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.model.Enumerations;
@ -42,7 +43,6 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.hamcrest.MatcherAssert.assertThat;
@ -312,7 +312,7 @@ public class SearchParamRegistryImplTest {
assertFalse(retried.get());
mySearchParamRegistry.forceRefresh();
Map<String, RuntimeSearchParam> activeSearchParams = mySearchParamRegistry.getActiveSearchParams("Patient");
ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams("Patient");
assertTrue(retried.get());
assertEquals(ourBuiltInSearchParams.getSearchParamMap("Patient").size(), activeSearchParams.size());
}
@ -325,9 +325,9 @@ public class SearchParamRegistryImplTest {
resetDatabaseToOrigSearchParamsPlusNewOneWithStatus(Enumerations.PublicationStatus.ACTIVE);
mySearchParamRegistry.forceRefresh();
Map<String, RuntimeSearchParam> outcome = mySearchParamRegistry.getActiveSearchParams("Patient");
ResourceSearchParams activeSearchParams = mySearchParamRegistry.getActiveSearchParams("Patient");
RuntimeSearchParam converted = outcome.get("foo");
RuntimeSearchParam converted = activeSearchParams.get("foo");
assertNotNull(converted);
assertEquals(1, converted.getExtensions("http://foo").size());

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -24,10 +24,8 @@ import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.partition.SystemRequestDetails;
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.SubscriptionStrategyEvaluator;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionConstants;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry;
import ca.uhn.fhir.jpa.subscription.model.CanonicalSubscriptionChannelType;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedMessage;
@ -35,7 +33,6 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.util.SubscriptionUtil;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.Subscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -54,15 +51,11 @@ import javax.annotation.Nonnull;
public class SubscriptionActivatingSubscriber extends BaseSubscriberForSubscriptionResources implements MessageHandler {
private final Logger ourLog = LoggerFactory.getLogger(SubscriptionActivatingSubscriber.class);
@Autowired
private SubscriptionRegistry mySubscriptionRegistry;
@Autowired
private DaoRegistry myDaoRegistry;
@Autowired
private SubscriptionCanonicalizer mySubscriptionCanonicalizer;
@Autowired
private DaoConfig myDaoConfig;
@Autowired
private SubscriptionStrategyEvaluator mySubscriptionStrategyEvaluator;
/**
* Constructor

View File

@ -23,7 +23,6 @@ package ca.uhn.fhir.jpa.subscription.match.matcher.subscriber;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
import ca.uhn.fhir.jpa.partition.SystemRequestDetails;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionCanonicalizer;
import ca.uhn.fhir.jpa.subscription.match.registry.SubscriptionRegistry;
@ -57,8 +56,6 @@ public class SubscriptionRegisteringSubscriber extends BaseSubscriberForSubscrip
@Autowired
private SubscriptionCanonicalizer mySubscriptionCanonicalizer;
@Autowired
private PartitionSettings myPartitionSettings;
@Autowired
private DaoRegistry myDaoRegistry;
/**

View File

@ -27,7 +27,6 @@ import org.hl7.fhir.dstu2.model.Subscription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import javax.annotation.PostConstruct;
import java.util.Set;
@ -42,8 +41,6 @@ public class SubscriptionSubmitInterceptorLoader {
@Autowired
private DaoConfig myDaoConfig;
@Autowired
private ApplicationContext myApplicationContext;
@Autowired
private IInterceptorService myInterceptorRegistry;
@PostConstruct

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -20,16 +20,17 @@ package ca.uhn.fhir.rest.server;
* #L%
*/
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.rest.server.method.BaseMethodBinding;
import ca.uhn.fhir.rest.server.method.OperationMethodBinding;
import ca.uhn.fhir.rest.server.method.SearchMethodBinding;
import ca.uhn.fhir.rest.server.method.SearchParameter;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.VersionUtil;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
@ -51,7 +52,6 @@ import java.util.Date;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -427,10 +427,10 @@ public class RestfulServerConfiguration implements ISearchParamRegistry {
}
@Override
public Map<String, RuntimeSearchParam> getActiveSearchParams(@Nonnull String theResourceName) {
public ResourceSearchParams getActiveSearchParams(@Nonnull String theResourceName) {
Validate.notBlank(theResourceName, "theResourceName must not be null or blank");
Map<String, RuntimeSearchParam> retVal = new LinkedHashMap<>();
ResourceSearchParams retval = new ResourceSearchParams(theResourceName);
collectMethodBindings()
.getOrDefault(theResourceName, Collections.emptyList())
@ -439,9 +439,9 @@ public class RestfulServerConfiguration implements ISearchParamRegistry {
.filter(t -> t instanceof SearchMethodBinding)
.map(t -> (SearchMethodBinding) t)
.filter(t -> t.getQueryName() == null)
.forEach(t -> createRuntimeBinding(retVal, t));
.forEach(t -> createRuntimeBinding(retval, t));
return retVal;
return retval;
}
@Nullable
@ -450,7 +450,7 @@ public class RestfulServerConfiguration implements ISearchParamRegistry {
throw new UnsupportedOperationException(Msg.code(286));
}
private void createRuntimeBinding(Map<String, RuntimeSearchParam> theMapToPopulate, SearchMethodBinding theSearchMethodBinding) {
private void createRuntimeBinding(ResourceSearchParams theMapToPopulate, SearchMethodBinding theSearchMethodBinding) {
List<SearchParameter> parameters = theSearchMethodBinding
.getParameters()
@ -482,7 +482,7 @@ public class RestfulServerConfiguration implements ISearchParamRegistry {
}
}
if (theMapToPopulate.containsKey(nextParamUnchainedName)) {
if (theMapToPopulate.containsParamName(nextParamUnchainedName)) {
continue;
}

View File

@ -20,9 +20,9 @@ package ca.uhn.fhir.rest.server.interceptor;
* #L%
*/
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.i18n.HapiLocalizer;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.api.Hook;
import ca.uhn.fhir.interceptor.api.Interceptor;
import ca.uhn.fhir.interceptor.api.Pointcut;
@ -141,7 +141,7 @@ public class SearchPreferHandlingInterceptor {
} else {
// Strict handling
List<String> allowedParams = searchParamRetriever.getActiveSearchParams(resourceName).keySet().stream().sorted().distinct().collect(Collectors.toList());
List<String> allowedParams = searchParamRetriever.getActiveSearchParams(resourceName).getSearchParamNames().stream().sorted().distinct().collect(Collectors.toList());
HapiLocalizer localizer = theRequestDetails.getFhirContext().getLocalizer();
String msg = localizer.getMessage("ca.uhn.fhir.jpa.dao.BaseStorageDao.invalidSearchParameter", paramName, resourceName, allowedParams);
throw new InvalidRequestException(Msg.code(323) + msg);

View File

@ -1,10 +1,10 @@
package ca.uhn.fhir.rest.server.provider;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.rest.annotation.IdParam;
@ -28,6 +28,7 @@ import ca.uhn.fhir.rest.server.method.SearchMethodBinding;
import ca.uhn.fhir.rest.server.method.SearchParameter;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.ExtensionUtil;
import ca.uhn.fhir.util.FhirTerser;
import ca.uhn.fhir.util.HapiExtensions;
@ -386,20 +387,22 @@ public class ServerCapabilityStatementProvider implements IServerConformanceProv
* but also fill in any gaps using params from the server itself. This makes sure we include
* global params like _lastUpdated
*/
Map<String, RuntimeSearchParam> searchParams;
ResourceSearchParams searchParams;
ISearchParamRegistry searchParamRegistry;
ResourceSearchParams serverConfigurationActiveSearchParams = serverConfiguration.getActiveSearchParams(resourceName);
if (mySearchParamRegistry != null) {
searchParamRegistry = mySearchParamRegistry;
searchParams = new HashMap<>(mySearchParamRegistry.getActiveSearchParams(resourceName));
for (Entry<String, RuntimeSearchParam> nextBuiltInSp : serverConfiguration.getActiveSearchParams(resourceName).entrySet()) {
String key = nextBuiltInSp.getKey();
if (key.startsWith("_") && !searchParams.containsKey(key) && searchParamEnabled(key)) {
searchParams.put(key, nextBuiltInSp.getValue());
searchParams = mySearchParamRegistry.getActiveSearchParams(resourceName).makeCopy();
for (String nextBuiltInSpName : serverConfigurationActiveSearchParams.getSearchParamNames()) {
if (nextBuiltInSpName.startsWith("_") &&
!searchParams.containsParamName(nextBuiltInSpName) &&
searchParamEnabled(nextBuiltInSpName)) {
searchParams.put(nextBuiltInSpName, serverConfigurationActiveSearchParams.get(nextBuiltInSpName));
}
}
} else {
searchParamRegistry = serverConfiguration;
searchParams = serverConfiguration.getActiveSearchParams(resourceName);
searchParams = serverConfigurationActiveSearchParams;
}

View File

@ -30,11 +30,8 @@ import org.apache.commons.lang3.Validate;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
public class FhirContextSearchParamRegistry implements ISearchParamRegistry {
@ -61,18 +58,18 @@ public class FhirContextSearchParamRegistry implements ISearchParamRegistry {
}
@Override
public Map<String, RuntimeSearchParam> getActiveSearchParams(String theResourceName) {
Map<String, RuntimeSearchParam> sps = new HashMap<>();
public ResourceSearchParams getActiveSearchParams(String theResourceName) {
ResourceSearchParams retval = new ResourceSearchParams(theResourceName);
RuntimeResourceDefinition nextResDef = myCtx.getResourceDefinition(theResourceName);
for (RuntimeSearchParam nextSp : nextResDef.getSearchParams()) {
sps.put(nextSp.getName(), nextSp);
retval.put(nextSp.getName(), nextSp);
}
for (RuntimeSearchParam next : myExtraSearchParams) {
sps.put(next.getName(), next);
retval.put(next.getName(), next);
}
return sps;
return retval;
}
public void addSearchParam(RuntimeSearchParam theSearchParam) {

View File

@ -29,10 +29,8 @@ import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
// TODO: JA remove default methods
public interface ISearchParamRegistry {
@ -45,7 +43,7 @@ public interface ISearchParamRegistry {
/**
* @return Returns all active search params for the given resource
*/
Map<String, RuntimeSearchParam> getActiveSearchParams(String theResourceName);
ResourceSearchParams getActiveSearchParams(String theResourceName);
/**
* Request that the cache be refreshed now, in the current thread
@ -84,11 +82,11 @@ public interface ISearchParamRegistry {
*/
default Collection<String> getValidSearchParameterNamesIncludingMeta(String theResourceName) {
TreeSet<String> retval;
Map<String, RuntimeSearchParam> searchParamMap = getActiveSearchParams(theResourceName);
if (searchParamMap == null) {
ResourceSearchParams activeSearchParams = getActiveSearchParams(theResourceName);
if (activeSearchParams == null) {
retval = new TreeSet<>();
} else {
retval = new TreeSet<>(searchParamMap.keySet());
retval = new TreeSet<>(activeSearchParams.getSearchParamNames());
}
retval.add(IAnyResource.SP_RES_ID);
retval.add(Constants.PARAM_LASTUPDATED);

View File

@ -0,0 +1,101 @@
package ca.uhn.fhir.rest.server.util;
/*-
* #%L
* HAPI FHIR - Server Framework
* %%
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Stream;
public class ResourceSearchParams {
private final String myResourceName;
private final Map<String, RuntimeSearchParam> myMap;
public ResourceSearchParams(String theResourceName) {
myResourceName = theResourceName;
myMap = new LinkedHashMap<>();
}
private ResourceSearchParams(String theResourceName, Map<String, RuntimeSearchParam> theMap) {
myResourceName = theResourceName;
myMap = theMap;
}
public Collection<RuntimeSearchParam> values() {
return myMap.values();
}
public static ResourceSearchParams empty(String theResourceName) {
return new ResourceSearchParams(theResourceName, Collections.emptyMap());
}
public ResourceSearchParams readOnly() {
return new ResourceSearchParams(myResourceName, Collections.unmodifiableMap(this.myMap));
}
public void remove(String theName) {
myMap.remove(theName);
}
public int size() {
return myMap.size();
}
public RuntimeSearchParam get(String theParamName) {
return myMap.get(theParamName);
}
public RuntimeSearchParam put(String theName, RuntimeSearchParam theSearchParam) {
return myMap.put(theName, theSearchParam);
}
public void addSearchParamIfAbsent(String theParamName, RuntimeSearchParam theRuntimeSearchParam) {
myMap.putIfAbsent(theParamName, theRuntimeSearchParam);
}
public Set<String> getSearchParamNames() {
return myMap.keySet();
}
public boolean containsParamName(String theParamName) {
return myMap.containsKey(theParamName);
}
public void removeInactive() {
myMap.entrySet().removeIf(entry -> entry.getValue().getStatus() != RuntimeSearchParam.RuntimeSearchParamStatusEnum.ACTIVE);
}
public Stream<String> getReferenceSearchParamNames() {
return myMap.entrySet().stream()
.filter(entry -> entry.getValue().getParamType() == RestSearchParameterTypeEnum.REFERENCE)
.map(Map.Entry::getKey);
}
public ResourceSearchParams makeCopy() {
return new ResourceSearchParams(myResourceName, new HashMap<>(myMap));
}
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-client-okhttp</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-server-jersey</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -20,10 +20,10 @@ package ca.uhn.fhir.jpa.dao;
* #L%
*/
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.RuntimeSearchParam;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.interceptor.api.HookParams;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.Pointcut;
@ -59,6 +59,7 @@ import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.rest.server.util.CompositeInterceptorBroadcaster;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import ca.uhn.fhir.util.BundleUtil;
import ca.uhn.fhir.util.FhirTerser;
import ca.uhn.fhir.util.OperationOutcomeUtil;
@ -462,7 +463,7 @@ public abstract class BaseStorageDao {
return;
}
Map<String, RuntimeSearchParam> searchParams = mySearchParamRegistry.getActiveSearchParams(getResourceName());
ResourceSearchParams searchParams = mySearchParamRegistry.getActiveSearchParams(getResourceName());
Set<String> paramNames = theSource.keySet();
for (String nextParamName : paramNames) {

View File

@ -47,6 +47,7 @@ import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.NotImplementedOperationException;
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
import ca.uhn.fhir.rest.server.util.ResourceSearchParams;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseBundle;
@ -61,7 +62,6 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
@ -105,7 +105,7 @@ public class DaoRegistryGraphQLStorageServices implements IGraphQLStorageService
SearchParameterMap params = new SearchParameterMap();
params.setLoadSynchronousUpTo(MAX_SEARCH_SIZE);
Map<String, RuntimeSearchParam> searchParams = mySearchParamRegistry.getActiveSearchParams(typeDef.getName());
ResourceSearchParams searchParams = mySearchParamRegistry.getActiveSearchParams(typeDef.getName());
for (Argument nextArgument : theSearchParams) {
@ -118,7 +118,7 @@ public class DaoRegistryGraphQLStorageServices implements IGraphQLStorageService
String searchParamName = graphqlArgumentToSearchParam(nextArgument.getName());
RuntimeSearchParam searchParam = searchParams.get(searchParamName);
if (searchParam == null) {
Set<String> graphqlArguments = searchParams.keySet().stream()
Set<String> graphqlArguments = searchParams.getSearchParamNames().stream()
.map(this::searchParamToGraphqlArgument)
.collect(Collectors.toSet());
String msg = myContext.getLocalizer().getMessageSanitized(DaoRegistryGraphQLStorageServices.class, "invalidGraphqlArgument", nextArgument.getName(), new TreeSet<>(graphqlArguments));

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -58,37 +58,37 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r4</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-r5</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu3</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-r4</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -6,12 +6,11 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<packaging>pom</packaging>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<name>HAPI-FHIR</name>
<description>An open-source implementation of the FHIR specification in Java.</description>
<url>https://hapifhir.io</url>
<organization>
<name>Smile CDR, Inc.</name>
<url>https://smilecdr.com</url>
@ -2003,7 +2002,7 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-checkstyle</artifactId>
<!-- Remember to bump this when you upgrade the version -->
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>6.0.0-PRE5-SNAPSHOT</version>
<version>6.0.0-PRE6-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>