Refactor search param registry
This commit is contained in:
parent
01e1566886
commit
72f682d81e
|
@ -53,6 +53,16 @@ public abstract class BaseSearchParamRegistry implements ISearchParamRegistry {
|
|||
// nothing by default
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeSearchParam getActiveSearchParam(String theResourceName, String theParamName) {
|
||||
RuntimeSearchParam retVal = null;
|
||||
Map<String, RuntimeSearchParam> params = getActiveSearchParams().get(theResourceName);
|
||||
if (params != null) {
|
||||
retVal = params.get(theParamName);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Map<String, RuntimeSearchParam>> getActiveSearchParams() {
|
||||
return myBuiltInSearchParams;
|
||||
|
|
|
@ -32,4 +32,9 @@ public interface ISearchParamRegistry {
|
|||
|
||||
Map<String,RuntimeSearchParam> getActiveSearchParams(String theResourceName);
|
||||
|
||||
/**
|
||||
* @return Returns {@literal null} if no match
|
||||
*/
|
||||
RuntimeSearchParam getActiveSearchParam(String theResourceName, String theParamName);
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.support.TransactionCallback;
|
||||
|
@ -96,7 +95,7 @@ public class SearchBuilder {
|
|||
private IFulltextSearchSvc mySearchDao;
|
||||
private Search mySearchEntity;
|
||||
private ISearchResultDao mySearchResultDao;
|
||||
private ISearchParamRegistry mySerarchParamRegistry;
|
||||
private ISearchParamRegistry mySearchParamRegistry;
|
||||
|
||||
private IHapiTerminologySvc myTerminologySvc;
|
||||
|
||||
|
@ -111,7 +110,7 @@ public class SearchBuilder {
|
|||
myResourceIndexedSearchParamUriDao = theResourceIndexedSearchParamUriDao;
|
||||
myForcedIdDao = theForcedIdDao;
|
||||
myTerminologySvc = theTerminologySvc;
|
||||
mySerarchParamRegistry = theSearchParamRegistry;
|
||||
mySearchParamRegistry = theSearchParamRegistry;
|
||||
}
|
||||
|
||||
private void addPredicateComposite(RuntimeSearchParam theParamDef, List<? extends IQueryParameterType> theNextAnd) {
|
||||
|
@ -1816,7 +1815,6 @@ public class SearchBuilder {
|
|||
doInitializeSearch();
|
||||
|
||||
// RuntimeResourceDefinition resourceDef = myContext.getResourceDefinition(myResourceType);
|
||||
Map<String, RuntimeSearchParam> searchParams = mySerarchParamRegistry.getActiveSearchParams(myResourceName);
|
||||
|
||||
for (Entry<String, List<List<? extends IQueryParameterType>>> nextParamEntry : params.entrySet()) {
|
||||
String nextParamName = nextParamEntry.getKey();
|
||||
|
@ -1871,7 +1869,7 @@ public class SearchBuilder {
|
|||
|
||||
} else {
|
||||
|
||||
RuntimeSearchParam nextParamDef = searchParams.get(nextParamName);
|
||||
RuntimeSearchParam nextParamDef = mySearchParamRegistry.getActiveSearchParam(myResourceName, nextParamName);
|
||||
if (nextParamDef != null) {
|
||||
switch (nextParamDef.getParamType()) {
|
||||
case DATE:
|
||||
|
|
|
@ -2,7 +2,6 @@ package ca.uhn.fhir.jpa.dao.dstu3;
|
|||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
@ -63,6 +62,11 @@ public class SearchParamExtractorDstu3Test {
|
|||
public Map<String, Map<String, RuntimeSearchParam>> getActiveSearchParams() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeSearchParam getActiveSearchParam(String theResourceName, String theParamName) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
};
|
||||
|
||||
SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(ourCtx, ourValidationSupport, searchParamRegistry);
|
||||
|
|
Loading…
Reference in New Issue