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.IStaleSearchDeletingSvc;
|
||||
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.ResourceReindexingSvcImpl;
|
||||
import ca.uhn.fhir.jpa.subscription.dbmatcher.CompositeInMemoryDaoSubscriptionMatcher;
|
||||
|
@ -143,6 +145,11 @@ public abstract class BaseConfig implements SchedulingConfigurer {
|
|||
return new BinaryStorageInterceptor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ISearchResultCacheSvc searchResultCacheSvc() {
|
||||
return new DatabaseSearchResultCacheSvcImpl();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TaskScheduler taskScheduler() {
|
||||
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.search.ISearchCoordinatorSvc;
|
||||
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.extractor.LogicalReferenceHelper;
|
||||
import ca.uhn.fhir.jpa.searchparam.extractor.ResourceIndexedSearchParams;
|
||||
|
@ -152,7 +153,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao,
|
|||
@Autowired
|
||||
private PlatformTransactionManager myPlatformTransactionManager;
|
||||
@Autowired
|
||||
private ISearchDao mySearchDao;
|
||||
private ISearchResultCacheSvc mySearchResultCacheSvc;
|
||||
@Autowired
|
||||
private ISearchParamPresenceSvc mySearchParamPresenceSvc;
|
||||
@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);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Date;
|
|||
* #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")
|
||||
Search findByUuid(@Param("uuid") String theUuid);
|
|
@ -27,7 +27,7 @@ import org.springframework.data.repository.query.Param;
|
|||
|
||||
import ca.uhn.fhir.jpa.entity.SearchInclude;
|
||||
|
||||
public interface ISearchIncludeDao extends JpaRepository<SearchInclude, Long> {
|
||||
public interface IAAAAAAAAASearchIncludeDao extends JpaRepository<SearchInclude, Long> {
|
||||
|
||||
@Modifying
|
||||
@Query(value="DELETE FROM SearchInclude r WHERE r.mySearchPid = :search")
|
|
@ -34,7 +34,7 @@ import java.util.Set;
|
|||
* #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")
|
||||
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.model.entity.BaseHasResource;
|
||||
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.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.rest.api.server.*;
|
||||
|
@ -64,7 +65,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
|
|||
private EntityManager myEntityManager;
|
||||
private PlatformTransactionManager myPlatformTransactionManager;
|
||||
private ISearchCoordinatorSvc mySearchCoordinatorSvc;
|
||||
private ISearchDao mySearchDao;
|
||||
private ISearchResultCacheSvc mySearchResultCacheSvc;
|
||||
private Search mySearchEntity;
|
||||
private String myUuid;
|
||||
private boolean myCacheHit;
|
||||
|
@ -196,8 +197,12 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
|
|||
txTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
|
||||
txTemplate.setIsolationLevel(TransactionDefinition.ISOLATION_READ_COMMITTED);
|
||||
return txTemplate.execute(s -> {
|
||||
try {
|
||||
setSearchEntity(mySearchDao.findByUuid(myUuid));
|
||||
Optional<Search> search = mySearchResultCacheSvc.fetchByUuid(myUuid);
|
||||
if (!search.isPresent()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setSearchEntity(search);
|
||||
|
||||
if (mySearchEntity == null) {
|
||||
return false;
|
||||
|
@ -209,10 +214,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
|
|||
mySearchEntity.getIncludes().size();
|
||||
|
||||
return true;
|
||||
} catch (NoResultException e) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
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