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