Initial commit - Not yet compiling
This commit is contained in:
parent
9428430822
commit
4afa55ea26
|
@ -14,6 +14,8 @@ import ca.uhn.fhir.jpa.provider.TerminologyUploaderProvider;
|
||||||
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||||
import ca.uhn.fhir.jpa.search.IStaleSearchDeletingSvc;
|
import ca.uhn.fhir.jpa.search.IStaleSearchDeletingSvc;
|
||||||
import ca.uhn.fhir.jpa.search.StaleSearchDeletingSvcImpl;
|
import ca.uhn.fhir.jpa.search.StaleSearchDeletingSvcImpl;
|
||||||
|
import ca.uhn.fhir.jpa.search.cache.DatabaseSearchResultCacheSvcImpl;
|
||||||
|
import ca.uhn.fhir.jpa.search.cache.ISearchResultCacheSvc;
|
||||||
import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc;
|
import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc;
|
||||||
import ca.uhn.fhir.jpa.search.reindex.ResourceReindexingSvcImpl;
|
import ca.uhn.fhir.jpa.search.reindex.ResourceReindexingSvcImpl;
|
||||||
import ca.uhn.fhir.jpa.subscription.dbmatcher.CompositeInMemoryDaoSubscriptionMatcher;
|
import ca.uhn.fhir.jpa.subscription.dbmatcher.CompositeInMemoryDaoSubscriptionMatcher;
|
||||||
|
@ -143,6 +145,11 @@ public abstract class BaseConfig implements SchedulingConfigurer {
|
||||||
return new BinaryStorageInterceptor();
|
return new BinaryStorageInterceptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public ISearchResultCacheSvc searchResultCacheSvc() {
|
||||||
|
return new DatabaseSearchResultCacheSvcImpl();
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public TaskScheduler taskScheduler() {
|
public TaskScheduler taskScheduler() {
|
||||||
ConcurrentTaskScheduler retVal = new ConcurrentTaskScheduler();
|
ConcurrentTaskScheduler retVal = new ConcurrentTaskScheduler();
|
||||||
|
|
|
@ -18,6 +18,7 @@ import ca.uhn.fhir.jpa.model.search.SearchStatusEnum;
|
||||||
import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage;
|
import ca.uhn.fhir.jpa.model.search.StorageProcessingMessage;
|
||||||
import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc;
|
import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc;
|
||||||
import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider;
|
import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider;
|
||||||
|
import ca.uhn.fhir.jpa.search.cache.ISearchResultCacheSvc;
|
||||||
import ca.uhn.fhir.jpa.searchparam.ResourceMetaParams;
|
import ca.uhn.fhir.jpa.searchparam.ResourceMetaParams;
|
||||||
import ca.uhn.fhir.jpa.searchparam.extractor.LogicalReferenceHelper;
|
import ca.uhn.fhir.jpa.searchparam.extractor.LogicalReferenceHelper;
|
||||||
import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams;
|
import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams;
|
||||||
|
@ -152,7 +153,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao,
|
||||||
@Autowired
|
@Autowired
|
||||||
private PlatformTransactionManager myPlatformTransactionManager;
|
private PlatformTransactionManager myPlatformTransactionManager;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISearchDao mySearchDao;
|
private ISearchResultCacheSvc mySearchResultCacheSvc;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISearchParamPresenceSvc mySearchParamPresenceSvc;
|
private ISearchParamPresenceSvc mySearchParamPresenceSvc;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -466,7 +467,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
search = mySearchDao.save(search);
|
search = mySearchResultCacheSvc.saveNew(search);
|
||||||
|
|
||||||
return new PersistedJpaBundleProvider(theRequest, search.getUuid(), this);
|
return new PersistedJpaBundleProvider(theRequest, search.getUuid(), this);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Date;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface ISearchDao extends JpaRepository<Search, Long> {
|
public interface IAAAAAAAAASearchDao extends JpaRepository<Search, Long> {
|
||||||
|
|
||||||
@Query("SELECT s FROM Search s WHERE s.myUuid = :uuid")
|
@Query("SELECT s FROM Search s WHERE s.myUuid = :uuid")
|
||||||
Search findByUuid(@Param("uuid") String theUuid);
|
Search findByUuid(@Param("uuid") String theUuid);
|
|
@ -27,7 +27,7 @@ import org.springframework.data.repository.query.Param;
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.entity.SearchInclude;
|
import ca.uhn.fhir.jpa.entity.SearchInclude;
|
||||||
|
|
||||||
public interface ISearchIncludeDao extends JpaRepository<SearchInclude, Long> {
|
public interface IAAAAAAAAASearchIncludeDao extends JpaRepository<SearchInclude, Long> {
|
||||||
|
|
||||||
@Modifying
|
@Modifying
|
||||||
@Query(value="DELETE FROM SearchInclude r WHERE r.mySearchPid = :search")
|
@Query(value="DELETE FROM SearchInclude r WHERE r.mySearchPid = :search")
|
|
@ -34,7 +34,7 @@ import java.util.Set;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface ISearchResultDao extends JpaRepository<SearchResult, Long> {
|
public interface IAAAAAAAASearchResultDao extends JpaRepository<SearchResult, Long> {
|
||||||
|
|
||||||
@Query(value="SELECT r.myResourcePid FROM SearchResult r WHERE r.mySearch = :search ORDER BY r.myOrder ASC")
|
@Query(value="SELECT r.myResourcePid FROM SearchResult r WHERE r.mySearch = :search ORDER BY r.myOrder ASC")
|
||||||
Page<Long> findWithSearchUuid(@Param("search") Search theSearch, Pageable thePage);
|
Page<Long> findWithSearchUuid(@Param("search") Search theSearch, Pageable thePage);
|
|
@ -31,6 +31,7 @@ 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.entity.BaseHasResource;
|
import ca.uhn.fhir.jpa.model.entity.BaseHasResource;
|
||||||
import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable;
|
import ca.uhn.fhir.jpa.model.entity.ResourceHistoryTable;
|
||||||
|
import ca.uhn.fhir.jpa.search.cache.ISearchResultCacheSvc;
|
||||||
import ca.uhn.fhir.jpa.util.JpaInterceptorBroadcaster;
|
import ca.uhn.fhir.jpa.util.JpaInterceptorBroadcaster;
|
||||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||||
import ca.uhn.fhir.rest.api.server.*;
|
import ca.uhn.fhir.rest.api.server.*;
|
||||||
|
@ -64,7 +65,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
|
||||||
private EntityManager myEntityManager;
|
private EntityManager myEntityManager;
|
||||||
private PlatformTransactionManager myPlatformTransactionManager;
|
private PlatformTransactionManager myPlatformTransactionManager;
|
||||||
private ISearchCoordinatorSvc mySearchCoordinatorSvc;
|
private ISearchCoordinatorSvc mySearchCoordinatorSvc;
|
||||||
private ISearchDao mySearchDao;
|
private ISearchResultCacheSvc mySearchResultCacheSvc;
|
||||||
private Search mySearchEntity;
|
private Search mySearchEntity;
|
||||||
private String myUuid;
|
private String myUuid;
|
||||||
private boolean myCacheHit;
|
private boolean myCacheHit;
|
||||||
|
@ -196,8 +197,12 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
|
||||||
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
||||||
txTemplate.setIsolationLevel(TransactionDefinition.ISOLATION_READ_COMMITTED);
|
txTemplate.setIsolationLevel(TransactionDefinition.ISOLATION_READ_COMMITTED);
|
||||||
return txTemplate.execute(s -> {
|
return txTemplate.execute(s -> {
|
||||||
try {
|
Optional<Search> search = mySearchResultCacheSvc.fetchByUuid(myUuid);
|
||||||
setSearchEntity(mySearchDao.findByUuid(myUuid));
|
if (!search.isPresent()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
setSearchEntity(search);
|
||||||
|
|
||||||
if (mySearchEntity == null) {
|
if (mySearchEntity == null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -209,9 +214,6 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
|
||||||
mySearchEntity.getIncludes().size();
|
mySearchEntity.getIncludes().size();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (NoResultException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
package ca.uhn.fhir.jpa.search.cache;
|
||||||
|
|
||||||
|
public abstract class BaseSearchResultCacheSvcImpl implements ISearchResultCacheSvc {
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package ca.uhn.fhir.jpa.search.cache;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.jpa.dao.data.IAAAAAAAAASearchDao;
|
||||||
|
import ca.uhn.fhir.jpa.entity.Search;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
public class DatabaseSearchResultCacheSvcImpl extends BaseSearchResultCacheSvcImpl {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IAAAAAAAAASearchDao mySearchDao;
|
||||||
|
|
||||||
|
@Transactional(Transactional.TxType.MANDATORY)
|
||||||
|
@Override
|
||||||
|
public Search saveNew(Search theSearch) {
|
||||||
|
return mySearchDao.save(theSearch);
|
||||||
|
}
|
||||||
|
}
|
14
hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/cache/ISearchResultCacheSvc.java
vendored
Normal file
14
hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/cache/ISearchResultCacheSvc.java
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
package ca.uhn.fhir.jpa.search.cache;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.jpa.entity.Search;
|
||||||
|
|
||||||
|
public interface ISearchResultCacheSvc {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Places a new search of some sort in the cache.
|
||||||
|
*
|
||||||
|
* @param theSearch The search to store
|
||||||
|
* @return Returns a copy of the search as it was saved. Callers should use the returned Search object for any further processing.
|
||||||
|
*/
|
||||||
|
Search saveNew(Search theSearch);
|
||||||
|
}
|
Loading…
Reference in New Issue