Merge branch 'ja_20200206_multitenancy' of github.com:jamesagnew/hapi-fhir into ja_20200206_multitenancy
This commit is contained in:
commit
e6c806283e
|
@ -79,22 +79,22 @@ public class PartitionId {
|
|||
}
|
||||
|
||||
@Nonnull
|
||||
public static PartitionId forPartitionId(@Nullable Integer thePartitionId) {
|
||||
return forPartitionId(thePartitionId, null);
|
||||
public static PartitionId fromPartitionId(@Nullable Integer thePartitionId) {
|
||||
return fromPartitionId(thePartitionId, null);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static PartitionId forPartitionId(@Nullable Integer thePartitionId, @Nullable LocalDate thePartitionDate) {
|
||||
public static PartitionId fromPartitionId(@Nullable Integer thePartitionId, @Nullable LocalDate thePartitionDate) {
|
||||
return new PartitionId(null, thePartitionId, thePartitionDate);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static PartitionId forPartitionName(@Nullable String thePartitionName) {
|
||||
return forPartitionName(thePartitionName, null);
|
||||
public static PartitionId fromPartitionName(@Nullable String thePartitionName) {
|
||||
return fromPartitionName(thePartitionName, null);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static PartitionId forPartitionName(@Nullable String thePartitionName, @Nullable LocalDate thePartitionDate) {
|
||||
public static PartitionId fromPartitionName(@Nullable String thePartitionName, @Nullable LocalDate thePartitionDate) {
|
||||
return new PartitionId(thePartitionName, null, thePartitionDate);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import ca.uhn.fhir.interceptor.api.Hook;
|
|||
import ca.uhn.fhir.interceptor.api.Interceptor;
|
||||
import ca.uhn.fhir.interceptor.api.Pointcut;
|
||||
import ca.uhn.fhir.interceptor.model.PartitionId;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
|
||||
import ca.uhn.fhir.rest.server.tenant.UrlBaseTenantIdentificationStrategy;
|
||||
|
@ -58,7 +58,7 @@ public class PartitionExamples {
|
|||
private PartitionId extractPartitionIdFromRequest(ServletRequestDetails theRequestDetails) {
|
||||
// We will use the tenant ID that came from the request as the partition name
|
||||
String tenantId = theRequestDetails.getTenantId();
|
||||
return PartitionId.forPartitionName(tenantId);
|
||||
return PartitionId.fromPartitionName(tenantId);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -72,13 +72,13 @@ public class PartitionExamples {
|
|||
@Hook(Pointcut.STORAGE_PARTITION_IDENTIFY_CREATE)
|
||||
public PartitionId PartitionIdentifyCreate(ServletRequestDetails theRequestDetails) {
|
||||
String partitionName = theRequestDetails.getHeader("X-Partition-Name");
|
||||
return PartitionId.forPartitionName(partitionName);
|
||||
return PartitionId.fromPartitionName(partitionName);
|
||||
}
|
||||
|
||||
@Hook(Pointcut.STORAGE_PARTITION_IDENTIFY_READ)
|
||||
public PartitionId PartitionIdentifyRead(ServletRequestDetails theRequestDetails) {
|
||||
String partitionName = theRequestDetails.getHeader("X-Partition-Name");
|
||||
return PartitionId.forPartitionName(partitionName);
|
||||
return PartitionId.fromPartitionName(partitionName);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -92,11 +92,11 @@ public class PartitionExamples {
|
|||
@Hook(Pointcut.STORAGE_PARTITION_IDENTIFY_CREATE)
|
||||
public PartitionId PartitionIdentifyCreate(IBaseResource theResource) {
|
||||
if (theResource instanceof Patient) {
|
||||
return PartitionId.forPartitionName("PATIENT");
|
||||
return PartitionId.fromPartitionName("PATIENT");
|
||||
} else if (theResource instanceof Observation) {
|
||||
return PartitionId.forPartitionName("OBSERVATION");
|
||||
return PartitionId.fromPartitionName("OBSERVATION");
|
||||
} else {
|
||||
return PartitionId.forPartitionName("OTHER");
|
||||
return PartitionId.fromPartitionName("OTHER");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,13 +108,13 @@ public class PartitionExamples {
|
|||
public class MultitenantServer extends RestfulServer {
|
||||
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
@Override
|
||||
protected void initialize() {
|
||||
|
||||
// Enable partitioning
|
||||
myPartitionConfig.setPartitioningEnabled(true);
|
||||
myPartitionSettings.setPartitioningEnabled(true);
|
||||
|
||||
// Set the tenant identification strategy
|
||||
setTenantIdentificationStrategy(new UrlBaseTenantIdentificationStrategy());
|
||||
|
|
|
@ -56,7 +56,7 @@ The following settings can be enabled:
|
|||
|
||||
* **Include Partition in Search Hashes** ([JavaDoc](/apidocs/hapi-fhir-jpaserver-model/ca/uhn/fhir/jpa/model/config/PartitionConfig.html#setIncludePartitionInSearchHashes(boolean))): If this feature is enabled, partition IDs will be factored into [Search Hashes](./schema.html#search-hashes). When this flag is not set (as is the default), when a search requests a specific partition, an additional SQL WHERE predicate is added to the query to explicitly request the given partition ID. When this flag is set, this additional WHERE predicate is not necessary since the partition is factored into the hash value being searched on. Setting this flag avoids the need to manually adjust indexes against the HFJ_SPIDX tables. Note that this flag should **not be used in environments where partitioning is being used for security purposes**, since it is possible for a user to reverse engineer false hash collisions.
|
||||
|
||||
* **Cross-Partition Reference Mode**: ([JavaDoc](/apidocs/hapi-fhir-jpaserver-model/ca/uhn/fhir/jpa/model/config/PartitionConfig.html#setAllowReferencesAcrossPartitions(ca.uhn.fhir.jpa.model.config.PartitionConfig.CrossPartitionReferenceMode))): This setting controls whether resources in one partition should be allowed to create references to resources in other partitions.
|
||||
* **Cross-Partition Reference Mode**: ([JavaDoc](/apidocs/hapi-fhir-jpaserver-model/ca/uhn/fhir/jpa/model/config/PartitionConfig.html#setAllowReferencesAcrossPartitions(ca.uhn.fhir.jpa.model.config.PartitionSettings.CrossPartitionReferenceMode))): This setting controls whether resources in one partition should be allowed to create references to resources in other partitions.
|
||||
|
||||
|
||||
# Partition Interceptors
|
||||
|
@ -84,7 +84,7 @@ A hook against the [`Pointcut.STORAGE_PARTITION_IDENTIFY_CREATE`](/apidocs/hapi-
|
|||
The [RequestTenantPartitionInterceptor](/docs/interceptors/built_in_server_interceptors.html#request-tenant-partition-interceptor) uses the request tenant ID to determine the partition name. A simplified version of its source is shown below:
|
||||
|
||||
```java
|
||||
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/PartitionExamples.java|partitionInterceptorHeaders}}
|
||||
{{snippet:classpath:/ca/uhn/hapi/fhir/docs/PartitionExamples.java|partitionInterceptorRequestPartition}}
|
||||
```
|
||||
|
||||
## Example: Partitioning based on headers
|
||||
|
|
|
@ -11,7 +11,7 @@ import ca.uhn.fhir.jpa.bulk.BulkDataExportProvider;
|
|||
import ca.uhn.fhir.jpa.bulk.BulkDataExportSvcImpl;
|
||||
import ca.uhn.fhir.jpa.bulk.IBulkDataExportSvc;
|
||||
import ca.uhn.fhir.jpa.dao.ISearchBuilder;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.partition.IPartitionConfigSvc;
|
||||
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperService;
|
||||
import ca.uhn.fhir.jpa.partition.PartitionConfigSvcImpl;
|
||||
|
@ -241,8 +241,8 @@ public abstract class BaseConfig {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public PartitionConfig partitionConfig() {
|
||||
return new PartitionConfig();
|
||||
public PartitionSettings partitionConfig() {
|
||||
return new PartitionSettings();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -29,7 +29,7 @@ import ca.uhn.fhir.jpa.delete.DeleteConflictService;
|
|||
import ca.uhn.fhir.jpa.entity.ResourceSearchView;
|
||||
import ca.uhn.fhir.jpa.entity.Search;
|
||||
import ca.uhn.fhir.jpa.entity.SearchTypeEnum;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.jpa.model.search.SearchStatusEnum;
|
||||
|
@ -190,7 +190,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> extends BaseStora
|
|||
private FhirContext myContext;
|
||||
private ApplicationContext myApplicationContext;
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
@Override
|
||||
protected IInterceptorBroadcaster getInterceptorBroadcaster() {
|
||||
|
|
|
@ -34,7 +34,7 @@ import ca.uhn.fhir.jpa.api.model.DeleteMethodOutcome;
|
|||
import ca.uhn.fhir.jpa.api.model.ExpungeOptions;
|
||||
import ca.uhn.fhir.jpa.api.model.ExpungeOutcome;
|
||||
import ca.uhn.fhir.jpa.delete.DeleteConflictService;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.cross.ResourcePersistentId;
|
||||
import ca.uhn.fhir.jpa.model.entity.BaseHasResource;
|
||||
import ca.uhn.fhir.jpa.model.entity.BaseTag;
|
||||
|
@ -147,7 +147,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
|||
@Autowired
|
||||
private IRequestPartitionHelperService myRequestPartitionHelperService;
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
@Override
|
||||
public void addTag(IIdType theId, TagTypeEnum theTagType, String theScheme, String theTerm, String theLabel, RequestDetails theRequest) {
|
||||
|
@ -685,7 +685,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
|||
|
||||
@Override
|
||||
public IBundleProvider history(Date theSince, Date theUntil, RequestDetails theRequestDetails) {
|
||||
if (myPartitionConfig.isPartitioningEnabled()) {
|
||||
if (myPartitionSettings.isPartitioningEnabled()) {
|
||||
String msg = getContext().getLocalizer().getMessage(BaseHapiFhirSystemDao.class, "noSystemOrTypeHistoryForPartitionAwareServer");
|
||||
throw new MethodNotAllowedException(msg);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package ca.uhn.fhir.jpa.dao;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
|
||||
import ca.uhn.fhir.jpa.api.model.ExpungeOptions;
|
||||
import ca.uhn.fhir.jpa.api.model.ExpungeOutcome;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.util.ResourceCountCache;
|
||||
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
|
||||
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||
|
@ -51,7 +50,7 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||
@Qualifier("myResourceCountsCache")
|
||||
public ResourceCountCache myResourceCountsCache;
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
@Override
|
||||
@Transactional(propagation = Propagation.NEVER)
|
||||
|
@ -81,7 +80,7 @@ public abstract class BaseHapiFhirSystemDao<T, MT> extends BaseHapiFhirDao<IBase
|
|||
|
||||
@Override
|
||||
public IBundleProvider history(Date theSince, Date theUntil, RequestDetails theRequestDetails) {
|
||||
if (myPartitionConfig.isPartitioningEnabled()) {
|
||||
if (myPartitionSettings.isPartitioningEnabled()) {
|
||||
String msg = getContext().getLocalizer().getMessage(BaseHapiFhirSystemDao.class, "noSystemOrTypeHistoryForPartitionAwareServer");
|
||||
throw new MethodNotAllowedException(msg);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import ca.uhn.fhir.interceptor.model.PartitionId;
|
|||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.dao.data.IForcedIdDao;
|
||||
import ca.uhn.fhir.jpa.dao.index.IdHelperService;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.cross.ResourcePersistentId;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperService;
|
||||
|
@ -285,7 +285,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
|
|||
private IRequestPartitionHelperService myRequestPartitionHelperService;
|
||||
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
@Transactional()
|
||||
@Override
|
||||
|
@ -302,7 +302,7 @@ public class FulltextSearchSvcImpl implements IFulltextSearchSvc {
|
|||
}
|
||||
|
||||
// Partitioning is not supported for this operation
|
||||
Validate.isTrue(myPartitionConfig.isPartitioningEnabled() == false, "Suggest keywords not supported for partitioned system");
|
||||
Validate.isTrue(myPartitionSettings.isPartitioningEnabled() == false, "Suggest keywords not supported for partitioned system");
|
||||
PartitionId partitionId = null;
|
||||
|
||||
ResourcePersistentId pid = myIdHelperService.resolveResourcePersistentIds(partitionId, contextParts[0], contextParts[1]);
|
||||
|
|
|
@ -40,7 +40,7 @@ import ca.uhn.fhir.jpa.dao.predicate.SearchBuilderJoinEnum;
|
|||
import ca.uhn.fhir.jpa.dao.predicate.SearchBuilderJoinKey;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceSearchView;
|
||||
import ca.uhn.fhir.jpa.interceptor.JpaPreResourceAccessDetails;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.cross.ResourcePersistentId;
|
||||
import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedCompositeStringUnique;
|
||||
|
@ -170,7 +170,7 @@ public class SearchBuilder implements ISearchBuilder {
|
|||
private PredicateBuilder myPredicateBuilder;
|
||||
private PartitionId myPartitionId;
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -488,7 +488,7 @@ public class SearchBuilder implements ISearchBuilder {
|
|||
Predicate joinParam1 = theBuilder.equal(join.get("myParamName"), theSort.getParamName());
|
||||
theQueryRoot.addPredicate(joinParam1);
|
||||
} else {
|
||||
Long hashIdentity = BaseResourceIndexedSearchParam.calculateHashIdentity(myPartitionConfig, myPartitionId, myResourceName, theSort.getParamName());
|
||||
Long hashIdentity = BaseResourceIndexedSearchParam.calculateHashIdentity(myPartitionSettings, myPartitionId, myResourceName, theSort.getParamName());
|
||||
Predicate joinParam1 = theBuilder.equal(join.get("myHashIdentity"), hashIdentity);
|
||||
theQueryRoot.addPredicate(joinParam1);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
|||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao;
|
||||
import ca.uhn.fhir.jpa.dao.MatchResourceUrlService;
|
||||
import ca.uhn.fhir.jpa.dao.data.IResourceIndexedCompositeStringUniqueDao;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.cross.ResourcePersistentId;
|
||||
import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedCompositeStringUnique;
|
||||
|
@ -91,7 +91,7 @@ public class SearchParamWithInlineReferencesExtractor {
|
|||
@Autowired
|
||||
private IResourceIndexedCompositeStringUniqueDao myResourceIndexedCompositeStringUniqueDao;
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
public void populateFromResource(ResourceIndexedSearchParams theParams, Date theUpdateTime, ResourceTable theEntity, IBaseResource theResource, ResourceIndexedSearchParams theExistingParams, RequestDetails theRequest) {
|
||||
extractInlineReferences(theResource, theRequest);
|
||||
|
@ -100,7 +100,7 @@ public class SearchParamWithInlineReferencesExtractor {
|
|||
|
||||
Set<Map.Entry<String, RuntimeSearchParam>> activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType()).entrySet();
|
||||
if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.ENABLED) {
|
||||
theParams.findMissingSearchParams(myPartitionConfig, myDaoConfig.getModelConfig(), theEntity, activeSearchParams);
|
||||
theParams.findMissingSearchParams(myPartitionSettings, myDaoConfig.getModelConfig(), theEntity, activeSearchParams);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -24,7 +24,7 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.interceptor.model.PartitionId;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.dao.SearchBuilder;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.BasePartitionable;
|
||||
import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate;
|
||||
|
@ -64,7 +64,7 @@ abstract class BasePredicateBuilder {
|
|||
DaoConfig myDaoConfig;
|
||||
boolean myDontUseHashesForSearch;
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
BasePredicateBuilder(SearchBuilder theSearchBuilder) {
|
||||
myCriteriaBuilder = theSearchBuilder.getBuilder();
|
||||
|
@ -119,7 +119,7 @@ abstract class BasePredicateBuilder {
|
|||
Join<ResourceTable, SearchParamPresent> paramPresentJoin = myQueryRoot.join("mySearchParamPresents", JoinType.LEFT);
|
||||
|
||||
Expression<Long> hashPresence = paramPresentJoin.get("myHashPresence").as(Long.class);
|
||||
Long hash = SearchParamPresent.calculateHashPresence(myPartitionConfig, thePartitionId, theResourceName, theParamName, !theMissing);
|
||||
Long hash = SearchParamPresent.calculateHashPresence(myPartitionSettings, thePartitionId, theResourceName, theParamName, !theMissing);
|
||||
|
||||
List<Predicate> predicates = new ArrayList<>();
|
||||
predicates.add(myCriteriaBuilder.equal(hashPresence, hash));
|
||||
|
@ -155,7 +155,7 @@ abstract class BasePredicateBuilder {
|
|||
andPredicates.add(paramNamePredicate);
|
||||
andPredicates.add(thePredicate);
|
||||
} else {
|
||||
long hashIdentity = BaseResourceIndexedSearchParam.calculateHashIdentity(myPartitionConfig, thePartitionId, theResourceName, theParamName);
|
||||
long hashIdentity = BaseResourceIndexedSearchParam.calculateHashIdentity(myPartitionSettings, thePartitionId, theResourceName, theParamName);
|
||||
Predicate hashIdentityPredicate = myCriteriaBuilder.equal(theFrom.get("myHashIdentity"), hashIdentity);
|
||||
andPredicates.add(hashIdentityPredicate);
|
||||
andPredicates.add(thePredicate);
|
||||
|
@ -164,8 +164,8 @@ abstract class BasePredicateBuilder {
|
|||
return myCriteriaBuilder.and(toArray(andPredicates));
|
||||
}
|
||||
|
||||
public PartitionConfig getPartitionConfig() {
|
||||
return myPartitionConfig;
|
||||
public PartitionSettings getPartitionSettings() {
|
||||
return myPartitionSettings;
|
||||
}
|
||||
|
||||
Predicate createPredicateNumeric(String theResourceName,
|
||||
|
|
|
@ -176,13 +176,13 @@ class PredicateBuilderQuantity extends BasePredicateBuilder implements IPredicat
|
|||
|
||||
Predicate hashPredicate;
|
||||
if (!isBlank(systemValue) && !isBlank(unitsValue)) {
|
||||
long hash = ResourceIndexedSearchParamQuantity.calculateHashSystemAndUnits(getPartitionConfig(), thePartitionId, theResourceName, theParamName, systemValue, unitsValue);
|
||||
long hash = ResourceIndexedSearchParamQuantity.calculateHashSystemAndUnits(getPartitionSettings(), thePartitionId, theResourceName, theParamName, systemValue, unitsValue);
|
||||
hashPredicate = myCriteriaBuilder.equal(theFrom.get("myHashIdentitySystemAndUnits"), hash);
|
||||
} else if (!isBlank(unitsValue)) {
|
||||
long hash = ResourceIndexedSearchParamQuantity.calculateHashUnits(getPartitionConfig(), thePartitionId, theResourceName, theParamName, unitsValue);
|
||||
long hash = ResourceIndexedSearchParamQuantity.calculateHashUnits(getPartitionSettings(), thePartitionId, theResourceName, theParamName, unitsValue);
|
||||
hashPredicate = myCriteriaBuilder.equal(theFrom.get("myHashIdentityAndUnits"), hash);
|
||||
} else {
|
||||
long hash = BaseResourceIndexedSearchParam.calculateHashIdentity(getPartitionConfig(), thePartitionId, theResourceName, theParamName);
|
||||
long hash = BaseResourceIndexedSearchParam.calculateHashIdentity(getPartitionSettings(), thePartitionId, theResourceName, theParamName);
|
||||
hashPredicate = myCriteriaBuilder.equal(theFrom.get("myHashIdentity"), hash);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ import ca.uhn.fhir.jpa.api.dao.IDao;
|
|||
import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.dao.SearchBuilder;
|
||||
import ca.uhn.fhir.jpa.dao.index.IdHelperService;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.cross.ResourcePersistentId;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceHistoryProvenanceEntity;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate;
|
||||
|
@ -111,7 +111,7 @@ class PredicateBuilderReference extends BasePredicateBuilder {
|
|||
@Autowired
|
||||
DaoRegistry myDaoRegistry;
|
||||
@Autowired
|
||||
PartitionConfig myPartitionConfig;
|
||||
PartitionSettings myPartitionSettings;
|
||||
@Autowired
|
||||
private IInterceptorBroadcaster myInterceptorBroadcaster;
|
||||
|
||||
|
@ -564,7 +564,7 @@ class PredicateBuilderReference extends BasePredicateBuilder {
|
|||
RuntimeSearchParam nextParamDef = mySearchParamRegistry.getActiveSearchParam(theResourceName, theParamName);
|
||||
if (nextParamDef != null) {
|
||||
|
||||
if (myPartitionConfig.isPartitioningEnabled() && myPartitionConfig.isIncludePartitionInSearchHashes()) {
|
||||
if (myPartitionSettings.isPartitioningEnabled() && myPartitionSettings.isIncludePartitionInSearchHashes()) {
|
||||
if (thePartitionId == null) {
|
||||
throw new PreconditionFailedException("This server is not configured to support search against all partitions");
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ class PredicateBuilderString extends BasePredicateBuilder implements IPredicateB
|
|||
boolean exactMatch = theParameter instanceof StringParam && ((StringParam) theParameter).isExact();
|
||||
if (exactMatch) {
|
||||
// Exact match
|
||||
Long hash = ResourceIndexedSearchParamString.calculateHashExact(getPartitionConfig(), thePartitionId, theResourceName, theParamName, rawSearchTerm);
|
||||
Long hash = ResourceIndexedSearchParamString.calculateHashExact(getPartitionSettings(), thePartitionId, theResourceName, theParamName, rawSearchTerm);
|
||||
return theBuilder.equal(theFrom.get("myHashExact").as(Long.class), hash);
|
||||
} else {
|
||||
// Normalized Match
|
||||
|
@ -187,7 +187,7 @@ class PredicateBuilderString extends BasePredicateBuilder implements IPredicateB
|
|||
Predicate predicate;
|
||||
if ((operation == null) ||
|
||||
(operation == SearchFilterParser.CompareOperation.sw)) {
|
||||
Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionConfig(), thePartitionId, myDaoConfig.getModelConfig(), theResourceName, theParamName, normalizedString);
|
||||
Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionSettings(), thePartitionId, myDaoConfig.getModelConfig(), theResourceName, theParamName, normalizedString);
|
||||
Predicate hashCode = theBuilder.equal(theFrom.get("myHashNormalizedPrefix").as(Long.class), hash);
|
||||
Predicate singleCode = theBuilder.like(theFrom.get("myValueNormalized").as(String.class), likeExpression);
|
||||
predicate = theBuilder.and(hashCode, singleCode);
|
||||
|
@ -196,7 +196,7 @@ class PredicateBuilderString extends BasePredicateBuilder implements IPredicateB
|
|||
Predicate singleCode = theBuilder.like(theFrom.get("myValueNormalized").as(String.class), likeExpression);
|
||||
predicate = combineParamIndexPredicateWithParamNamePredicate(theResourceName, theParamName, theFrom, singleCode, thePartitionId);
|
||||
} else if (operation == SearchFilterParser.CompareOperation.eq) {
|
||||
Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionConfig(), thePartitionId, myDaoConfig.getModelConfig(), theResourceName, theParamName, normalizedString);
|
||||
Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(getPartitionSettings(), thePartitionId, myDaoConfig.getModelConfig(), theResourceName, theParamName, normalizedString);
|
||||
Predicate hashCode = theBuilder.equal(theFrom.get("myHashNormalizedPrefix").as(Long.class), hash);
|
||||
Predicate singleCode = theBuilder.like(theFrom.get("myValueNormalized").as(String.class), normalizedString);
|
||||
predicate = theBuilder.and(hashCode, singleCode);
|
||||
|
|
|
@ -336,14 +336,14 @@ class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBu
|
|||
hashField = theFrom.get("myHashSystem").as(Long.class);
|
||||
values = theTokens
|
||||
.stream()
|
||||
.map(t -> ResourceIndexedSearchParamToken.calculateHashSystem(getPartitionConfig(), thePartitionId, theResourceName, theParamName, t.getSystem()))
|
||||
.map(t -> ResourceIndexedSearchParamToken.calculateHashSystem(getPartitionSettings(), thePartitionId, theResourceName, theParamName, t.getSystem()))
|
||||
.collect(Collectors.toList());
|
||||
break;
|
||||
case VALUE_ONLY:
|
||||
hashField = theFrom.get("myHashValue").as(Long.class);
|
||||
values = theTokens
|
||||
.stream()
|
||||
.map(t -> ResourceIndexedSearchParamToken.calculateHashValue(getPartitionConfig(), thePartitionId, theResourceName, theParamName, t.getCode()))
|
||||
.map(t -> ResourceIndexedSearchParamToken.calculateHashValue(getPartitionSettings(), thePartitionId, theResourceName, theParamName, t.getCode()))
|
||||
.collect(Collectors.toList());
|
||||
break;
|
||||
case SYSTEM_AND_VALUE:
|
||||
|
@ -351,14 +351,14 @@ class PredicateBuilderToken extends BasePredicateBuilder implements IPredicateBu
|
|||
hashField = theFrom.get("myHashSystemAndValue").as(Long.class);
|
||||
values = theTokens
|
||||
.stream()
|
||||
.map(t -> ResourceIndexedSearchParamToken.calculateHashSystemAndValue(getPartitionConfig(), thePartitionId, theResourceName, theParamName, t.getSystem(), t.getCode()))
|
||||
.map(t -> ResourceIndexedSearchParamToken.calculateHashSystemAndValue(getPartitionSettings(), thePartitionId, theResourceName, theParamName, t.getSystem(), t.getCode()))
|
||||
.collect(Collectors.toList());
|
||||
break;
|
||||
}
|
||||
|
||||
Predicate predicate = hashField.in(values);
|
||||
if (theModifier == TokenParamModifier.NOT) {
|
||||
Predicate identityPredicate = theBuilder.equal(theFrom.get("myHashIdentity").as(Long.class), BaseResourceIndexedSearchParam.calculateHashIdentity(getPartitionConfig(), thePartitionId, theResourceName, theParamName));
|
||||
Predicate identityPredicate = theBuilder.equal(theFrom.get("myHashIdentity").as(Long.class), BaseResourceIndexedSearchParam.calculateHashIdentity(getPartitionSettings(), thePartitionId, theResourceName, theParamName));
|
||||
Predicate disjunctionPredicate = theBuilder.not(predicate);
|
||||
predicate = theBuilder.and(identityPredicate, disjunctionPredicate);
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ class PredicateBuilderUri extends BasePredicateBuilder implements IPredicateBuil
|
|||
|
||||
Predicate uriPredicate = null;
|
||||
if (operation == null || operation == SearchFilterParser.CompareOperation.eq) {
|
||||
long hashUri = ResourceIndexedSearchParamUri.calculateHashUri(getPartitionConfig(), thePartitionId, theResourceName, theParamName, value);
|
||||
long hashUri = ResourceIndexedSearchParamUri.calculateHashUri(getPartitionSettings(), thePartitionId, theResourceName, theParamName, value);
|
||||
Predicate hashPredicate = myCriteriaBuilder.equal(join.get("myHashUri"), hashUri);
|
||||
codePredicates.add(hashPredicate);
|
||||
} else if (operation == SearchFilterParser.CompareOperation.ne) {
|
||||
|
@ -150,7 +150,7 @@ class PredicateBuilderUri extends BasePredicateBuilder implements IPredicateBuil
|
|||
}
|
||||
|
||||
if (uriPredicate != null) {
|
||||
long hashIdentity = BaseResourceIndexedSearchParam.calculateHashIdentity(getPartitionConfig(), thePartitionId, theResourceName, theParamName);
|
||||
long hashIdentity = BaseResourceIndexedSearchParam.calculateHashIdentity(getPartitionSettings(), thePartitionId, theResourceName, theParamName);
|
||||
Predicate hashIdentityPredicate = myCriteriaBuilder.equal(join.get("myHashIdentity"), hashIdentity);
|
||||
codePredicates.add(myCriteriaBuilder.and(hashIdentityPredicate, uriPredicate));
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ import ca.uhn.fhir.interceptor.api.Pointcut;
|
|||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.interceptor.model.PartitionId;
|
||||
import ca.uhn.fhir.jpa.entity.PartitionEntity;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
|
@ -56,7 +56,7 @@ public class RequestPartitionHelperService implements IRequestPartitionHelperSer
|
|||
@Autowired
|
||||
private FhirContext myFhirContext;
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
public RequestPartitionHelperService() {
|
||||
myPartitioningBlacklist = new HashSet<>();
|
||||
|
@ -87,7 +87,7 @@ public class RequestPartitionHelperService implements IRequestPartitionHelperSer
|
|||
|
||||
PartitionId partitionId = null;
|
||||
|
||||
if (myPartitionConfig.isPartitioningEnabled()) {
|
||||
if (myPartitionSettings.isPartitioningEnabled()) {
|
||||
// Interceptor call: STORAGE_PARTITION_IDENTIFY_READ
|
||||
HookParams params = new HookParams()
|
||||
.add(RequestDetails.class, theRequest)
|
||||
|
@ -108,7 +108,7 @@ public class RequestPartitionHelperService implements IRequestPartitionHelperSer
|
|||
public PartitionId determineCreatePartitionForRequest(@Nullable RequestDetails theRequest, @Nonnull IBaseResource theResource) {
|
||||
|
||||
PartitionId partitionId = null;
|
||||
if (myPartitionConfig.isPartitioningEnabled()) {
|
||||
if (myPartitionSettings.isPartitioningEnabled()) {
|
||||
// Interceptor call: STORAGE_PARTITION_IDENTIFY_CREATE
|
||||
HookParams params = new HookParams()
|
||||
.add(IBaseResource.class, theResource)
|
||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.sp;
|
|||
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.dao.data.ISearchParamPresentDao;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.model.entity.SearchParamPresent;
|
||||
import ca.uhn.fhir.jpa.util.AddRemoveCount;
|
||||
|
@ -39,7 +39,7 @@ public class SearchParamPresenceSvcImpl implements ISearchParamPresenceSvc {
|
|||
private ISearchParamPresentDao mySearchParamPresentDao;
|
||||
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
|
||||
@Autowired
|
||||
private DaoConfig myDaoConfig;
|
||||
|
@ -67,7 +67,7 @@ public class SearchParamPresenceSvcImpl implements ISearchParamPresenceSvc {
|
|||
String paramName = next.getKey();
|
||||
|
||||
SearchParamPresent present = new SearchParamPresent();
|
||||
present.setPartitionConfig(myPartitionConfig);
|
||||
present.setPartitionSettings(myPartitionSettings);
|
||||
present.setResource(theResource);
|
||||
present.setParamName(paramName);
|
||||
present.setPresent(next.getValue());
|
||||
|
|
|
@ -26,7 +26,7 @@ import ca.uhn.fhir.jpa.entity.TermCodeSystem;
|
|||
import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
|
||||
import ca.uhn.fhir.jpa.entity.TermConcept;
|
||||
import ca.uhn.fhir.jpa.interceptor.PerformanceTracingLoggingInterceptor;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
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.model.entity.ResourceTable;
|
||||
|
@ -189,7 +189,7 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
|
|||
@Autowired
|
||||
protected DaoConfig myDaoConfig;
|
||||
@Autowired
|
||||
protected PartitionConfig myPartitionConfig;
|
||||
protected PartitionSettings myPartitionSettings;
|
||||
@Autowired
|
||||
protected ModelConfig myModelConfig;
|
||||
@Autowired
|
||||
|
|
|
@ -6,7 +6,7 @@ import ca.uhn.fhir.interceptor.api.IAnonymousInterceptor;
|
|||
import ca.uhn.fhir.interceptor.api.Pointcut;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.entity.Search;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamNumber;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamQuantity;
|
||||
|
@ -992,10 +992,10 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
|
|||
List<ResourceIndexedSearchParamNumber> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
||||
ourLog.info(toStringMultiline(results));
|
||||
|
||||
ResourceIndexedSearchParamNumber expect0 = new ResourceIndexedSearchParamNumber(new PartitionConfig(), "RiskAssessment", RiskAssessment.SP_PROBABILITY, new BigDecimal("1.00"));
|
||||
ResourceIndexedSearchParamNumber expect0 = new ResourceIndexedSearchParamNumber(new PartitionSettings(), "RiskAssessment", RiskAssessment.SP_PROBABILITY, new BigDecimal("1.00"));
|
||||
expect0.setResource(resource);
|
||||
expect0.calculateHashes();
|
||||
ResourceIndexedSearchParamNumber expect1 = new ResourceIndexedSearchParamNumber(new PartitionConfig(), "RiskAssessment", RiskAssessment.SP_PROBABILITY, new BigDecimal("2.00"));
|
||||
ResourceIndexedSearchParamNumber expect1 = new ResourceIndexedSearchParamNumber(new PartitionSettings(), "RiskAssessment", RiskAssessment.SP_PROBABILITY, new BigDecimal("2.00"));
|
||||
expect1.setResource(resource);
|
||||
expect1.calculateHashes();
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.dao.r4;
|
|||
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.dao.data.ISearchDao;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap.EverythingModeEnum;
|
||||
|
@ -651,10 +651,10 @@ public class FhirResourceDaoR4SearchNoHashesTest extends BaseJpaR4Test {
|
|||
List<ResourceIndexedSearchParamNumber> results = myEntityManager.createQuery("SELECT i FROM " + type.getSimpleName() + " i", type).getResultList();
|
||||
ourLog.info(toStringMultiline(results));
|
||||
|
||||
ResourceIndexedSearchParamNumber expect0 = new ResourceIndexedSearchParamNumber(new PartitionConfig(), "RiskAssessment", RiskAssessment.SP_PROBABILITY, new BigDecimal("1.00"));
|
||||
ResourceIndexedSearchParamNumber expect0 = new ResourceIndexedSearchParamNumber(new PartitionSettings(), "RiskAssessment", RiskAssessment.SP_PROBABILITY, new BigDecimal("1.00"));
|
||||
expect0.setResource(resource);
|
||||
expect0.calculateHashes();
|
||||
ResourceIndexedSearchParamNumber expect1 = new ResourceIndexedSearchParamNumber(new PartitionConfig(), "RiskAssessment", RiskAssessment.SP_PROBABILITY, new BigDecimal("2.00"));
|
||||
ResourceIndexedSearchParamNumber expect1 = new ResourceIndexedSearchParamNumber(new PartitionSettings(), "RiskAssessment", RiskAssessment.SP_PROBABILITY, new BigDecimal("2.00"));
|
||||
expect1.setResource(resource);
|
||||
expect1.calculateHashes();
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import ca.uhn.fhir.interceptor.api.Interceptor;
|
|||
import ca.uhn.fhir.interceptor.api.Pointcut;
|
||||
import ca.uhn.fhir.interceptor.model.PartitionId;
|
||||
import ca.uhn.fhir.jpa.entity.PartitionEntity;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.jpa.partition.IPartitionConfigSvc;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
|
||||
|
@ -82,9 +82,9 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
public void after() {
|
||||
myPartitionInterceptor.assertNoRemainingIds();
|
||||
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(new PartitionConfig().isIncludePartitionInSearchHashes());
|
||||
myPartitionConfig.setPartitioningEnabled(new PartitionConfig().isPartitioningEnabled());
|
||||
myPartitionConfig.setAllowReferencesAcrossPartitions(new PartitionConfig().getAllowReferencesAcrossPartitions());
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(new PartitionSettings().isIncludePartitionInSearchHashes());
|
||||
myPartitionSettings.setPartitioningEnabled(new PartitionSettings().isPartitioningEnabled());
|
||||
myPartitionSettings.setAllowReferencesAcrossPartitions(new PartitionSettings().getAllowReferencesAcrossPartitions());
|
||||
|
||||
myInterceptorRegistry.unregisterInterceptorsIf(t -> t instanceof MyInterceptor);
|
||||
myInterceptor = null;
|
||||
|
@ -102,8 +102,8 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
public void before() throws ServletException {
|
||||
super.before();
|
||||
|
||||
myPartitionConfig.setPartitioningEnabled(true);
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(new PartitionConfig().isIncludePartitionInSearchHashes());
|
||||
myPartitionSettings.setPartitioningEnabled(true);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(new PartitionSettings().isIncludePartitionInSearchHashes());
|
||||
|
||||
myDaoConfig.setUniqueIndexesEnabled(true);
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testCreate_CrossPartitionReference_ByPid_Allowed() {
|
||||
myPartitionConfig.setAllowReferencesAcrossPartitions(PartitionConfig.CrossPartitionReferenceMode.ALLOWED_UNQUALIFIED);
|
||||
myPartitionSettings.setAllowReferencesAcrossPartitions(PartitionSettings.CrossPartitionReferenceMode.ALLOWED_UNQUALIFIED);
|
||||
|
||||
// Create patient in partition 1
|
||||
addCreatePartition(myPartitionId, myPartitionDate);
|
||||
|
@ -191,7 +191,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testCreate_CrossPartitionReference_ByForcedId_Allowed() {
|
||||
myPartitionConfig.setAllowReferencesAcrossPartitions(PartitionConfig.CrossPartitionReferenceMode.ALLOWED_UNQUALIFIED);
|
||||
myPartitionSettings.setAllowReferencesAcrossPartitions(PartitionSettings.CrossPartitionReferenceMode.ALLOWED_UNQUALIFIED);
|
||||
|
||||
// Create patient in partition 1
|
||||
addCreatePartition(myPartitionId, myPartitionDate);
|
||||
|
@ -885,7 +885,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_MissingParamString_SearchAllPartitions() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(false);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(false);
|
||||
|
||||
IIdType patientIdNull = createPatient(null, withFamily("FAMILY"));
|
||||
IIdType patientId1 = createPatient(1, withFamily("FAMILY"));
|
||||
|
@ -1011,7 +1011,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_MissingParamReference_SearchAllPartitions() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(false);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(false);
|
||||
|
||||
IIdType patientIdNull = createPatient(null, withFamily("FAMILY"));
|
||||
IIdType patientId1 = createPatient(1, withFamily("FAMILY"));
|
||||
|
@ -1038,7 +1038,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_MissingParamReference_SearchOnePartition_IncludePartitionInHashes() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(true);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(true);
|
||||
|
||||
createPatient(null, withFamily("FAMILY"));
|
||||
IIdType patientId1 = createPatient(1, withFamily("FAMILY"));
|
||||
|
@ -1066,7 +1066,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_MissingParamReference_SearchOnePartition_DontIncludePartitionInHashes() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(false);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(false);
|
||||
|
||||
createPatient(null, withFamily("FAMILY"));
|
||||
IIdType patientId1 = createPatient(1, withFamily("FAMILY"));
|
||||
|
@ -1161,7 +1161,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_DateParam_SearchAllPartitions() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(false);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(false);
|
||||
|
||||
IIdType patientIdNull = createPatient(null, withBirthdate("2020-04-20"));
|
||||
IIdType patientId1 = createPatient(1, withBirthdate("2020-04-20"));
|
||||
|
@ -1239,7 +1239,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_DateParam_SearchSpecificPartitions() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(false);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(false);
|
||||
|
||||
IIdType patientIdNull = createPatient(null, withBirthdate("2020-04-20"));
|
||||
IIdType patientId1 = createPatient(1, withBirthdate("2020-04-20"));
|
||||
|
@ -1317,7 +1317,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_DateParam_SearchDefaultPartitions() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(false);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(false);
|
||||
|
||||
IIdType patientIdNull = createPatient(null, withBirthdate("2020-04-20"));
|
||||
IIdType patientId1 = createPatient(1, withBirthdate("2020-04-20"));
|
||||
|
@ -1395,7 +1395,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_StringParam_SearchAllPartitions() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(false);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(false);
|
||||
|
||||
IIdType patientIdNull = createPatient(null, withFamily("FAMILY"));
|
||||
IIdType patientId1 = createPatient(1, withFamily("FAMILY"));
|
||||
|
@ -1466,7 +1466,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_StringParam_SearchAllPartitions_IncludePartitionInHashes() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(true);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(true);
|
||||
|
||||
addReadPartition(null);
|
||||
|
||||
|
@ -1484,7 +1484,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_StringParam_SearchDefaultPartition_IncludePartitionInHashes() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(true);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(true);
|
||||
|
||||
IIdType patientIdNull = createPatient(null, withFamily("FAMILY"));
|
||||
createPatient(1, withFamily("FAMILY"));
|
||||
|
@ -1510,7 +1510,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
@Test
|
||||
public void testSearch_StringParam_SearchOnePartition_IncludePartitionInHashes() {
|
||||
myPartitionConfig.setIncludePartitionInSearchHashes(true);
|
||||
myPartitionSettings.setIncludePartitionInSearchHashes(true);
|
||||
|
||||
createPatient(null, withFamily("FAMILY"));
|
||||
IIdType patientId1 = createPatient(1, withFamily("FAMILY"));
|
||||
|
@ -2004,7 +2004,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
|
||||
private void addCreatePartition(Integer thePartitionId, LocalDate thePartitionDate) {
|
||||
Validate.notNull(thePartitionId);
|
||||
PartitionId partitionId = PartitionId.forPartitionId(thePartitionId, thePartitionDate);
|
||||
PartitionId partitionId = PartitionId.fromPartitionId(thePartitionId, thePartitionDate);
|
||||
myPartitionInterceptor.addCreatePartition(partitionId);
|
||||
}
|
||||
|
||||
|
@ -2013,20 +2013,20 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
|||
}
|
||||
|
||||
private void addCreateNoPartitionId(LocalDate thePartitionDate) {
|
||||
PartitionId partitionId = PartitionId.forPartitionId(null, thePartitionDate);
|
||||
PartitionId partitionId = PartitionId.fromPartitionId(null, thePartitionDate);
|
||||
myPartitionInterceptor.addCreatePartition(partitionId);
|
||||
}
|
||||
|
||||
private void addReadPartition(Integer thePartitionId) {
|
||||
PartitionId partitionId = null;
|
||||
if (thePartitionId != null) {
|
||||
partitionId = PartitionId.forPartitionId(thePartitionId, null);
|
||||
partitionId = PartitionId.fromPartitionId(thePartitionId, null);
|
||||
}
|
||||
myPartitionInterceptor.addReadPartition(partitionId);
|
||||
}
|
||||
|
||||
private void addDefaultReadPartition() {
|
||||
PartitionId partitionId = PartitionId.forPartitionId(null, null);
|
||||
PartitionId partitionId = PartitionId.fromPartitionId(null, null);
|
||||
myPartitionInterceptor.addReadPartition(partitionId);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ 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.jpa.model.config.PartitionConfig;
|
||||
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.ResourceIndexedSearchParamQuantity;
|
||||
|
@ -66,7 +66,7 @@ public class SearchParamExtractorR4Test {
|
|||
obs.addCategory().addCoding().setSystem("SYSTEM").setCode("CODE");
|
||||
|
||||
SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), ourCtx, ourValidationSupport, mySearchParamRegistry);
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionConfig());
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionSettings());
|
||||
Set<BaseResourceIndexedSearchParam> tokens = extractor.extractSearchParamTokens(obs);
|
||||
assertEquals(1, tokens.size());
|
||||
ResourceIndexedSearchParamToken token = (ResourceIndexedSearchParamToken) tokens.iterator().next();
|
||||
|
@ -81,7 +81,7 @@ public class SearchParamExtractorR4Test {
|
|||
sp.addUseContext().setCode(new Coding().setSystem("http://system").setCode("code"));
|
||||
|
||||
SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), ourCtx, ourValidationSupport, mySearchParamRegistry);
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionConfig());
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionSettings());
|
||||
Set<BaseResourceIndexedSearchParam> tokens = extractor.extractSearchParamTokens(sp);
|
||||
assertEquals(1, tokens.size());
|
||||
ResourceIndexedSearchParamToken token = (ResourceIndexedSearchParamToken) tokens.iterator().next();
|
||||
|
@ -111,7 +111,7 @@ public class SearchParamExtractorR4Test {
|
|||
consent.setSource(new Reference().setReference("Consent/999"));
|
||||
|
||||
SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), ourCtx, ourValidationSupport, mySearchParamRegistry);
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionConfig());
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionSettings());
|
||||
RuntimeSearchParam param = mySearchParamRegistry.getActiveSearchParam("Consent", Consent.SP_SOURCE_REFERENCE);
|
||||
assertNotNull(param);
|
||||
ISearchParamExtractor.SearchParamSet<PathAndRef> links = extractor.extractResourceLinks(consent);
|
||||
|
@ -127,7 +127,7 @@ public class SearchParamExtractorR4Test {
|
|||
p.addIdentifier().setSystem("sys").setValue("val");
|
||||
|
||||
SearchParamExtractorR4 extractor = new SearchParamExtractorR4(new ModelConfig(), ourCtx, ourValidationSupport, mySearchParamRegistry);
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionConfig());
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionSettings());
|
||||
RuntimeSearchParam param = mySearchParamRegistry.getActiveSearchParam("Patient", Patient.SP_IDENTIFIER);
|
||||
assertNotNull(param);
|
||||
ISearchParamExtractor.SearchParamSet<BaseResourceIndexedSearchParam> params = extractor.extractSearchParamTokens(p, param);
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.junit.Test;
|
|||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class PartitionConfigSvcImplTest extends BaseJpaR4Test {
|
||||
public class PartitionSettingsSvcImplTest extends BaseJpaR4Test {
|
||||
|
||||
@Test
|
||||
public void testCreateAndFetchPartition() {
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.provider.r4;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.util.ProviderConstants;
|
||||
import ca.uhn.fhir.jpa.partition.PartitionManagementProvider;
|
||||
import ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor;
|
||||
|
@ -44,7 +44,7 @@ public class MultitenantServerR4Test extends BaseResourceProviderR4Test {
|
|||
public void before() throws Exception {
|
||||
super.before();
|
||||
|
||||
myPartitionConfig.setPartitioningEnabled(true);
|
||||
myPartitionSettings.setPartitioningEnabled(true);
|
||||
ourRestServer.registerInterceptor(myRequestTenantPartitionInterceptor);
|
||||
ourRestServer.registerProvider(myPartitionManagementProvider);
|
||||
ourRestServer.setTenantIdentificationStrategy(new UrlBaseTenantIdentificationStrategy());
|
||||
|
@ -63,7 +63,7 @@ public class MultitenantServerR4Test extends BaseResourceProviderR4Test {
|
|||
public void after() throws Exception {
|
||||
super.after();
|
||||
|
||||
myPartitionConfig.setPartitioningEnabled(new PartitionConfig().isPartitioningEnabled());
|
||||
myPartitionSettings.setPartitioningEnabled(new PartitionSettings().isPartitioningEnabled());
|
||||
ourRestServer.unregisterInterceptor(myRequestTenantPartitionInterceptor);
|
||||
ourRestServer.unregisterProvider(myPartitionManagementProvider);
|
||||
ourRestServer.setTenantIdentificationStrategy(null);
|
||||
|
|
|
@ -27,7 +27,7 @@ import ca.uhn.fhir.jpa.migrate.taskdef.BaseTableColumnTypeTask;
|
|||
import ca.uhn.fhir.jpa.migrate.taskdef.CalculateHashesTask;
|
||||
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.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.util.VersionEnum;
|
||||
|
||||
|
@ -522,7 +522,7 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
spidxCoords
|
||||
.addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.5")
|
||||
.setColumnName("HASH_IDENTITY")
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -545,7 +545,7 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
spidxDate
|
||||
.addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.10")
|
||||
.setColumnName("HASH_IDENTITY")
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -566,7 +566,7 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
spidxNumber
|
||||
.addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.14")
|
||||
.setColumnName("HASH_IDENTITY")
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -603,9 +603,9 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
spidxQuantity
|
||||
.addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.22")
|
||||
.setColumnName("HASH_IDENTITY")
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
.addCalculator("HASH_IDENTITY_AND_UNITS", t -> ResourceIndexedSearchParamQuantity.calculateHashUnits(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_UNITS")))
|
||||
.addCalculator("HASH_IDENTITY_SYS_UNITS", t -> ResourceIndexedSearchParamQuantity.calculateHashSystemAndUnits(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_SYSTEM"), t.getString("SP_UNITS")))
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
.addCalculator("HASH_IDENTITY_AND_UNITS", t -> ResourceIndexedSearchParamQuantity.calculateHashUnits(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_UNITS")))
|
||||
.addCalculator("HASH_IDENTITY_SYS_UNITS", t -> ResourceIndexedSearchParamQuantity.calculateHashSystemAndUnits(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_SYSTEM"), t.getString("SP_UNITS")))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -634,8 +634,8 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
spidxString
|
||||
.addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.28")
|
||||
.setColumnName("HASH_NORM_PREFIX")
|
||||
.addCalculator("HASH_NORM_PREFIX", t -> ResourceIndexedSearchParamString.calculateHashNormalized(new PartitionConfig(), null, new ModelConfig(), t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_VALUE_NORMALIZED")))
|
||||
.addCalculator("HASH_EXACT", t -> ResourceIndexedSearchParamString.calculateHashExact(new PartitionConfig(), null, t.getResourceType(), t.getParamName(), t.getString("SP_VALUE_EXACT")))
|
||||
.addCalculator("HASH_NORM_PREFIX", t -> ResourceIndexedSearchParamString.calculateHashNormalized(new PartitionSettings(), null, new ModelConfig(), t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_VALUE_NORMALIZED")))
|
||||
.addCalculator("HASH_EXACT", t -> ResourceIndexedSearchParamString.calculateHashExact(new PartitionSettings(), null, t.getResourceType(), t.getParamName(), t.getString("SP_VALUE_EXACT")))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -682,10 +682,10 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
spidxToken
|
||||
.addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.39")
|
||||
.setColumnName("HASH_IDENTITY")
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
.addCalculator("HASH_SYS", t -> ResourceIndexedSearchParamToken.calculateHashSystem(new PartitionConfig(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM")))
|
||||
.addCalculator("HASH_SYS_AND_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashSystemAndValue(new PartitionConfig(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM"), t.getString("SP_VALUE")))
|
||||
.addCalculator("HASH_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashValue(new PartitionConfig(), null, t.getResourceType(), t.getParamName(), t.getString("SP_VALUE")))
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
.addCalculator("HASH_SYS", t -> ResourceIndexedSearchParamToken.calculateHashSystem(new PartitionSettings(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM")))
|
||||
.addCalculator("HASH_SYS_AND_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashSystemAndValue(new PartitionSettings(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM"), t.getString("SP_VALUE")))
|
||||
.addCalculator("HASH_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashValue(new PartitionSettings(), null, t.getResourceType(), t.getParamName(), t.getString("SP_VALUE")))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -712,8 +712,8 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
spidxUri
|
||||
.addTask(new CalculateHashesTask(VersionEnum.V3_5_0, "20180903.44")
|
||||
.setColumnName("HASH_IDENTITY")
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
.addCalculator("HASH_URI", t -> ResourceIndexedSearchParamUri.calculateHashUri(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_URI")))
|
||||
.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME")))
|
||||
.addCalculator("HASH_URI", t -> ResourceIndexedSearchParamUri.calculateHashUri(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_URI")))
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -746,7 +746,7 @@ public class HapiFhirJpaMigrationTasks extends BaseMigrationTasks<VersionEnum> {
|
|||
Boolean present = columnToBoolean(t.get("SP_PRESENT"));
|
||||
String resType = (String) t.get("RES_TYPE");
|
||||
String paramName = (String) t.get("PARAM_NAME");
|
||||
Long hash = SearchParamPresent.calculateHashPresence(new PartitionConfig(), null, resType, paramName, present);
|
||||
Long hash = SearchParamPresent.calculateHashPresence(new PartitionSettings(), null, resType, paramName, present);
|
||||
consolidateSearchParamPresenceIndexesTask.executeSql("HFJ_RES_PARAM_PRESENT", "update HFJ_RES_PARAM_PRESENT set HASH_PRESENCE = ? where PID = ?", hash, pid);
|
||||
});
|
||||
version.addTask(consolidateSearchParamPresenceIndexesTask);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ca.uhn.fhir.jpa.migrate.taskdef;
|
||||
|
||||
import ca.uhn.fhir.jpa.migrate.tasks.api.BaseMigrationTasks;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.SearchParamPresent;
|
||||
import ca.uhn.fhir.util.VersionEnum;
|
||||
import org.junit.Test;
|
||||
|
@ -41,7 +41,7 @@ public class ArbitrarySqlTaskTest extends BaseTest {
|
|||
Boolean present = (Boolean) t.get("SP_PRESENT");
|
||||
String resType = (String) t.get("RES_TYPE");
|
||||
String paramName = (String) t.get("PARAM_NAME");
|
||||
Long hash = SearchParamPresent.calculateHashPresence(new PartitionConfig(), null, resType, paramName, present);
|
||||
Long hash = SearchParamPresent.calculateHashPresence(new PartitionSettings(), null, resType, paramName, present);
|
||||
task.executeSql("HFJ_RES_PARAM_PRESENT", "update HFJ_RES_PARAM_PRESENT set HASH_PRESENT = ? where PID = ?", hash, pid);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.migrate.taskdef;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.BaseResourceIndexedSearchParam;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamToken;
|
||||
import ca.uhn.fhir.util.VersionEnum;
|
||||
|
@ -27,10 +27,10 @@ public class CalculateHashesTest extends BaseTest {
|
|||
CalculateHashesTask task = new CalculateHashesTask(VersionEnum.V3_5_0, "1");
|
||||
task.setTableName("HFJ_SPIDX_TOKEN");
|
||||
task.setColumnName("HASH_IDENTITY");
|
||||
task.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME")));
|
||||
task.addCalculator("HASH_SYS", t -> ResourceIndexedSearchParamToken.calculateHashSystem(new PartitionConfig(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM")));
|
||||
task.addCalculator("HASH_SYS_AND_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashSystemAndValue(new PartitionConfig(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM"), t.getString("SP_VALUE")));
|
||||
task.addCalculator("HASH_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashValue(new PartitionConfig(), null, t.getResourceType(), t.getParamName(), t.getString("SP_VALUE")));
|
||||
task.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME")));
|
||||
task.addCalculator("HASH_SYS", t -> ResourceIndexedSearchParamToken.calculateHashSystem(new PartitionSettings(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM")));
|
||||
task.addCalculator("HASH_SYS_AND_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashSystemAndValue(new PartitionSettings(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM"), t.getString("SP_VALUE")));
|
||||
task.addCalculator("HASH_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashValue(new PartitionSettings(), null, t.getResourceType(), t.getParamName(), t.getString("SP_VALUE")));
|
||||
task.setBatchSize(1);
|
||||
getMigrator().addTask(task);
|
||||
|
||||
|
@ -74,10 +74,10 @@ public class CalculateHashesTest extends BaseTest {
|
|||
CalculateHashesTask task = new CalculateHashesTask(VersionEnum.V3_5_0, "1");
|
||||
task.setTableName("HFJ_SPIDX_TOKEN");
|
||||
task.setColumnName("HASH_IDENTITY");
|
||||
task.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionConfig(), null, t.getResourceType(), t.getString("SP_NAME")));
|
||||
task.addCalculator("HASH_SYS", t -> ResourceIndexedSearchParamToken.calculateHashSystem(new PartitionConfig(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM")));
|
||||
task.addCalculator("HASH_SYS_AND_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashSystemAndValue(new PartitionConfig(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM"), t.getString("SP_VALUE")));
|
||||
task.addCalculator("HASH_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashValue(new PartitionConfig(), null, t.getResourceType(), t.getParamName(), t.getString("SP_VALUE")));
|
||||
task.addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(new PartitionSettings(), null, t.getResourceType(), t.getString("SP_NAME")));
|
||||
task.addCalculator("HASH_SYS", t -> ResourceIndexedSearchParamToken.calculateHashSystem(new PartitionSettings(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM")));
|
||||
task.addCalculator("HASH_SYS_AND_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashSystemAndValue(new PartitionSettings(), null, t.getResourceType(), t.getParamName(), t.getString("SP_SYSTEM"), t.getString("SP_VALUE")));
|
||||
task.addCalculator("HASH_VALUE", t -> ResourceIndexedSearchParamToken.calculateHashValue(new PartitionSettings(), null, t.getResourceType(), t.getParamName(), t.getString("SP_VALUE")));
|
||||
task.setBatchSize(3);
|
||||
getMigrator().addTask(task);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ package ca.uhn.fhir.jpa.model.config;
|
|||
/**
|
||||
* @since 5.0.0
|
||||
*/
|
||||
public class PartitionConfig {
|
||||
public class PartitionSettings {
|
||||
|
||||
private boolean myPartitioningEnabled = false;
|
||||
private CrossPartitionReferenceMode myAllowReferencesAcrossPartitions = CrossPartitionReferenceMode.NOT_ALLOWED;
|
|
@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.model.entity;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.interceptor.model.PartitionId;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.rest.api.Constants;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
|
@ -83,7 +83,7 @@ public abstract class BaseResourceIndexedSearchParam extends BaseResourceIndex {
|
|||
private Date myUpdated;
|
||||
|
||||
@Transient
|
||||
private transient PartitionConfig myPartitionConfig;
|
||||
private transient PartitionSettings myPartitionSettings;
|
||||
|
||||
/**
|
||||
* Subclasses may override
|
||||
|
@ -158,26 +158,26 @@ public abstract class BaseResourceIndexedSearchParam extends BaseResourceIndex {
|
|||
throw new UnsupportedOperationException("No parameter matcher for " + theParam);
|
||||
}
|
||||
|
||||
public PartitionConfig getPartitionConfig() {
|
||||
return myPartitionConfig;
|
||||
public PartitionSettings getPartitionSettings() {
|
||||
return myPartitionSettings;
|
||||
}
|
||||
|
||||
public BaseResourceIndexedSearchParam setPartitionConfig(PartitionConfig thePartitionConfig) {
|
||||
myPartitionConfig = thePartitionConfig;
|
||||
public BaseResourceIndexedSearchParam setPartitionSettings(PartitionSettings thePartitionSettings) {
|
||||
myPartitionSettings = thePartitionSettings;
|
||||
return this;
|
||||
}
|
||||
|
||||
public static long calculateHashIdentity(PartitionConfig thePartitionConfig, PartitionId thePartitionId, String theResourceType, String theParamName) {
|
||||
return hash(thePartitionConfig, thePartitionId, theResourceType, theParamName);
|
||||
public static long calculateHashIdentity(PartitionSettings thePartitionSettings, PartitionId thePartitionId, String theResourceType, String theParamName) {
|
||||
return hash(thePartitionSettings, thePartitionId, theResourceType, theParamName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a fast and consistent hashing algorithm to a set of strings
|
||||
*/
|
||||
static long hash(PartitionConfig thePartitionConfig, PartitionId thePartitionId, String... theValues) {
|
||||
static long hash(PartitionSettings thePartitionSettings, PartitionId thePartitionId, String... theValues) {
|
||||
Hasher hasher = HASH_FUNCTION.newHasher();
|
||||
|
||||
if (thePartitionConfig.isPartitioningEnabled() && thePartitionConfig.isIncludePartitionInSearchHashes() && thePartitionId != null) {
|
||||
if (thePartitionSettings.isPartitioningEnabled() && thePartitionSettings.isIncludePartitionInSearchHashes() && thePartitionId != null) {
|
||||
if (thePartitionId.getPartitionId() != null) {
|
||||
hasher.putInt(thePartitionId.getPartitionId());
|
||||
}
|
||||
|
|
|
@ -81,6 +81,6 @@ public class PartitionablePartitionId implements Cloneable {
|
|||
}
|
||||
|
||||
public PartitionId toPartitionId() {
|
||||
return PartitionId.forPartitionId(getPartitionId(), getPartitionDate());
|
||||
return PartitionId.fromPartitionId(getPartitionId(), getPartitionDate());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.model.entity;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
|
@ -62,8 +62,8 @@ public class ResourceIndexedSearchParamCoords extends BaseResourceIndexedSearchP
|
|||
public ResourceIndexedSearchParamCoords() {
|
||||
}
|
||||
|
||||
public ResourceIndexedSearchParamCoords(PartitionConfig thePartitionConfig, String theResourceType, String theParamName, double theLatitude, double theLongitude) {
|
||||
setPartitionConfig(thePartitionConfig);
|
||||
public ResourceIndexedSearchParamCoords(PartitionSettings thePartitionSettings, String theResourceType, String theParamName, double theLatitude, double theLongitude) {
|
||||
setPartitionSettings(thePartitionSettings);
|
||||
setResourceType(theResourceType);
|
||||
setParamName(theParamName);
|
||||
setLatitude(theLatitude);
|
||||
|
@ -76,7 +76,7 @@ public class ResourceIndexedSearchParamCoords extends BaseResourceIndexedSearchP
|
|||
if (myHashIdentity == null && getParamName() != null) {
|
||||
String resourceType = getResourceType();
|
||||
String paramName = getParamName();
|
||||
setHashIdentity(calculateHashIdentity(getPartitionConfig(), getPartitionId(), resourceType, paramName));
|
||||
setHashIdentity(calculateHashIdentity(getPartitionSettings(), getPartitionId(), resourceType, paramName));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.model.entity;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
|
@ -78,8 +78,8 @@ public class ResourceIndexedSearchParamDate extends BaseResourceIndexedSearchPar
|
|||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public ResourceIndexedSearchParamDate(PartitionConfig thePartitionConfig, String theResourceType, String theParamName, Date theLow, Date theHigh, String theOriginalValue) {
|
||||
setPartitionConfig(thePartitionConfig);
|
||||
public ResourceIndexedSearchParamDate(PartitionSettings thePartitionSettings, String theResourceType, String theParamName, Date theLow, Date theHigh, String theOriginalValue) {
|
||||
setPartitionSettings(thePartitionSettings);
|
||||
setResourceType(theResourceType);
|
||||
setParamName(theParamName);
|
||||
setValueLow(theLow);
|
||||
|
@ -102,7 +102,7 @@ public class ResourceIndexedSearchParamDate extends BaseResourceIndexedSearchPar
|
|||
if (myHashIdentity == null && getParamName() != null) {
|
||||
String resourceType = getResourceType();
|
||||
String paramName = getParamName();
|
||||
setHashIdentity(calculateHashIdentity(getPartitionConfig(), getPartitionId(), resourceType, paramName));
|
||||
setHashIdentity(calculateHashIdentity(getPartitionSettings(), getPartitionId(), resourceType, paramName));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.jpa.model.entity;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.util.BigDecimalNumericFieldBridge;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.rest.param.NumberParam;
|
||||
|
@ -66,8 +66,8 @@ public class ResourceIndexedSearchParamNumber extends BaseResourceIndexedSearchP
|
|||
public ResourceIndexedSearchParamNumber() {
|
||||
}
|
||||
|
||||
public ResourceIndexedSearchParamNumber(PartitionConfig thePartitionConfig, String theResourceType, String theParamName, BigDecimal theValue) {
|
||||
setPartitionConfig(thePartitionConfig);
|
||||
public ResourceIndexedSearchParamNumber(PartitionSettings thePartitionSettings, String theResourceType, String theParamName, BigDecimal theValue) {
|
||||
setPartitionSettings(thePartitionSettings);
|
||||
setResourceType(theResourceType);
|
||||
setParamName(theParamName);
|
||||
setValue(theValue);
|
||||
|
@ -88,7 +88,7 @@ public class ResourceIndexedSearchParamNumber extends BaseResourceIndexedSearchP
|
|||
if (myHashIdentity == null && getParamName() != null) {
|
||||
String resourceType = getResourceType();
|
||||
String paramName = getParamName();
|
||||
setHashIdentity(calculateHashIdentity(getPartitionConfig(), getPartitionId(), resourceType, paramName));
|
||||
setHashIdentity(calculateHashIdentity(getPartitionSettings(), getPartitionId(), resourceType, paramName));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.model.entity;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.interceptor.model.PartitionId;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.util.BigDecimalNumericFieldBridge;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.rest.param.QuantityParam;
|
||||
|
@ -93,9 +93,9 @@ public class ResourceIndexedSearchParamQuantity extends BaseResourceIndexedSearc
|
|||
}
|
||||
|
||||
|
||||
public ResourceIndexedSearchParamQuantity(PartitionConfig thePartitionConfig, String theResourceType, String theParamName, BigDecimal theValue, String theSystem, String theUnits) {
|
||||
public ResourceIndexedSearchParamQuantity(PartitionSettings thePartitionSettings, String theResourceType, String theParamName, BigDecimal theValue, String theSystem, String theUnits) {
|
||||
this();
|
||||
setPartitionConfig(thePartitionConfig);
|
||||
setPartitionSettings(thePartitionSettings);
|
||||
setResourceType(theResourceType);
|
||||
setParamName(theParamName);
|
||||
setSystem(theSystem);
|
||||
|
@ -124,9 +124,9 @@ public class ResourceIndexedSearchParamQuantity extends BaseResourceIndexedSearc
|
|||
String paramName = getParamName();
|
||||
String units = getUnits();
|
||||
String system = getSystem();
|
||||
setHashIdentity(calculateHashIdentity(getPartitionConfig(), getPartitionId(), resourceType, paramName));
|
||||
setHashIdentityAndUnits(calculateHashUnits(getPartitionConfig(), getPartitionId(), resourceType, paramName, units));
|
||||
setHashIdentitySystemAndUnits(calculateHashSystemAndUnits(getPartitionConfig(), getPartitionId(), resourceType, paramName, system, units));
|
||||
setHashIdentity(calculateHashIdentity(getPartitionSettings(), getPartitionId(), resourceType, paramName));
|
||||
setHashIdentityAndUnits(calculateHashUnits(getPartitionSettings(), getPartitionId(), resourceType, paramName, units));
|
||||
setHashIdentitySystemAndUnits(calculateHashSystemAndUnits(getPartitionSettings(), getPartitionId(), resourceType, paramName, system, units));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,12 +289,12 @@ public class ResourceIndexedSearchParamQuantity extends BaseResourceIndexedSearc
|
|||
return retval;
|
||||
}
|
||||
|
||||
public static long calculateHashSystemAndUnits(PartitionConfig thePartitionConfig, PartitionId thePartitionId, String theResourceType, String theParamName, String theSystem, String theUnits) {
|
||||
return hash(thePartitionConfig, thePartitionId, theResourceType, theParamName, theSystem, theUnits);
|
||||
public static long calculateHashSystemAndUnits(PartitionSettings thePartitionSettings, PartitionId thePartitionId, String theResourceType, String theParamName, String theSystem, String theUnits) {
|
||||
return hash(thePartitionSettings, thePartitionId, theResourceType, theParamName, theSystem, theUnits);
|
||||
}
|
||||
|
||||
public static long calculateHashUnits(PartitionConfig thePartitionConfig, PartitionId thePartitionId, String theResourceType, String theParamName, String theUnits) {
|
||||
return hash(thePartitionConfig, thePartitionId, theResourceType, theParamName, theUnits);
|
||||
public static long calculateHashUnits(PartitionSettings thePartitionSettings, PartitionId thePartitionId, String theResourceType, String theParamName, String theUnits) {
|
||||
return hash(thePartitionSettings, thePartitionId, theResourceType, theParamName, theUnits);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.model.entity;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.interceptor.model.PartitionId;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.util.StringNormalizer;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
|
@ -114,8 +114,8 @@ public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchP
|
|||
super();
|
||||
}
|
||||
|
||||
public ResourceIndexedSearchParamString(PartitionConfig thePartitionConfig, ModelConfig theModelConfig, String theResourceType, String theParamName, String theValueNormalized, String theValueExact) {
|
||||
setPartitionConfig(thePartitionConfig);
|
||||
public ResourceIndexedSearchParamString(PartitionSettings thePartitionSettings, ModelConfig theModelConfig, String theResourceType, String theParamName, String theValueNormalized, String theValueExact) {
|
||||
setPartitionSettings(thePartitionSettings);
|
||||
setModelConfig(theModelConfig);
|
||||
setResourceType(theResourceType);
|
||||
setParamName(theParamName);
|
||||
|
@ -143,9 +143,9 @@ public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchP
|
|||
String paramName = getParamName();
|
||||
String valueNormalized = getValueNormalized();
|
||||
String valueExact = getValueExact();
|
||||
setHashNormalizedPrefix(calculateHashNormalized(getPartitionConfig(), getPartitionId(), myModelConfig, resourceType, paramName, valueNormalized));
|
||||
setHashExact(calculateHashExact(getPartitionConfig(), getPartitionId(), resourceType, paramName, valueExact));
|
||||
setHashIdentity(calculateHashIdentity(getPartitionConfig(), getPartitionId(), resourceType, paramName));
|
||||
setHashNormalizedPrefix(calculateHashNormalized(getPartitionSettings(), getPartitionId(), myModelConfig, resourceType, paramName, valueNormalized));
|
||||
setHashExact(calculateHashExact(getPartitionSettings(), getPartitionId(), resourceType, paramName, valueExact));
|
||||
setHashIdentity(calculateHashIdentity(getPartitionSettings(), getPartitionId(), resourceType, paramName));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,11 +279,11 @@ public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchP
|
|||
return defaultString(getValueNormalized()).startsWith(normalizedString);
|
||||
}
|
||||
|
||||
public static long calculateHashExact(PartitionConfig thePartitionConfig, PartitionId thePartitionId, String theResourceType, String theParamName, String theValueExact) {
|
||||
return hash(thePartitionConfig, thePartitionId, theResourceType, theParamName, theValueExact);
|
||||
public static long calculateHashExact(PartitionSettings thePartitionSettings, PartitionId thePartitionId, String theResourceType, String theParamName, String theValueExact) {
|
||||
return hash(thePartitionSettings, thePartitionId, theResourceType, theParamName, theValueExact);
|
||||
}
|
||||
|
||||
public static long calculateHashNormalized(PartitionConfig thePartitionConfig, PartitionId thePartitionId, ModelConfig theModelConfig, String theResourceType, String theParamName, String theValueNormalized) {
|
||||
public static long calculateHashNormalized(PartitionSettings thePartitionSettings, PartitionId thePartitionId, ModelConfig theModelConfig, String theResourceType, String theParamName, String theValueNormalized) {
|
||||
/*
|
||||
* If we're not allowing contained searches, we'll add the first
|
||||
* bit of the normalized value to the hash. This helps to
|
||||
|
@ -295,6 +295,6 @@ public class ResourceIndexedSearchParamString extends BaseResourceIndexedSearchP
|
|||
hashPrefixLength = 0;
|
||||
}
|
||||
|
||||
return hash(thePartitionConfig, thePartitionId, theResourceType, theParamName, left(theValueNormalized, hashPrefixLength));
|
||||
return hash(thePartitionSettings, thePartitionId, theResourceType, theParamName, left(theValueNormalized, hashPrefixLength));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.model.entity;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.interceptor.model.PartitionId;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -103,9 +103,9 @@ public class ResourceIndexedSearchParamToken extends BaseResourceIndexedSearchPa
|
|||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public ResourceIndexedSearchParamToken(PartitionConfig thePartitionConfig, String theResourceType, String theParamName, String theSystem, String theValue) {
|
||||
public ResourceIndexedSearchParamToken(PartitionSettings thePartitionSettings, String theResourceType, String theParamName, String theSystem, String theValue) {
|
||||
super();
|
||||
setPartitionConfig(thePartitionConfig);
|
||||
setPartitionSettings(thePartitionSettings);
|
||||
setResourceType(theResourceType);
|
||||
setParamName(theParamName);
|
||||
setSystem(theSystem);
|
||||
|
@ -134,10 +134,10 @@ public class ResourceIndexedSearchParamToken extends BaseResourceIndexedSearchPa
|
|||
String paramName = getParamName();
|
||||
String system = getSystem();
|
||||
String value = getValue();
|
||||
setHashIdentity(calculateHashIdentity(getPartitionConfig(), getPartitionId(), resourceType, paramName));
|
||||
setHashSystem(calculateHashSystem(getPartitionConfig(), getPartitionId(), resourceType, paramName, system));
|
||||
setHashSystemAndValue(calculateHashSystemAndValue(getPartitionConfig(), getPartitionId(), resourceType, paramName, system, value));
|
||||
setHashValue(calculateHashValue(getPartitionConfig(), getPartitionId(), resourceType, paramName, value));
|
||||
setHashIdentity(calculateHashIdentity(getPartitionSettings(), getPartitionId(), resourceType, paramName));
|
||||
setHashSystem(calculateHashSystem(getPartitionSettings(), getPartitionId(), resourceType, paramName, system));
|
||||
setHashSystemAndValue(calculateHashSystemAndValue(getPartitionSettings(), getPartitionId(), resourceType, paramName, system, value));
|
||||
setHashValue(calculateHashValue(getPartitionSettings(), getPartitionId(), resourceType, paramName, value));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,17 +283,17 @@ public class ResourceIndexedSearchParamToken extends BaseResourceIndexedSearchPa
|
|||
return retVal;
|
||||
}
|
||||
|
||||
public static long calculateHashSystem(PartitionConfig thePartitionConfig, PartitionId thePartitionId, String theResourceType, String theParamName, String theSystem) {
|
||||
return hash(thePartitionConfig, thePartitionId, theResourceType, theParamName, trim(theSystem));
|
||||
public static long calculateHashSystem(PartitionSettings thePartitionSettings, PartitionId thePartitionId, String theResourceType, String theParamName, String theSystem) {
|
||||
return hash(thePartitionSettings, thePartitionId, theResourceType, theParamName, trim(theSystem));
|
||||
}
|
||||
|
||||
public static long calculateHashSystemAndValue(PartitionConfig thePartitionConfig, PartitionId thePartitionId, String theResourceType, String theParamName, String theSystem, String theValue) {
|
||||
return hash(thePartitionConfig, thePartitionId, theResourceType, theParamName, defaultString(trim(theSystem)), trim(theValue));
|
||||
public static long calculateHashSystemAndValue(PartitionSettings thePartitionSettings, PartitionId thePartitionId, String theResourceType, String theParamName, String theSystem, String theValue) {
|
||||
return hash(thePartitionSettings, thePartitionId, theResourceType, theParamName, defaultString(trim(theSystem)), trim(theValue));
|
||||
}
|
||||
|
||||
public static long calculateHashValue(PartitionConfig thePartitionConfig, PartitionId thePartitionId, String theResourceType, String theParamName, String theValue) {
|
||||
public static long calculateHashValue(PartitionSettings thePartitionSettings, PartitionId thePartitionId, String theResourceType, String theParamName, String theValue) {
|
||||
String value = trim(theValue);
|
||||
return hash(thePartitionConfig, thePartitionId, theResourceType, theParamName, value);
|
||||
return hash(thePartitionSettings, thePartitionId, theResourceType, theParamName, value);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.model.entity;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.interceptor.model.PartitionId;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.rest.param.UriParam;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -82,8 +82,8 @@ public class ResourceIndexedSearchParamUri extends BaseResourceIndexedSearchPara
|
|||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public ResourceIndexedSearchParamUri(PartitionConfig thePartitionConfig, String theResourceType, String theParamName, String theUri) {
|
||||
setPartitionConfig(thePartitionConfig);
|
||||
public ResourceIndexedSearchParamUri(PartitionSettings thePartitionSettings, String theResourceType, String theParamName, String theUri) {
|
||||
setPartitionSettings(thePartitionSettings);
|
||||
setResourceType(theResourceType);
|
||||
setParamName(theParamName);
|
||||
setUri(theUri);
|
||||
|
@ -106,8 +106,8 @@ public class ResourceIndexedSearchParamUri extends BaseResourceIndexedSearchPara
|
|||
String resourceType = getResourceType();
|
||||
String paramName = getParamName();
|
||||
String uri = getUri();
|
||||
setHashIdentity(calculateHashIdentity(getPartitionConfig(), getPartitionId(), resourceType, paramName));
|
||||
setHashUri(calculateHashUri(getPartitionConfig(), getPartitionId(), resourceType, paramName, uri));
|
||||
setHashIdentity(calculateHashIdentity(getPartitionSettings(), getPartitionId(), resourceType, paramName));
|
||||
setHashUri(calculateHashUri(getPartitionSettings(), getPartitionId(), resourceType, paramName, uri));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,8 +209,8 @@ public class ResourceIndexedSearchParamUri extends BaseResourceIndexedSearchPara
|
|||
return defaultString(getUri()).equalsIgnoreCase(uri.getValueNotNull());
|
||||
}
|
||||
|
||||
public static long calculateHashUri(PartitionConfig thePartitionConfig, PartitionId thePartitionId, String theResourceType, String theParamName, String theUri) {
|
||||
return hash(thePartitionConfig, thePartitionId, theResourceType, theParamName, theUri);
|
||||
public static long calculateHashUri(PartitionSettings thePartitionSettings, PartitionId thePartitionId, String theResourceType, String theParamName, String theUri) {
|
||||
return hash(thePartitionSettings, thePartitionId, theResourceType, theParamName, theUri);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.model.entity;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.interceptor.model.PartitionId;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
|
@ -55,7 +55,7 @@ public class SearchParamPresent extends BasePartitionable implements Serializabl
|
|||
@Column(name = "HASH_PRESENCE")
|
||||
private Long myHashPresence;
|
||||
@Transient
|
||||
private transient PartitionConfig myPartitionConfig;
|
||||
private transient PartitionSettings myPartitionSettings;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -71,7 +71,7 @@ public class SearchParamPresent extends BasePartitionable implements Serializabl
|
|||
String resourceType = getResource().getResourceType();
|
||||
String paramName = getParamName();
|
||||
boolean present = myPresent;
|
||||
setHashPresence(calculateHashPresence(getPartitionConfig(), getPartitionId(), resourceType, paramName, present));
|
||||
setHashPresence(calculateHashPresence(getPartitionSettings(), getPartitionId(), resourceType, paramName, present));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,17 +118,17 @@ public class SearchParamPresent extends BasePartitionable implements Serializabl
|
|||
return b.build();
|
||||
}
|
||||
|
||||
public PartitionConfig getPartitionConfig() {
|
||||
return myPartitionConfig;
|
||||
public PartitionSettings getPartitionSettings() {
|
||||
return myPartitionSettings;
|
||||
}
|
||||
|
||||
public void setPartitionConfig(PartitionConfig thePartitionConfig) {
|
||||
myPartitionConfig = thePartitionConfig;
|
||||
public void setPartitionSettings(PartitionSettings thePartitionSettings) {
|
||||
myPartitionSettings = thePartitionSettings;
|
||||
}
|
||||
|
||||
public static long calculateHashPresence(PartitionConfig thePartitionConfig, PartitionId thePartitionId, String theResourceType, String theParamName, Boolean thePresent) {
|
||||
public static long calculateHashPresence(PartitionSettings thePartitionSettings, PartitionId thePartitionId, String theResourceType, String theParamName, Boolean thePresent) {
|
||||
String string = thePresent != null ? Boolean.toString(thePresent) : Boolean.toString(false);
|
||||
return BaseResourceIndexedSearchParam.hash(thePartitionConfig, thePartitionId, theResourceType, theParamName, string);
|
||||
return BaseResourceIndexedSearchParam.hash(thePartitionSettings, thePartitionId, theResourceType, theParamName, string);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.model.entity;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
@ -13,12 +13,12 @@ public class ResourceIndexedSearchParamCoordsTest {
|
|||
ResourceIndexedSearchParamCoords val1 = new ResourceIndexedSearchParamCoords()
|
||||
.setLatitude(100)
|
||||
.setLongitude(10);
|
||||
val1.setPartitionConfig(new PartitionConfig());
|
||||
val1.setPartitionSettings(new PartitionSettings());
|
||||
val1.calculateHashes();
|
||||
ResourceIndexedSearchParamCoords val2 = new ResourceIndexedSearchParamCoords()
|
||||
.setLatitude(100)
|
||||
.setLongitude(10);
|
||||
val2.setPartitionConfig(new PartitionConfig());
|
||||
val2.setPartitionSettings(new PartitionSettings());
|
||||
val2.calculateHashes();
|
||||
assertEquals(val1, val1);
|
||||
assertEquals(val1, val2);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.model.entity;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -36,8 +36,8 @@ public class ResourceIndexedSearchParamDateTest {
|
|||
|
||||
@Test
|
||||
public void equalsIsTrueForMatchingNullDates() {
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", null, null, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", null, null, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", null, null, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", null, null, "SomeValue");
|
||||
|
||||
assertTrue(param.equals(param2));
|
||||
assertTrue(param2.equals(param));
|
||||
|
@ -46,8 +46,8 @@ public class ResourceIndexedSearchParamDateTest {
|
|||
|
||||
@Test
|
||||
public void equalsIsTrueForMatchingDates() {
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", date1A, date2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", date1B, date2B, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", date1A, date2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", date1B, date2B, "SomeValue");
|
||||
|
||||
assertTrue(param.equals(param2));
|
||||
assertTrue(param2.equals(param));
|
||||
|
@ -56,8 +56,8 @@ public class ResourceIndexedSearchParamDateTest {
|
|||
|
||||
@Test
|
||||
public void equalsIsTrueForMatchingTimeStampsThatMatch() {
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", timestamp1A, timestamp2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", timestamp1B, timestamp2B, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", timestamp1A, timestamp2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", timestamp1B, timestamp2B, "SomeValue");
|
||||
|
||||
assertTrue(param.equals(param2));
|
||||
assertTrue(param2.equals(param));
|
||||
|
@ -68,8 +68,8 @@ public class ResourceIndexedSearchParamDateTest {
|
|||
// other will be equivalent but will be a java.sql.Timestamp. Equals should work in both directions.
|
||||
@Test
|
||||
public void equalsIsTrueForMixedTimestampsAndDates() {
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", date1A, date2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", timestamp1A, timestamp2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", date1A, date2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", timestamp1A, timestamp2A, "SomeValue");
|
||||
|
||||
assertTrue(param.equals(param2));
|
||||
assertTrue(param2.equals(param));
|
||||
|
@ -78,8 +78,8 @@ public class ResourceIndexedSearchParamDateTest {
|
|||
|
||||
@Test
|
||||
public void equalsIsFalseForNonMatchingDates() {
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", date1A, date2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", date2A, date1A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", date1A, date2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", date2A, date1A, "SomeValue");
|
||||
|
||||
assertFalse(param.equals(param2));
|
||||
assertFalse(param2.equals(param));
|
||||
|
@ -88,8 +88,8 @@ public class ResourceIndexedSearchParamDateTest {
|
|||
|
||||
@Test
|
||||
public void equalsIsFalseForNonMatchingDatesNullCase() {
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", date1A, date2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", null, null, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", date1A, date2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", null, null, "SomeValue");
|
||||
|
||||
assertFalse(param.equals(param2));
|
||||
assertFalse(param2.equals(param));
|
||||
|
@ -98,8 +98,8 @@ public class ResourceIndexedSearchParamDateTest {
|
|||
|
||||
@Test
|
||||
public void equalsIsFalseForNonMatchingTimeStamps() {
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", timestamp1A, timestamp2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", timestamp2A, timestamp1A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", timestamp1A, timestamp2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", timestamp2A, timestamp1A, "SomeValue");
|
||||
|
||||
assertFalse(param.equals(param2));
|
||||
assertFalse(param2.equals(param));
|
||||
|
@ -108,8 +108,8 @@ public class ResourceIndexedSearchParamDateTest {
|
|||
|
||||
@Test
|
||||
public void equalsIsFalseForMixedTimestampsAndDatesThatDoNotMatch() {
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", date1A, date2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "SomeResource", timestamp2A, timestamp1A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", date1A, date2A, "SomeValue");
|
||||
ResourceIndexedSearchParamDate param2 = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "SomeResource", timestamp2A, timestamp1A, "SomeValue");
|
||||
|
||||
assertFalse(param.equals(param2));
|
||||
assertFalse(param2.equals(param));
|
||||
|
@ -122,12 +122,12 @@ public class ResourceIndexedSearchParamDateTest {
|
|||
ResourceIndexedSearchParamDate val1 = new ResourceIndexedSearchParamDate()
|
||||
.setValueHigh(new Date(100000000L))
|
||||
.setValueLow(new Date(111111111L));
|
||||
val1.setPartitionConfig(new PartitionConfig());
|
||||
val1.setPartitionSettings(new PartitionSettings());
|
||||
val1.calculateHashes();
|
||||
ResourceIndexedSearchParamDate val2 = new ResourceIndexedSearchParamDate()
|
||||
.setValueHigh(new Date(100000000L))
|
||||
.setValueLow(new Date(111111111L));
|
||||
val2.setPartitionConfig(new PartitionConfig());
|
||||
val2.setPartitionSettings(new PartitionSettings());
|
||||
val2.calculateHashes();
|
||||
assertEquals(val1, val1);
|
||||
assertEquals(val1, val2);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.model.entity;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -11,7 +11,7 @@ import static org.junit.Assert.assertNotEquals;
|
|||
public class ResourceIndexedSearchParamQuantityTest {
|
||||
|
||||
private ResourceIndexedSearchParamQuantity createParam(String theParamName, String theValue, String theSystem, String theUnits) {
|
||||
ResourceIndexedSearchParamQuantity token = new ResourceIndexedSearchParamQuantity(new PartitionConfig(), "Patient", theParamName, new BigDecimal(theValue), theSystem, theUnits);
|
||||
ResourceIndexedSearchParamQuantity token = new ResourceIndexedSearchParamQuantity(new PartitionSettings(), "Patient", theParamName, new BigDecimal(theValue), theSystem, theUnits);
|
||||
token.setResource(new ResourceTable().setResourceType("Patient"));
|
||||
return token;
|
||||
}
|
||||
|
@ -30,11 +30,11 @@ public class ResourceIndexedSearchParamQuantityTest {
|
|||
public void testEquals() {
|
||||
ResourceIndexedSearchParamQuantity val1 = new ResourceIndexedSearchParamQuantity()
|
||||
.setValue(new BigDecimal(123));
|
||||
val1.setPartitionConfig(new PartitionConfig());
|
||||
val1.setPartitionSettings(new PartitionSettings());
|
||||
val1.calculateHashes();
|
||||
ResourceIndexedSearchParamQuantity val2 = new ResourceIndexedSearchParamQuantity()
|
||||
.setValue(new BigDecimal(123));
|
||||
val2.setPartitionConfig(new PartitionConfig());
|
||||
val2.setPartitionSettings(new PartitionSettings());
|
||||
val2.calculateHashes();
|
||||
assertEquals(val1, val1);
|
||||
assertEquals(val1, val2);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.model.entity;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
@ -11,7 +11,7 @@ public class ResourceIndexedSearchParamStringTest {
|
|||
|
||||
@Test
|
||||
public void testHashFunctions() {
|
||||
ResourceIndexedSearchParamString token = new ResourceIndexedSearchParamString(new PartitionConfig(), new ModelConfig(), "Patient", "NAME", "value", "VALUE");
|
||||
ResourceIndexedSearchParamString token = new ResourceIndexedSearchParamString(new PartitionSettings(), new ModelConfig(), "Patient", "NAME", "value", "VALUE");
|
||||
token.setResource(new ResourceTable().setResourceType("Patient"));
|
||||
|
||||
// Make sure our hashing function gives consistent results
|
||||
|
@ -21,7 +21,7 @@ public class ResourceIndexedSearchParamStringTest {
|
|||
|
||||
@Test
|
||||
public void testHashFunctionsPrefixOnly() {
|
||||
ResourceIndexedSearchParamString token = new ResourceIndexedSearchParamString(new PartitionConfig(), new ModelConfig(), "Patient", "NAME", "vZZZZZZZZZZZZZZZZ", "VZZZZZZzzzZzzzZ");
|
||||
ResourceIndexedSearchParamString token = new ResourceIndexedSearchParamString(new PartitionSettings(), new ModelConfig(), "Patient", "NAME", "vZZZZZZZZZZZZZZZZ", "VZZZZZZzzzZzzzZ");
|
||||
token.setResource(new ResourceTable().setResourceType("Patient"));
|
||||
|
||||
// Should be the same as in testHashFunctions()
|
||||
|
@ -37,12 +37,12 @@ public class ResourceIndexedSearchParamStringTest {
|
|||
ResourceIndexedSearchParamString val1 = new ResourceIndexedSearchParamString()
|
||||
.setValueExact("aaa")
|
||||
.setValueNormalized("AAA");
|
||||
val1.setPartitionConfig(new PartitionConfig());
|
||||
val1.setPartitionSettings(new PartitionSettings());
|
||||
val1.calculateHashes();
|
||||
ResourceIndexedSearchParamString val2 = new ResourceIndexedSearchParamString()
|
||||
.setValueExact("aaa")
|
||||
.setValueNormalized("AAA");
|
||||
val2.setPartitionConfig(new PartitionConfig());
|
||||
val2.setPartitionSettings(new PartitionSettings());
|
||||
val2.calculateHashes();
|
||||
assertEquals(val1, val1);
|
||||
assertEquals(val1, val2);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.model.entity;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
@ -10,7 +10,7 @@ public class ResourceIndexedSearchParamTokenTest {
|
|||
|
||||
@Test
|
||||
public void testHashFunctions() {
|
||||
ResourceIndexedSearchParamToken token = new ResourceIndexedSearchParamToken(new PartitionConfig(), "Patient", "NAME", "SYSTEM", "VALUE");
|
||||
ResourceIndexedSearchParamToken token = new ResourceIndexedSearchParamToken(new PartitionSettings(), "Patient", "NAME", "SYSTEM", "VALUE");
|
||||
token.setResource(new ResourceTable().setResourceType("Patient"));
|
||||
|
||||
// Make sure our hashing function gives consistent results
|
||||
|
@ -21,7 +21,7 @@ public class ResourceIndexedSearchParamTokenTest {
|
|||
|
||||
@Test
|
||||
public void testHashFunctionsWithOverlapNames() {
|
||||
ResourceIndexedSearchParamToken token = new ResourceIndexedSearchParamToken(new PartitionConfig(), "Patient", "NAME", "SYSTEM", "VALUE");
|
||||
ResourceIndexedSearchParamToken token = new ResourceIndexedSearchParamToken(new PartitionSettings(), "Patient", "NAME", "SYSTEM", "VALUE");
|
||||
token.setResource(new ResourceTable().setResourceType("Patient"));
|
||||
|
||||
// Make sure our hashing function gives consistent results
|
||||
|
@ -34,11 +34,11 @@ public class ResourceIndexedSearchParamTokenTest {
|
|||
public void testEquals() {
|
||||
ResourceIndexedSearchParamToken val1 = new ResourceIndexedSearchParamToken()
|
||||
.setValue("AAA");
|
||||
val1.setPartitionConfig(new PartitionConfig());
|
||||
val1.setPartitionSettings(new PartitionSettings());
|
||||
val1.calculateHashes();
|
||||
ResourceIndexedSearchParamToken val2 = new ResourceIndexedSearchParamToken()
|
||||
.setValue("AAA");
|
||||
val2.setPartitionConfig(new PartitionConfig());
|
||||
val2.setPartitionSettings(new PartitionSettings());
|
||||
val2.calculateHashes();
|
||||
assertEquals(val1, val1);
|
||||
assertEquals(val1, val2);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.model.entity;
|
||||
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
@ -10,7 +10,7 @@ public class ResourceIndexedSearchParamUriTest {
|
|||
|
||||
@Test
|
||||
public void testHashFunctions() {
|
||||
ResourceIndexedSearchParamUri token = new ResourceIndexedSearchParamUri(new PartitionConfig(), "Patient", "NAME", "http://example.com");
|
||||
ResourceIndexedSearchParamUri token = new ResourceIndexedSearchParamUri(new PartitionSettings(), "Patient", "NAME", "http://example.com");
|
||||
token.setResource(new ResourceTable().setResourceType("Patient"));
|
||||
|
||||
// Make sure our hashing function gives consistent results
|
||||
|
@ -21,11 +21,11 @@ public class ResourceIndexedSearchParamUriTest {
|
|||
public void testEquals() {
|
||||
ResourceIndexedSearchParamUri val1 = new ResourceIndexedSearchParamUri()
|
||||
.setUri("http://foo");
|
||||
val1.setPartitionConfig(new PartitionConfig());
|
||||
val1.setPartitionSettings(new PartitionSettings());
|
||||
val1.calculateHashes();
|
||||
ResourceIndexedSearchParamUri val2 = new ResourceIndexedSearchParamUri()
|
||||
.setUri("http://foo");
|
||||
val2.setPartitionConfig(new PartitionConfig());
|
||||
val2.setPartitionSettings(new PartitionSettings());
|
||||
val2.calculateHashes();
|
||||
assertEquals(val1, val1);
|
||||
assertEquals(val1, val2);
|
||||
|
|
|
@ -27,7 +27,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.jpa.model.config.PartitionConfig;
|
||||
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.ResourceIndexedSearchParamCoords;
|
||||
|
@ -92,7 +92,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
@Autowired
|
||||
private ModelConfig myModelConfig;
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
private Set<String> myIgnoredForSearchDatatypes;
|
||||
private BaseRuntimeChildDefinition myQuantityValueValueChild;
|
||||
private BaseRuntimeChildDefinition myQuantitySystemValueChild;
|
||||
|
@ -147,8 +147,8 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public BaseSearchParamExtractor setPartitionConfigForUnitTest(PartitionConfig thePartitionConfig) {
|
||||
myPartitionConfig = thePartitionConfig;
|
||||
public BaseSearchParamExtractor setPartitionConfigForUnitTest(PartitionSettings thePartitionSettings) {
|
||||
myPartitionSettings = thePartitionSettings;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -494,7 +494,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
String system = extractValueAsString(myQuantitySystemValueChild, theValue);
|
||||
String code = extractValueAsString(myQuantityCodeValueChild, theValue);
|
||||
|
||||
ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(myPartitionConfig, theResourceType, theSearchParam.getName(), nextValueValue, system, code);
|
||||
ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(myPartitionSettings, theResourceType, theSearchParam.getName(), nextValueValue, system, code);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
String nextValueString = "urn:iso:std:iso:4217";
|
||||
String nextValueCode = extractValueAsString(myMoneyCurrencyChild, theValue);
|
||||
String searchParamName = theSearchParam.getName();
|
||||
ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(myPartitionConfig, theResourceType, searchParamName, nextValueValue, nextValueString, nextValueCode);
|
||||
ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(myPartitionSettings, theResourceType, searchParamName, nextValueValue, nextValueString, nextValueCode);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
|
||||
|
@ -586,7 +586,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
Date end = extractValueAsDate(myPeriodEndValueChild, theValue);
|
||||
|
||||
if (start != null || end != null) {
|
||||
ResourceIndexedSearchParamDate nextEntity = new ResourceIndexedSearchParamDate(myPartitionConfig, theResourceType, theSearchParam.getName(), start, end, startAsString);
|
||||
ResourceIndexedSearchParamDate nextEntity = new ResourceIndexedSearchParamDate(myPartitionSettings, theResourceType, theSearchParam.getName(), start, end, startAsString);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
}
|
||||
|
||||
if (!dates.isEmpty()) {
|
||||
ResourceIndexedSearchParamDate nextEntity = new ResourceIndexedSearchParamDate(myPartitionConfig, theResourceType, theSearchParam.getName(), dates.first(), dates.last(), firstValue);
|
||||
ResourceIndexedSearchParamDate nextEntity = new ResourceIndexedSearchParamDate(myPartitionSettings, theResourceType, theSearchParam.getName(), dates.first(), dates.last(), firstValue);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
}
|
||||
|
@ -631,7 +631,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
BigDecimal value = extractValueAsBigDecimal(myDurationValueValueChild, theValue);
|
||||
if (value != null) {
|
||||
value = normalizeQuantityContainingTimeUnitsIntoDaysForNumberParam(system, code, value);
|
||||
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(myPartitionConfig, theResourceType, theSearchParam.getName(), value);
|
||||
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(myPartitionSettings, theResourceType, theSearchParam.getName(), value);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
}
|
||||
|
@ -642,7 +642,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
String system = extractValueAsString(myQuantitySystemValueChild, theValue);
|
||||
String code = extractValueAsString(myQuantityCodeValueChild, theValue);
|
||||
value = normalizeQuantityContainingTimeUnitsIntoDaysForNumberParam(system, code, value);
|
||||
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(myPartitionConfig, theResourceType, theSearchParam.getName(), value);
|
||||
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(myPartitionSettings, theResourceType, theSearchParam.getName(), value);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
}
|
||||
|
@ -652,7 +652,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
IPrimitiveType<Integer> value = (IPrimitiveType<Integer>) theValue;
|
||||
if (value.getValue() != null) {
|
||||
BigDecimal valueDecimal = new BigDecimal(value.getValue());
|
||||
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(myPartitionConfig, theResourceType, theSearchParam.getName(), valueDecimal);
|
||||
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(myPartitionSettings, theResourceType, theSearchParam.getName(), valueDecimal);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
|
||||
|
@ -663,7 +663,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
IPrimitiveType<BigDecimal> value = (IPrimitiveType<BigDecimal>) theValue;
|
||||
if (value.getValue() != null) {
|
||||
BigDecimal valueDecimal = value.getValue();
|
||||
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(myPartitionConfig, theResourceType, theSearchParam.getName(), valueDecimal);
|
||||
ResourceIndexedSearchParamNumber nextEntity = new ResourceIndexedSearchParamNumber(myPartitionSettings, theResourceType, theSearchParam.getName(), valueDecimal);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
|
||||
|
@ -690,7 +690,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
if (latitude != null && longitude != null) {
|
||||
double normalizedLatitude = Point.normalizeLatitude(latitude.doubleValue());
|
||||
double normalizedLongitude = Point.normalizeLongitude(longitude.doubleValue());
|
||||
ResourceIndexedSearchParamCoords nextEntity = new ResourceIndexedSearchParamCoords(myPartitionConfig, theResourceType, theSearchParam.getName(), normalizedLatitude, normalizedLongitude);
|
||||
ResourceIndexedSearchParamCoords nextEntity = new ResourceIndexedSearchParamCoords(myPartitionSettings, theResourceType, theSearchParam.getName(), normalizedLatitude, normalizedLongitude);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
}
|
||||
|
@ -811,7 +811,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
private void addDateTimeTypes(String theResourceType, Set<ResourceIndexedSearchParamDate> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
|
||||
IPrimitiveType<Date> nextBaseDateTime = (IPrimitiveType<Date>) theValue;
|
||||
if (nextBaseDateTime.getValue() != null) {
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(myPartitionConfig, theResourceType, theSearchParam.getName(), nextBaseDateTime.getValue(), nextBaseDateTime.getValue(), nextBaseDateTime.getValueAsString());
|
||||
ResourceIndexedSearchParamDate param = new ResourceIndexedSearchParamDate(myPartitionSettings, theResourceType, theSearchParam.getName(), nextBaseDateTime.getValue(), nextBaseDateTime.getValue(), nextBaseDateTime.getValueAsString());
|
||||
theParams.add(param);
|
||||
}
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
IPrimitiveType<?> value = (IPrimitiveType<?>) theValue;
|
||||
String valueAsString = value.getValueAsString();
|
||||
if (isNotBlank(valueAsString)) {
|
||||
ResourceIndexedSearchParamUri nextEntity = new ResourceIndexedSearchParamUri(myPartitionConfig, theResourceType, theSearchParam.getName(), valueAsString);
|
||||
ResourceIndexedSearchParamUri nextEntity = new ResourceIndexedSearchParamUri(myPartitionSettings, theResourceType, theSearchParam.getName(), valueAsString);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
}
|
||||
|
@ -840,7 +840,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
valueNormalized = valueNormalized.substring(0, ResourceIndexedSearchParamString.MAX_LENGTH);
|
||||
}
|
||||
|
||||
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(myPartitionConfig, getModelConfig(), theResourceType, searchParamName, valueNormalized, value);
|
||||
ResourceIndexedSearchParamString nextEntity = new ResourceIndexedSearchParamString(myPartitionSettings, getModelConfig(), theResourceType, searchParamName, valueNormalized, value);
|
||||
|
||||
Set params = theParams;
|
||||
params.add(nextEntity);
|
||||
|
@ -859,7 +859,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
}
|
||||
|
||||
ResourceIndexedSearchParamToken nextEntity;
|
||||
nextEntity = new ResourceIndexedSearchParamToken(myPartitionConfig, theResourceType, theSearchParam.getName(), system, value);
|
||||
nextEntity = new ResourceIndexedSearchParamToken(myPartitionSettings, theResourceType, theSearchParam.getName(), system, value);
|
||||
theParams.add(nextEntity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ package ca.uhn.fhir.jpa.searchparam.extractor;
|
|||
*/
|
||||
|
||||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
|
||||
|
@ -249,17 +249,17 @@ public final class ResourceIndexedSearchParams {
|
|||
'}';
|
||||
}
|
||||
|
||||
public void findMissingSearchParams(PartitionConfig thePartitionConfig, ModelConfig theModelConfig, ResourceTable theEntity, Set<Entry<String, RuntimeSearchParam>> theActiveSearchParams) {
|
||||
findMissingSearchParams(thePartitionConfig, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.STRING, myStringParams);
|
||||
findMissingSearchParams(thePartitionConfig, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.NUMBER, myNumberParams);
|
||||
findMissingSearchParams(thePartitionConfig, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.QUANTITY, myQuantityParams);
|
||||
findMissingSearchParams(thePartitionConfig, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.DATE, myDateParams);
|
||||
findMissingSearchParams(thePartitionConfig, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.URI, myUriParams);
|
||||
findMissingSearchParams(thePartitionConfig, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.TOKEN, myTokenParams);
|
||||
public void findMissingSearchParams(PartitionSettings thePartitionSettings, ModelConfig theModelConfig, ResourceTable theEntity, Set<Entry<String, RuntimeSearchParam>> 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);
|
||||
findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.DATE, myDateParams);
|
||||
findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.URI, myUriParams);
|
||||
findMissingSearchParams(thePartitionSettings, theModelConfig, theEntity, theActiveSearchParams, RestSearchParameterTypeEnum.TOKEN, myTokenParams);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <RT extends BaseResourceIndexedSearchParam> void findMissingSearchParams(PartitionConfig thePartitionConfig, ModelConfig theModelConfig, ResourceTable theEntity, Set<Map.Entry<String, RuntimeSearchParam>> activeSearchParams, RestSearchParameterTypeEnum type,
|
||||
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();
|
||||
|
@ -301,7 +301,7 @@ public final class ResourceIndexedSearchParams {
|
|||
default:
|
||||
continue;
|
||||
}
|
||||
param.setPartitionConfig(thePartitionConfig);
|
||||
param.setPartitionSettings(thePartitionSettings);
|
||||
param.setResource(theEntity);
|
||||
param.setMissing(true);
|
||||
param.setParamName(nextParamName);
|
||||
|
|
|
@ -27,7 +27,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.PartitionId;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.cross.IResourceLookup;
|
||||
import ca.uhn.fhir.jpa.model.entity.*;
|
||||
import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage;
|
||||
|
@ -67,7 +67,7 @@ public class SearchParamExtractorService {
|
|||
@Autowired
|
||||
private ISearchParamRegistry mySearchParamRegistry;
|
||||
@Autowired
|
||||
private PartitionConfig myPartitionConfig;
|
||||
private PartitionSettings myPartitionSettings;
|
||||
@Autowired(required = false)
|
||||
private IResourceLinkResolver myResourceLinkResolver;
|
||||
|
||||
|
@ -285,7 +285,7 @@ public class SearchParamExtractorService {
|
|||
*/
|
||||
|
||||
PartitionId targetPartitionId = thePartitionId;
|
||||
if (myPartitionConfig.isPartitioningEnabled() && myPartitionConfig.getAllowReferencesAcrossPartitions() == PartitionConfig.CrossPartitionReferenceMode.ALLOWED_UNQUALIFIED) {
|
||||
if (myPartitionSettings.isPartitioningEnabled() && myPartitionSettings.getAllowReferencesAcrossPartitions() == PartitionSettings.CrossPartitionReferenceMode.ALLOWED_UNQUALIFIED) {
|
||||
targetPartitionId = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
|||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||
import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
|
||||
import ca.uhn.fhir.context.support.IValidationSupport;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
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.ResourceIndexedSearchParamCoords;
|
||||
|
@ -59,7 +59,7 @@ public class SearchParamExtractorDstu3Test {
|
|||
ISearchParamRegistry searchParamRegistry = new MySearchParamRegistry();
|
||||
|
||||
SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), ourCtx, ourValidationSupport, searchParamRegistry);
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionConfig());
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionSettings());
|
||||
extractor.start();
|
||||
Set<BaseResourceIndexedSearchParam> tokens = extractor.extractSearchParamTokens(obs);
|
||||
assertEquals(1, tokens.size());
|
||||
|
@ -164,7 +164,7 @@ public class SearchParamExtractorDstu3Test {
|
|||
|
||||
MySearchParamRegistry searchParamRegistry = new MySearchParamRegistry();
|
||||
SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), ourCtx, ourValidationSupport, searchParamRegistry);
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionConfig());
|
||||
extractor.setPartitionConfigForUnitTest(new PartitionSettings());
|
||||
extractor.start();
|
||||
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ca.uhn.fhir.jpa.searchparam.extractor;
|
||||
|
||||
import ca.uhn.fhir.context.*;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.searchparam.JpaRuntimeSearchParam;
|
||||
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
|
||||
import ca.uhn.fhir.context.support.DefaultProfileValidationSupport;
|
||||
|
@ -39,19 +39,19 @@ public class SearchParamExtractorMegaTest {
|
|||
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
ISearchParamRegistry searchParamRegistry = new MySearchParamRegistry(ctx);
|
||||
process(ctx, new SearchParamExtractorDstu2(ctx, searchParamRegistry).setPartitionConfigForUnitTest(new PartitionConfig()));
|
||||
process(ctx, new SearchParamExtractorDstu2(ctx, searchParamRegistry).setPartitionConfigForUnitTest(new PartitionSettings()));
|
||||
|
||||
ctx = FhirContext.forDstu3();
|
||||
searchParamRegistry = new MySearchParamRegistry(ctx);
|
||||
process(ctx, new SearchParamExtractorDstu3(null, ctx, new DefaultProfileValidationSupport(ctx), searchParamRegistry).setPartitionConfigForUnitTest(new PartitionConfig()));
|
||||
process(ctx, new SearchParamExtractorDstu3(null, ctx, new DefaultProfileValidationSupport(ctx), searchParamRegistry).setPartitionConfigForUnitTest(new PartitionSettings()));
|
||||
|
||||
ctx = FhirContext.forR4();
|
||||
searchParamRegistry = new MySearchParamRegistry(ctx);
|
||||
process(ctx, new SearchParamExtractorR4(null, ctx, new DefaultProfileValidationSupport(ctx), searchParamRegistry).setPartitionConfigForUnitTest(new PartitionConfig()));
|
||||
process(ctx, new SearchParamExtractorR4(null, ctx, new DefaultProfileValidationSupport(ctx), searchParamRegistry).setPartitionConfigForUnitTest(new PartitionSettings()));
|
||||
|
||||
ctx = FhirContext.forR5();
|
||||
searchParamRegistry = new MySearchParamRegistry(ctx);
|
||||
process(ctx, new SearchParamExtractorR5(ctx, new DefaultProfileValidationSupport(ctx), searchParamRegistry).setPartitionConfigForUnitTest(new PartitionConfig()));
|
||||
process(ctx, new SearchParamExtractorR5(ctx, new DefaultProfileValidationSupport(ctx), searchParamRegistry).setPartitionConfigForUnitTest(new PartitionSettings()));
|
||||
}
|
||||
|
||||
private void process(FhirContext theCtx, BaseSearchParamExtractor theExtractor) throws Exception {
|
||||
|
|
|
@ -2,7 +2,7 @@ package ca.uhn.fhir.jpa.searchparam.matcher;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
|
||||
import ca.uhn.fhir.jpa.model.entity.ResourceIndexedSearchParamDate;
|
||||
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
|
||||
|
@ -209,7 +209,7 @@ public class InMemoryResourceMatcherR5Test {
|
|||
private ResourceIndexedSearchParams extractDateSearchParam(Observation theObservation) {
|
||||
ResourceIndexedSearchParams retval = new ResourceIndexedSearchParams();
|
||||
BaseDateTimeType dateValue = (BaseDateTimeType) theObservation.getEffective();
|
||||
ResourceIndexedSearchParamDate dateParam = new ResourceIndexedSearchParamDate(new PartitionConfig(), "Patient", "date", dateValue.getValue(), dateValue.getValue(), dateValue.getValueAsString());
|
||||
ResourceIndexedSearchParamDate dateParam = new ResourceIndexedSearchParamDate(new PartitionSettings(), "Patient", "date", dateValue.getValue(), dateValue.getValue(), dateValue.getValueAsString());
|
||||
retval.myDateParams.add(dateParam);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import ca.uhn.fhir.context.support.IValidationSupport;
|
|||
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.searchparam.config.SearchParamConfig;
|
||||
|
@ -67,8 +67,8 @@ public class DaoSubscriptionMatcherTest {
|
|||
public static class MyConfig {
|
||||
|
||||
@Bean
|
||||
public PartitionConfig partitionConfig() {
|
||||
return new PartitionConfig();
|
||||
public PartitionSettings partitionConfig() {
|
||||
return new PartitionSettings();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
package ca.uhn.fhir.jpa.subscription.module.config;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
|
||||
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.ISubscriptionMatcher;
|
||||
import ca.uhn.fhir.jpa.subscription.match.matcher.matching.InMemorySubscriptionMatcher;
|
||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||
import org.mockito.Mockito;
|
||||
|
@ -18,8 +17,8 @@ import org.springframework.test.context.TestPropertySource;
|
|||
public class TestSubscriptionConfig {
|
||||
|
||||
@Bean
|
||||
public PartitionConfig partitionConfig() {
|
||||
return new PartitionConfig();
|
||||
public PartitionSettings partitionConfig() {
|
||||
return new PartitionSettings();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -5,7 +5,7 @@ import ca.uhn.fhir.context.support.IValidationSupport;
|
|||
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionConfig;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
|
||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||
import ca.uhn.fhir.jpa.searchparam.config.SearchParamConfig;
|
||||
|
@ -69,8 +69,8 @@ public class SubscriptionSubmitInterceptorLoaderTest {
|
|||
}
|
||||
|
||||
@Bean
|
||||
public PartitionConfig partitionConfig() {
|
||||
return new PartitionConfig();
|
||||
public PartitionSettings partitionConfig() {
|
||||
return new PartitionSettings();
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
|
@ -65,7 +65,7 @@ public class RequestTenantPartitionInterceptor {
|
|||
throw new InternalErrorException("No tenant ID has been specified");
|
||||
}
|
||||
|
||||
return PartitionId.forPartitionName(tenantId);
|
||||
return PartitionId.fromPartitionName(tenantId);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue