Address review comments
This commit is contained in:
parent
c7de85339c
commit
1f37cdd8cf
|
@ -1258,7 +1258,7 @@ public enum Pointcut {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <b>Storage Hook:</b>
|
* <b>Storage Hook:</b>
|
||||||
* Invoked when a resource delete operation is about to fail due to referential integrity conflicts.
|
* Invoked when a resource delete operation is about to fail due to referential integrity hcts.
|
||||||
* <p>
|
* <p>
|
||||||
* Hooks will have access to the list of resources that have references to the resource being deleted.
|
* Hooks will have access to the list of resources that have references to the resource being deleted.
|
||||||
* </p>
|
* </p>
|
||||||
|
|
|
@ -149,12 +149,12 @@ ca.uhn.fhir.jpa.dao.predicate.PredicateBuilderReference.invalidResourceType=Inva
|
||||||
|
|
||||||
ca.uhn.fhir.jpa.dao.index.IdHelperService.nonUniqueForcedId=Non-unique ID specified, can not process request
|
ca.uhn.fhir.jpa.dao.index.IdHelperService.nonUniqueForcedId=Non-unique ID specified, can not process request
|
||||||
|
|
||||||
ca.uhn.fhir.jpa.partition.PartitionConfigSvcImpl.missingPartitionIdOrName=Partition must have an ID and a Name
|
ca.uhn.fhir.jpa.partition.PartitionLookupSvcImpl.missingPartitionIdOrName=Partition must have an ID and a Name
|
||||||
ca.uhn.fhir.jpa.partition.PartitionConfigSvcImpl.cantCreatePartition0=Can not create a partition with ID 0 (this is a reserved value)
|
ca.uhn.fhir.jpa.partition.PartitionLookupSvcImpl.cantCreatePartition0=Can not create a partition with ID 0 (this is a reserved value)
|
||||||
ca.uhn.fhir.jpa.partition.PartitionConfigSvcImpl.unknownPartitionId=No partition exists with ID {0}
|
ca.uhn.fhir.jpa.partition.PartitionLookupSvcImpl.unknownPartitionId=No partition exists with ID {0}
|
||||||
ca.uhn.fhir.jpa.partition.PartitionConfigSvcImpl.invalidName=Partition name "{0}" is not valid
|
ca.uhn.fhir.jpa.partition.PartitionLookupSvcImpl.invalidName=Partition name "{0}" is not valid
|
||||||
ca.uhn.fhir.jpa.partition.PartitionConfigSvcImpl.cantCreateDuplicatePartitionName=Partition name "{0}" is already defined
|
ca.uhn.fhir.jpa.partition.PartitionLookupSvcImpl.cantCreateDuplicatePartitionName=Partition name "{0}" is already defined
|
||||||
ca.uhn.fhir.jpa.partition.PartitionConfigSvcImpl.cantDeleteDefaultPartition=Can not delete default partition
|
ca.uhn.fhir.jpa.partition.PartitionLookupSvcImpl.cantDeleteDefaultPartition=Can not delete default partition
|
||||||
ca.uhn.fhir.jpa.partition.PartitionConfigSvcImpl.cantRenameDefaultPartition=Can not rename default partition
|
ca.uhn.fhir.jpa.partition.PartitionLookupSvcImpl.cantRenameDefaultPartition=Can not rename default partition
|
||||||
|
|
||||||
ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor.unknownTenantName=Unknown tenant: {0}
|
ca.uhn.fhir.rest.server.interceptor.partition.RequestTenantPartitionInterceptor.unknownTenantName=Unknown tenant: {0}
|
||||||
|
|
|
@ -73,7 +73,7 @@ The criteria for determining the partition will depend on your use case. For exa
|
||||||
|
|
||||||
* If you are implementing multi-tenancy the partition might be determined by using the [Request Tenant ID](/docs/server_plain/multitenancy.html). It could also be determined by looking at request headers, or the authorized user/session context, etc.
|
* If you are implementing multi-tenancy the partition might be determined by using the [Request Tenant ID](/docs/server_plain/multitenancy.html). It could also be determined by looking at request headers, or the authorized user/session context, etc.
|
||||||
|
|
||||||
* If you are implementing segmented data partitioning, the partition might be determined by examining the actpartitionInterceptorHeadersual resource being created, by the identity of the sending system, etc.
|
* If you are implementing segmented data partitioning, the partition might be determined by examining the actual resource being created, by the identity of the sending system, etc.
|
||||||
|
|
||||||
## Identify Partition for Read (Optional)
|
## Identify Partition for Read (Optional)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
**This page is a work in progress. It is not yet comprehensive.**
|
**This page is a work in progress. It is not yet comprehensive.**
|
||||||
|
|
||||||
It contains a description of the tables within the HAPI FHIR JPA database. Note that columns are shown using Java datatypes as opposed to SQL datatypes, because the exact SQL datatype used will vary depending on the underlying database platform.
|
It contains a description of the tables within the HAPI FHIR JPA database. Note that columns are shown using Java datatypes as opposed to SQL datatypes, because the exact SQL datatype used will vary depending on the underlying database platform. The schema creation scripts can be used to determine the underlying column types.
|
||||||
|
|
||||||
# Background: Persistent IDs (PIDs)
|
# Background: Persistent IDs (PIDs)
|
||||||
|
|
||||||
|
|
|
@ -16,9 +16,9 @@ import ca.uhn.fhir.jpa.entity.Search;
|
||||||
import ca.uhn.fhir.jpa.graphql.JpaStorageServices;
|
import ca.uhn.fhir.jpa.graphql.JpaStorageServices;
|
||||||
import ca.uhn.fhir.jpa.interceptor.JpaConsentContextServices;
|
import ca.uhn.fhir.jpa.interceptor.JpaConsentContextServices;
|
||||||
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
import ca.uhn.fhir.jpa.model.sched.ISchedulerService;
|
||||||
import ca.uhn.fhir.jpa.partition.IPartitionConfigSvc;
|
import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc;
|
||||||
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.PartitionLookupSvcImpl;
|
||||||
import ca.uhn.fhir.jpa.partition.PartitionManagementProvider;
|
import ca.uhn.fhir.jpa.partition.PartitionManagementProvider;
|
||||||
import ca.uhn.fhir.jpa.partition.RequestPartitionHelperService;
|
import ca.uhn.fhir.jpa.partition.RequestPartitionHelperService;
|
||||||
import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider;
|
import ca.uhn.fhir.jpa.provider.SubscriptionTriggeringProvider;
|
||||||
|
@ -241,8 +241,8 @@ public abstract class BaseConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Lazy
|
@Lazy
|
||||||
public IPartitionConfigSvc partitionConfigSvc() {
|
public IPartitionLookupSvc partitionConfigSvc() {
|
||||||
return new PartitionConfigSvcImpl();
|
return new PartitionLookupSvcImpl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
|
|
@ -33,5 +33,5 @@ public interface IResourceIndexedCompositeStringUniqueDao extends JpaRepository<
|
||||||
ResourceIndexedCompositeStringUnique findByQueryString(@Param("str") String theQueryString);
|
ResourceIndexedCompositeStringUnique findByQueryString(@Param("str") String theQueryString);
|
||||||
|
|
||||||
@Query("SELECT r FROM ResourceIndexedCompositeStringUnique r WHERE r.myResourceId = :resId")
|
@Query("SELECT r FROM ResourceIndexedCompositeStringUnique r WHERE r.myResourceId = :resId")
|
||||||
List<ResourceIndexedCompositeStringUnique> findAllForResourceId(@Param("resId") Long theResourceId);
|
List<ResourceIndexedCompositeStringUnique> findAllForResourceIdForUnitTest(@Param("resId") Long theResourceId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,20 +304,7 @@ public class IdHelperService {
|
||||||
.map(t -> t.getIdPartAsLong())
|
.map(t -> t.getIdPartAsLong())
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (!pids.isEmpty()) {
|
if (!pids.isEmpty()) {
|
||||||
Collection<Object[]> lookup;
|
resolvePids(theRequestPartitionId, pids, retVal);
|
||||||
if (theRequestPartitionId != null) {
|
|
||||||
if (theRequestPartitionId.getPartitionId() != null) {
|
|
||||||
lookup = myResourceTableDao.findLookupFieldsByResourcePidInPartition(pids, theRequestPartitionId.getPartitionId());
|
|
||||||
} else {
|
|
||||||
lookup = myResourceTableDao.findLookupFieldsByResourcePidInPartitionNull(pids);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
lookup = myResourceTableDao.findLookupFieldsByResourcePid(pids);
|
|
||||||
}
|
|
||||||
lookup
|
|
||||||
.stream()
|
|
||||||
.map(t -> new ResourceLookup((String) t[0], (Long) t[1], (Date) t[2]))
|
|
||||||
.forEach(retVal::add);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,6 +359,23 @@ public class IdHelperService {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void resolvePids(RequestPartitionId theRequestPartitionId, List<Long> thePidsToResolve, List<IResourceLookup> theTarget) {
|
||||||
|
Collection<Object[]> lookup;
|
||||||
|
if (theRequestPartitionId != null) {
|
||||||
|
if (theRequestPartitionId.getPartitionId() != null) {
|
||||||
|
lookup = myResourceTableDao.findLookupFieldsByResourcePidInPartition(thePidsToResolve, theRequestPartitionId.getPartitionId());
|
||||||
|
} else {
|
||||||
|
lookup = myResourceTableDao.findLookupFieldsByResourcePidInPartitionNull(thePidsToResolve);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
lookup = myResourceTableDao.findLookupFieldsByResourcePid(thePidsToResolve);
|
||||||
|
}
|
||||||
|
lookup
|
||||||
|
.stream()
|
||||||
|
.map(t -> new ResourceLookup((String) t[0], (Long) t[1], (Date) t[2]))
|
||||||
|
.forEach(theTarget::add);
|
||||||
|
}
|
||||||
|
|
||||||
public void clearCache() {
|
public void clearCache() {
|
||||||
myPersistentIdCache.invalidateAll();
|
myPersistentIdCache.invalidateAll();
|
||||||
myResourceLookupCache.invalidateAll();
|
myResourceLookupCache.invalidateAll();
|
||||||
|
|
|
@ -22,7 +22,7 @@ package ca.uhn.fhir.jpa.partition;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.entity.PartitionEntity;
|
import ca.uhn.fhir.jpa.entity.PartitionEntity;
|
||||||
|
|
||||||
public interface IPartitionConfigSvc {
|
public interface IPartitionLookupSvc {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is mostly here for unit test purposes. Regular code is not expected to call this method directly.
|
* This is mostly here for unit test purposes. Regular code is not expected to call this method directly.
|
|
@ -44,13 +44,13 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
|
||||||
public class PartitionConfigSvcImpl implements IPartitionConfigSvc {
|
public class PartitionLookupSvcImpl implements IPartitionLookupSvc {
|
||||||
|
|
||||||
public static final int DEFAULT_PERSISTED_PARTITION_ID = 0;
|
public static final int DEFAULT_PERSISTED_PARTITION_ID = 0;
|
||||||
public static final String DEFAULT_PERSISTED_PARTITION_NAME = "DEFAULT";
|
public static final String DEFAULT_PERSISTED_PARTITION_NAME = "DEFAULT";
|
||||||
private static final String DEFAULT_PERSISTED_PARTITION_DESC = "Default partition";
|
private static final String DEFAULT_PERSISTED_PARTITION_DESC = "Default partition";
|
||||||
private static final Pattern PARTITION_NAME_VALID_PATTERN = Pattern.compile("[a-zA-Z0-9_-]+");
|
private static final Pattern PARTITION_NAME_VALID_PATTERN = Pattern.compile("[a-zA-Z0-9_-]+");
|
||||||
private static final Logger ourLog = LoggerFactory.getLogger(PartitionConfigSvcImpl.class);
|
private static final Logger ourLog = LoggerFactory.getLogger(PartitionLookupSvcImpl.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlatformTransactionManager myTxManager;
|
private PlatformTransactionManager myTxManager;
|
||||||
|
@ -115,7 +115,7 @@ public class PartitionConfigSvcImpl implements IPartitionConfigSvc {
|
||||||
validatePartitionNameDoesntAlreadyExist(thePartition.getName());
|
validatePartitionNameDoesntAlreadyExist(thePartition.getName());
|
||||||
|
|
||||||
if (thePartition.getId() == DEFAULT_PERSISTED_PARTITION_ID) {
|
if (thePartition.getId() == DEFAULT_PERSISTED_PARTITION_ID) {
|
||||||
String msg = myFhirCtx.getLocalizer().getMessage(PartitionConfigSvcImpl.class, "cantCreatePartition0");
|
String msg = myFhirCtx.getLocalizer().getMessage(PartitionLookupSvcImpl.class, "cantCreatePartition0");
|
||||||
throw new InvalidRequestException(msg);
|
throw new InvalidRequestException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ public class PartitionConfigSvcImpl implements IPartitionConfigSvc {
|
||||||
|
|
||||||
Optional<PartitionEntity> existingPartitionOpt = myPartitionDao.findById(thePartition.getId());
|
Optional<PartitionEntity> existingPartitionOpt = myPartitionDao.findById(thePartition.getId());
|
||||||
if (existingPartitionOpt.isPresent() == false) {
|
if (existingPartitionOpt.isPresent() == false) {
|
||||||
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionConfigSvcImpl.class, "unknownPartitionId", thePartition.getId());
|
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionLookupSvcImpl.class, "unknownPartitionId", thePartition.getId());
|
||||||
throw new InvalidRequestException(msg);
|
throw new InvalidRequestException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ public class PartitionConfigSvcImpl implements IPartitionConfigSvc {
|
||||||
|
|
||||||
if (DEFAULT_PERSISTED_PARTITION_ID == thePartition.getId()) {
|
if (DEFAULT_PERSISTED_PARTITION_ID == thePartition.getId()) {
|
||||||
if (!DEFAULT_PERSISTED_PARTITION_NAME.equals(thePartition.getName())) {
|
if (!DEFAULT_PERSISTED_PARTITION_NAME.equals(thePartition.getName())) {
|
||||||
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionConfigSvcImpl.class, "cantRenameDefaultPartition");
|
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionLookupSvcImpl.class, "cantRenameDefaultPartition");
|
||||||
throw new InvalidRequestException(msg);
|
throw new InvalidRequestException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,13 +161,13 @@ public class PartitionConfigSvcImpl implements IPartitionConfigSvc {
|
||||||
Validate.notNull(thePartitionId);
|
Validate.notNull(thePartitionId);
|
||||||
|
|
||||||
if (DEFAULT_PERSISTED_PARTITION_ID == thePartitionId) {
|
if (DEFAULT_PERSISTED_PARTITION_ID == thePartitionId) {
|
||||||
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionConfigSvcImpl.class, "cantDeleteDefaultPartition");
|
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionLookupSvcImpl.class, "cantDeleteDefaultPartition");
|
||||||
throw new InvalidRequestException(msg);
|
throw new InvalidRequestException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<PartitionEntity> partition = myPartitionDao.findById(thePartitionId);
|
Optional<PartitionEntity> partition = myPartitionDao.findById(thePartitionId);
|
||||||
if (!partition.isPresent()) {
|
if (!partition.isPresent()) {
|
||||||
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionConfigSvcImpl.class, "unknownPartitionId", thePartitionId);
|
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionLookupSvcImpl.class, "unknownPartitionId", thePartitionId);
|
||||||
throw new IllegalArgumentException(msg);
|
throw new IllegalArgumentException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,19 +178,19 @@ public class PartitionConfigSvcImpl implements IPartitionConfigSvc {
|
||||||
|
|
||||||
private void validatePartitionNameDoesntAlreadyExist(String theName) {
|
private void validatePartitionNameDoesntAlreadyExist(String theName) {
|
||||||
if (myPartitionDao.findForName(theName).isPresent()) {
|
if (myPartitionDao.findForName(theName).isPresent()) {
|
||||||
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionConfigSvcImpl.class, "cantCreateDuplicatePartitionName", theName);
|
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionLookupSvcImpl.class, "cantCreateDuplicatePartitionName", theName);
|
||||||
throw new InvalidRequestException(msg);
|
throw new InvalidRequestException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateHaveValidPartitionIdAndName(PartitionEntity thePartition) {
|
private void validateHaveValidPartitionIdAndName(PartitionEntity thePartition) {
|
||||||
if (thePartition.getId() == null || isBlank(thePartition.getName())) {
|
if (thePartition.getId() == null || isBlank(thePartition.getName())) {
|
||||||
String msg = myFhirCtx.getLocalizer().getMessage(PartitionConfigSvcImpl.class, "missingPartitionIdOrName");
|
String msg = myFhirCtx.getLocalizer().getMessage(PartitionLookupSvcImpl.class, "missingPartitionIdOrName");
|
||||||
throw new InvalidRequestException(msg);
|
throw new InvalidRequestException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PARTITION_NAME_VALID_PATTERN.matcher(thePartition.getName()).matches()) {
|
if (!PARTITION_NAME_VALID_PATTERN.matcher(thePartition.getName()).matches()) {
|
||||||
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionConfigSvcImpl.class, "invalidName", thePartition.getName());
|
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionLookupSvcImpl.class, "invalidName", thePartition.getName());
|
||||||
throw new InvalidRequestException(msg);
|
throw new InvalidRequestException(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,7 +203,7 @@ public class PartitionConfigSvcImpl implements IPartitionConfigSvc {
|
||||||
return myTxTemplate.execute(t -> myPartitionDao
|
return myTxTemplate.execute(t -> myPartitionDao
|
||||||
.findForName(theName)
|
.findForName(theName)
|
||||||
.orElseThrow(() -> {
|
.orElseThrow(() -> {
|
||||||
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionConfigSvcImpl.class, "invalidName", theName);
|
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionLookupSvcImpl.class, "invalidName", theName);
|
||||||
return new IllegalArgumentException(msg);
|
return new IllegalArgumentException(msg);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ public class PartitionConfigSvcImpl implements IPartitionConfigSvc {
|
||||||
return myTxTemplate.execute(t -> myPartitionDao
|
return myTxTemplate.execute(t -> myPartitionDao
|
||||||
.findById(theId)
|
.findById(theId)
|
||||||
.orElseThrow(() -> {
|
.orElseThrow(() -> {
|
||||||
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionConfigSvcImpl.class, "unknownPartitionId", theId);
|
String msg = myFhirCtx.getLocalizer().getMessageSanitized(PartitionLookupSvcImpl.class, "unknownPartitionId", theId);
|
||||||
return new IllegalArgumentException(msg);
|
return new IllegalArgumentException(msg);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
|
@ -47,7 +47,7 @@ public class PartitionManagementProvider {
|
||||||
@Autowired
|
@Autowired
|
||||||
private FhirContext myCtx;
|
private FhirContext myCtx;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPartitionConfigSvc myPartitionConfigSvc;
|
private IPartitionLookupSvc myPartitionConfigSvc;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add Partition:
|
* Add Partition:
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class RequestPartitionHelperService implements IRequestPartitionHelperSer
|
||||||
@Autowired
|
@Autowired
|
||||||
private IInterceptorBroadcaster myInterceptorBroadcaster;
|
private IInterceptorBroadcaster myInterceptorBroadcaster;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPartitionConfigSvc myPartitionConfigSvc;
|
private IPartitionLookupSvc myPartitionConfigSvc;
|
||||||
@Autowired
|
@Autowired
|
||||||
private FhirContext myFhirContext;
|
private FhirContext myFhirContext;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -6,7 +6,7 @@ import ca.uhn.fhir.interceptor.api.Pointcut;
|
||||||
import ca.uhn.fhir.interceptor.executor.InterceptorService;
|
import ca.uhn.fhir.interceptor.executor.InterceptorService;
|
||||||
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
import ca.uhn.fhir.jpa.api.config.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
|
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
|
||||||
import ca.uhn.fhir.jpa.partition.IPartitionConfigSvc;
|
import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc;
|
||||||
import ca.uhn.fhir.test.BaseTest;
|
import ca.uhn.fhir.test.BaseTest;
|
||||||
import ca.uhn.fhir.jpa.bulk.IBulkDataExportSvc;
|
import ca.uhn.fhir.jpa.bulk.IBulkDataExportSvc;
|
||||||
import ca.uhn.fhir.jpa.entity.TermConcept;
|
import ca.uhn.fhir.jpa.entity.TermConcept;
|
||||||
|
@ -110,7 +110,7 @@ public abstract class BaseJpaTest extends BaseTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
protected ISearchCacheSvc mySearchCacheSvc;
|
protected ISearchCacheSvc mySearchCacheSvc;
|
||||||
@Autowired
|
@Autowired
|
||||||
protected IPartitionConfigSvc myPartitionConfigSvc;
|
protected IPartitionLookupSvc myPartitionConfigSvc;
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void afterPerformCleanup() {
|
public void afterPerformCleanup() {
|
||||||
|
|
|
@ -30,7 +30,7 @@ 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;
|
||||||
import ca.uhn.fhir.jpa.partition.IPartitionConfigSvc;
|
import ca.uhn.fhir.jpa.partition.IPartitionLookupSvc;
|
||||||
import ca.uhn.fhir.jpa.provider.r4.JpaSystemProviderR4;
|
import ca.uhn.fhir.jpa.provider.r4.JpaSystemProviderR4;
|
||||||
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||||
import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc;
|
import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc;
|
||||||
|
@ -103,7 +103,7 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
|
||||||
private static IFhirResourceDaoValueSet<ValueSet, Coding, CodeableConcept> ourValueSetDao;
|
private static IFhirResourceDaoValueSet<ValueSet, Coding, CodeableConcept> ourValueSetDao;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected IPartitionConfigSvc myPartitionConfigSvc;
|
protected IPartitionLookupSvc myPartitionConfigSvc;
|
||||||
@Autowired
|
@Autowired
|
||||||
protected ITermReadSvc myHapiTerminologySvc;
|
protected ITermReadSvc myHapiTerminologySvc;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
|
@ -7,7 +7,7 @@ import ca.uhn.fhir.interceptor.model.RequestPartitionId;
|
||||||
import ca.uhn.fhir.jpa.entity.PartitionEntity;
|
import ca.uhn.fhir.jpa.entity.PartitionEntity;
|
||||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
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.IPartitionLookupSvc;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
|
import ca.uhn.fhir.jpa.searchparam.SearchParamConstants;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
|
@ -76,7 +76,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
||||||
private int myPartitionId2;
|
private int myPartitionId2;
|
||||||
private boolean myHaveDroppedForcedIdUniqueConstraint;
|
private boolean myHaveDroppedForcedIdUniqueConstraint;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPartitionConfigSvc myPartitionConfigSvc;
|
private IPartitionLookupSvc myPartitionConfigSvc;
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void after() {
|
public void after() {
|
||||||
|
@ -365,12 +365,11 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
||||||
createRequestId();
|
createRequestId();
|
||||||
|
|
||||||
addCreatePartition(myPartitionId, myPartitionDate);
|
addCreatePartition(myPartitionId, myPartitionDate);
|
||||||
addCreatePartition(myPartitionId, myPartitionDate);
|
|
||||||
|
|
||||||
Organization org = new Organization();
|
Organization org = new Organization();
|
||||||
org.setName("org");
|
org.setName("org");
|
||||||
IIdType orgId = myOrganizationDao.create(org).getId().toUnqualifiedVersionless();
|
IIdType orgId = myOrganizationDao.create(org).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
addCreatePartition(myPartitionId, myPartitionDate);
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.getMeta().addTag("http://system", "code", "diisplay");
|
p.getMeta().addTag("http://system", "code", "diisplay");
|
||||||
p.addName().setFamily("FAM");
|
p.addName().setFamily("FAM");
|
||||||
|
@ -436,7 +435,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
||||||
assertEquals(myPartitionDate, presents.get(0).getPartitionId().getPartitionDate());
|
assertEquals(myPartitionDate, presents.get(0).getPartitionId().getPartitionDate());
|
||||||
|
|
||||||
// HFJ_IDX_CMP_STRING_UNIQ
|
// HFJ_IDX_CMP_STRING_UNIQ
|
||||||
List<ResourceIndexedCompositeStringUnique> uniques = myResourceIndexedCompositeStringUniqueDao.findAllForResourceId(patientId);
|
List<ResourceIndexedCompositeStringUnique> uniques = myResourceIndexedCompositeStringUniqueDao.findAllForResourceIdForUnitTest(patientId);
|
||||||
assertEquals(1, uniques.size());
|
assertEquals(1, uniques.size());
|
||||||
assertEquals(myPartitionId, uniques.get(0).getPartitionId().getPartitionId().intValue());
|
assertEquals(myPartitionId, uniques.get(0).getPartitionId().getPartitionId().intValue());
|
||||||
assertEquals(myPartitionDate, uniques.get(0).getPartitionId().getPartitionDate());
|
assertEquals(myPartitionDate, uniques.get(0).getPartitionId().getPartitionDate());
|
||||||
|
@ -450,12 +449,11 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
||||||
createRequestId();
|
createRequestId();
|
||||||
|
|
||||||
addCreateNoPartitionId(myPartitionDate);
|
addCreateNoPartitionId(myPartitionDate);
|
||||||
addCreateNoPartitionId(myPartitionDate);
|
|
||||||
|
|
||||||
Organization org = new Organization();
|
Organization org = new Organization();
|
||||||
org.setName("org");
|
org.setName("org");
|
||||||
IIdType orgId = myOrganizationDao.create(org).getId().toUnqualifiedVersionless();
|
IIdType orgId = myOrganizationDao.create(org).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
addCreateNoPartitionId(myPartitionDate);
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.getMeta().addTag("http://system", "code", "diisplay");
|
p.getMeta().addTag("http://system", "code", "diisplay");
|
||||||
p.addName().setFamily("FAM");
|
p.addName().setFamily("FAM");
|
||||||
|
@ -521,7 +519,7 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
||||||
assertEquals(myPartitionDate, presents.get(0).getPartitionId().getPartitionDate());
|
assertEquals(myPartitionDate, presents.get(0).getPartitionId().getPartitionDate());
|
||||||
|
|
||||||
// HFJ_IDX_CMP_STRING_UNIQ
|
// HFJ_IDX_CMP_STRING_UNIQ
|
||||||
List<ResourceIndexedCompositeStringUnique> uniques = myResourceIndexedCompositeStringUniqueDao.findAllForResourceId(patientId);
|
List<ResourceIndexedCompositeStringUnique> uniques = myResourceIndexedCompositeStringUniqueDao.findAllForResourceIdForUnitTest(patientId);
|
||||||
assertEquals(1, uniques.size());
|
assertEquals(1, uniques.size());
|
||||||
assertEquals(null, uniques.get(0).getPartitionId().getPartitionId());
|
assertEquals(null, uniques.get(0).getPartitionId().getPartitionId());
|
||||||
assertEquals(myPartitionDate, uniques.get(0).getPartitionId().getPartitionDate());
|
assertEquals(myPartitionDate, uniques.get(0).getPartitionId().getPartitionDate());
|
||||||
|
@ -533,13 +531,12 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCreate_ForcedId_WithPartition() {
|
public void testCreate_ForcedId_WithPartition() {
|
||||||
addCreatePartition(myPartitionId, myPartitionDate);
|
addCreatePartition(myPartitionId, myPartitionDate);
|
||||||
addCreatePartition(myPartitionId, myPartitionDate);
|
|
||||||
|
|
||||||
Organization org = new Organization();
|
Organization org = new Organization();
|
||||||
org.setId("org");
|
org.setId("org");
|
||||||
org.setName("org");
|
org.setName("org");
|
||||||
IIdType orgId = myOrganizationDao.update(org).getId().toUnqualifiedVersionless();
|
IIdType orgId = myOrganizationDao.update(org).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
addCreatePartition(myPartitionId, myPartitionDate);
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.setId("pat");
|
p.setId("pat");
|
||||||
p.getManagingOrganization().setReferenceElement(orgId);
|
p.getManagingOrganization().setReferenceElement(orgId);
|
||||||
|
@ -560,13 +557,12 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCreate_ForcedId_NoPartition() {
|
public void testCreate_ForcedId_NoPartition() {
|
||||||
addCreateNoPartition();
|
addCreateNoPartition();
|
||||||
addCreateNoPartition();
|
|
||||||
|
|
||||||
Organization org = new Organization();
|
Organization org = new Organization();
|
||||||
org.setId("org");
|
org.setId("org");
|
||||||
org.setName("org");
|
org.setName("org");
|
||||||
IIdType orgId = myOrganizationDao.update(org).getId().toUnqualifiedVersionless();
|
IIdType orgId = myOrganizationDao.update(org).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
addCreateNoPartition();
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.setId("pat");
|
p.setId("pat");
|
||||||
p.getManagingOrganization().setReferenceElement(orgId);
|
p.getManagingOrganization().setReferenceElement(orgId);
|
||||||
|
@ -585,13 +581,12 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCreate_ForcedId_DefaultPartition() {
|
public void testCreate_ForcedId_DefaultPartition() {
|
||||||
addCreateNoPartitionId(myPartitionDate);
|
addCreateNoPartitionId(myPartitionDate);
|
||||||
addCreateNoPartitionId(myPartitionDate);
|
|
||||||
|
|
||||||
Organization org = new Organization();
|
Organization org = new Organization();
|
||||||
org.setId("org");
|
org.setId("org");
|
||||||
org.setName("org");
|
org.setName("org");
|
||||||
IIdType orgId = myOrganizationDao.update(org).getId().toUnqualifiedVersionless();
|
IIdType orgId = myOrganizationDao.update(org).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
addCreateNoPartitionId(myPartitionDate);
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.setId("pat");
|
p.setId("pat");
|
||||||
p.getManagingOrganization().setReferenceElement(orgId);
|
p.getManagingOrganization().setReferenceElement(orgId);
|
||||||
|
@ -613,10 +608,10 @@ public class PartitioningR4Test extends BaseJpaR4SystemTest {
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateResourceWithPartition() {
|
public void testUpdateResourceWithPartition() {
|
||||||
createRequestId();
|
createRequestId();
|
||||||
addCreatePartition(myPartitionId, myPartitionDate);
|
|
||||||
addCreatePartition(myPartitionId, myPartitionDate);
|
|
||||||
|
|
||||||
// Create a resource
|
// Create a resource
|
||||||
|
addCreatePartition(myPartitionId, myPartitionDate);
|
||||||
|
addCreatePartition(myPartitionId, myPartitionDate);
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
p.getMeta().addTag("http://system", "code", "diisplay");
|
p.getMeta().addTag("http://system", "code", "diisplay");
|
||||||
p.setActive(true);
|
p.setActive(true);
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class PartitionManagementProviderTest {
|
||||||
@ClassRule
|
@ClassRule
|
||||||
public static RestfulServerRule ourServerRule = new RestfulServerRule(ourCtx);
|
public static RestfulServerRule ourServerRule = new RestfulServerRule(ourCtx);
|
||||||
@MockBean
|
@MockBean
|
||||||
private IPartitionConfigSvc myPartitionConfigSvc;
|
private IPartitionLookupSvc myPartitionConfigSvc;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PartitionManagementProvider myPartitionManagementProvider;
|
private PartitionManagementProvider myPartitionManagementProvider;
|
||||||
private IGenericClient myClient;
|
private IGenericClient myClient;
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import static ca.uhn.fhir.jpa.partition.PartitionConfigSvcImpl.DEFAULT_PERSISTED_PARTITION_NAME;
|
import static ca.uhn.fhir.jpa.partition.PartitionLookupSvcImpl.DEFAULT_PERSISTED_PARTITION_NAME;
|
||||||
import static org.hamcrest.Matchers.containsString;
|
import static org.hamcrest.Matchers.containsString;
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class DaoSubscriptionMatcherTest {
|
||||||
public static class MyConfig {
|
public static class MyConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public PartitionSettings partitionConfig() {
|
public PartitionSettings partitionSettings() {
|
||||||
return new PartitionSettings();
|
return new PartitionSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ import org.springframework.test.context.TestPropertySource;
|
||||||
public class TestSubscriptionConfig {
|
public class TestSubscriptionConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public PartitionSettings partitionConfig() {
|
public PartitionSettings partitionSettings() {
|
||||||
return new PartitionSettings();
|
return new PartitionSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class SubscriptionSubmitInterceptorLoaderTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public PartitionSettings partitionConfig() {
|
public PartitionSettings partitionSettings() {
|
||||||
return new PartitionSettings();
|
return new PartitionSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue