inlined single use methods
This commit is contained in:
parent
e99402bd38
commit
c9fe68c5ab
|
@ -929,6 +929,10 @@ public class SearchBuilder implements ISearchBuilder {
|
||||||
return myCallingDao;
|
return myCallingDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PredicateBuilder getPredicateBuilder() {
|
||||||
|
return myPredicateBuilder;
|
||||||
|
}
|
||||||
|
|
||||||
public enum HandlerTypeEnum {
|
public enum HandlerTypeEnum {
|
||||||
UNIQUE_INDEX, STANDARD_QUERY
|
UNIQUE_INDEX, STANDARD_QUERY
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ public class PredicateBuilder {
|
||||||
return myPredicateBuilderReference.addPredicateReference(theResourceName, theParamName, theList, null, theRequest);
|
return myPredicateBuilderReference.addPredicateReference(theResourceName, theParamName, theList, null, theRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPredicateString(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd) {
|
void addPredicateString(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd) {
|
||||||
myPredicateBuilderString.addPredicateString(theResourceName, theParamName, theNextAnd, SearchFilterParser.CompareOperation.sw);
|
myPredicateBuilderString.addPredicateString(theResourceName, theParamName, theNextAnd, SearchFilterParser.CompareOperation.sw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -371,7 +371,7 @@ public class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
* and predicate list down and put new ones at the top of the
|
* and predicate list down and put new ones at the top of the
|
||||||
* stack and run a subquery
|
* stack and run a subquery
|
||||||
*/
|
*/
|
||||||
// FIXME KHS group these into a single class
|
|
||||||
Root<ResourceTable> stackRoot = myResourceTableRoot;
|
Root<ResourceTable> stackRoot = myResourceTableRoot;
|
||||||
ArrayList<Predicate> stackPredicates = myPredicates;
|
ArrayList<Predicate> stackPredicates = myPredicates;
|
||||||
IndexJoins stackIndexJoins = myIndexJoins;
|
IndexJoins stackIndexJoins = myIndexJoins;
|
||||||
|
@ -410,7 +410,8 @@ public class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IAnyResource.SP_RES_LANGUAGE:
|
case IAnyResource.SP_RES_LANGUAGE:
|
||||||
addPredicateLanguage(theAndOrParams);
|
addPredicateLanguage(theAndOrParams,
|
||||||
|
null);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Constants.PARAM_HAS:
|
case Constants.PARAM_HAS:
|
||||||
|
@ -420,7 +421,7 @@ public class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
case Constants.PARAM_TAG:
|
case Constants.PARAM_TAG:
|
||||||
case Constants.PARAM_PROFILE:
|
case Constants.PARAM_PROFILE:
|
||||||
case Constants.PARAM_SECURITY:
|
case Constants.PARAM_SECURITY:
|
||||||
addPredicateTag(theAndOrParams, theParamName);
|
myPredicateBuilder.addPredicateTag(theAndOrParams, theParamName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Constants.PARAM_SOURCE:
|
case Constants.PARAM_SOURCE:
|
||||||
|
@ -434,36 +435,36 @@ public class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
switch (nextParamDef.getParamType()) {
|
switch (nextParamDef.getParamType()) {
|
||||||
case DATE:
|
case DATE:
|
||||||
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
||||||
addPredicateDate(theResourceName, theParamName, nextAnd);
|
myPredicateBuilder.addPredicateDate(theResourceName, theParamName, nextAnd, null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QUANTITY:
|
case QUANTITY:
|
||||||
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
||||||
addPredicateQuantity(theResourceName, theParamName, nextAnd);
|
myPredicateBuilder.addPredicateQuantity(theResourceName, theParamName, nextAnd, null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REFERENCE:
|
case REFERENCE:
|
||||||
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
||||||
addPredicateReference(theResourceName, theParamName, nextAnd, theRequest);
|
addPredicateReference(theResourceName, theParamName, nextAnd, null, theRequest);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case STRING:
|
case STRING:
|
||||||
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
||||||
addPredicateString(theResourceName, theParamName, nextAnd);
|
myPredicateBuilder.addPredicateString(theResourceName, theParamName, nextAnd, SearchFilterParser.CompareOperation.sw);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TOKEN:
|
case TOKEN:
|
||||||
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
||||||
if ("Location.position".equals(nextParamDef.getPath())) {
|
if ("Location.position".equals(nextParamDef.getPath())) {
|
||||||
addPredicateCoords(theResourceName, theParamName, nextAnd);
|
myPredicateBuilder.addPredicateCoords(theResourceName, theParamName, nextAnd);
|
||||||
} else {
|
} else {
|
||||||
addPredicateToken(theResourceName, theParamName, nextAnd);
|
myPredicateBuilder.addPredicateToken(theResourceName, theParamName, nextAnd, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NUMBER:
|
case NUMBER:
|
||||||
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
||||||
addPredicateNumber(theResourceName, theParamName, nextAnd);
|
myPredicateBuilder.addPredicateNumber(theResourceName, theParamName, nextAnd, null);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case COMPOSITE:
|
case COMPOSITE:
|
||||||
|
@ -473,14 +474,14 @@ public class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
break;
|
break;
|
||||||
case URI:
|
case URI:
|
||||||
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
||||||
addPredicateUri(theResourceName, theParamName, nextAnd);
|
myPredicateBuilder.addPredicateUri(theResourceName, theParamName, nextAnd, SearchFilterParser.CompareOperation.eq);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HAS:
|
case HAS:
|
||||||
case SPECIAL:
|
case SPECIAL:
|
||||||
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
for (List<? extends IQueryParameterType> nextAnd : theAndOrParams) {
|
||||||
if ("Location.position".equals(nextParamDef.getPath())) {
|
if ("Location.position".equals(nextParamDef.getPath())) {
|
||||||
addPredicateCoords(theResourceName, theParamName, nextAnd);
|
myPredicateBuilder.addPredicateCoords(theResourceName, theParamName, nextAnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -603,25 +604,13 @@ public class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
else {
|
else {
|
||||||
RestSearchParameterTypeEnum typeEnum = searchParam.getParamType();
|
RestSearchParameterTypeEnum typeEnum = searchParam.getParamType();
|
||||||
if (typeEnum == RestSearchParameterTypeEnum.URI) {
|
if (typeEnum == RestSearchParameterTypeEnum.URI) {
|
||||||
return addPredicateUri(theResourceName,
|
return myPredicateBuilder.addPredicateUri(theResourceName, theFilter.getParamPath().getName(), Collections.singletonList(new UriParam(theFilter.getValue())), theFilter.getOperation());
|
||||||
theFilter.getParamPath().getName(),
|
|
||||||
Collections.singletonList(new UriParam(theFilter.getValue())),
|
|
||||||
theFilter.getOperation());
|
|
||||||
} else if (typeEnum == RestSearchParameterTypeEnum.STRING) {
|
} else if (typeEnum == RestSearchParameterTypeEnum.STRING) {
|
||||||
return addPredicateString(theResourceName,
|
return myPredicateBuilder.addPredicateString(theResourceName, theFilter.getParamPath().getName(), Collections.singletonList(new StringParam(theFilter.getValue())), theFilter.getOperation());
|
||||||
theFilter.getParamPath().getName(),
|
|
||||||
Collections.singletonList(new StringParam(theFilter.getValue())),
|
|
||||||
theFilter.getOperation());
|
|
||||||
} else if (typeEnum == RestSearchParameterTypeEnum.DATE) {
|
} else if (typeEnum == RestSearchParameterTypeEnum.DATE) {
|
||||||
return addPredicateDate(theResourceName,
|
return myPredicateBuilder.addPredicateDate(theResourceName, theFilter.getParamPath().getName(), Collections.singletonList(new DateParam(theFilter.getValue())), theFilter.getOperation());
|
||||||
theFilter.getParamPath().getName(),
|
|
||||||
Collections.singletonList(new DateParam(theFilter.getValue())),
|
|
||||||
theFilter.getOperation());
|
|
||||||
} else if (typeEnum == RestSearchParameterTypeEnum.NUMBER) {
|
} else if (typeEnum == RestSearchParameterTypeEnum.NUMBER) {
|
||||||
return addPredicateNumber(theResourceName,
|
return myPredicateBuilder.addPredicateNumber(theResourceName, theFilter.getParamPath().getName(), Collections.singletonList(new NumberParam(theFilter.getValue())), theFilter.getOperation());
|
||||||
theFilter.getParamPath().getName(),
|
|
||||||
Collections.singletonList(new NumberParam(theFilter.getValue())),
|
|
||||||
theFilter.getOperation());
|
|
||||||
} else if (typeEnum == RestSearchParameterTypeEnum.REFERENCE) {
|
} else if (typeEnum == RestSearchParameterTypeEnum.REFERENCE) {
|
||||||
String paramName = theFilter.getParamPath().getName();
|
String paramName = theFilter.getParamPath().getName();
|
||||||
SearchFilterParser.CompareOperation operation = theFilter.getOperation();
|
SearchFilterParser.CompareOperation operation = theFilter.getOperation();
|
||||||
|
@ -631,10 +620,7 @@ public class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
ReferenceParam referenceParam = new ReferenceParam(resourceType, chain, value);
|
ReferenceParam referenceParam = new ReferenceParam(resourceType, chain, value);
|
||||||
return addPredicateReference(theResourceName, paramName, Collections.singletonList(referenceParam), operation, theRequest);
|
return addPredicateReference(theResourceName, paramName, Collections.singletonList(referenceParam), operation, theRequest);
|
||||||
} else if (typeEnum == RestSearchParameterTypeEnum.QUANTITY) {
|
} else if (typeEnum == RestSearchParameterTypeEnum.QUANTITY) {
|
||||||
return addPredicateQuantity(theResourceName,
|
return myPredicateBuilder.addPredicateQuantity(theResourceName, theFilter.getParamPath().getName(), Collections.singletonList(new QuantityParam(theFilter.getValue())), theFilter.getOperation());
|
||||||
theFilter.getParamPath().getName(),
|
|
||||||
Collections.singletonList(new QuantityParam(theFilter.getValue())),
|
|
||||||
theFilter.getOperation());
|
|
||||||
} else if (typeEnum == RestSearchParameterTypeEnum.COMPOSITE) {
|
} else if (typeEnum == RestSearchParameterTypeEnum.COMPOSITE) {
|
||||||
throw new InvalidRequestException("Composite search parameters not currently supported with _filter clauses");
|
throw new InvalidRequestException("Composite search parameters not currently supported with _filter clauses");
|
||||||
} else if (typeEnum == RestSearchParameterTypeEnum.TOKEN) {
|
} else if (typeEnum == RestSearchParameterTypeEnum.TOKEN) {
|
||||||
|
@ -643,10 +629,7 @@ public class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
theFilter.getValue());
|
theFilter.getValue());
|
||||||
return addPredicateToken(theResourceName,
|
return myPredicateBuilder.addPredicateToken(theResourceName, theFilter.getParamPath().getName(), Collections.singletonList(param), theFilter.getOperation());
|
||||||
theFilter.getParamPath().getName(),
|
|
||||||
Collections.singletonList(param),
|
|
||||||
theFilter.getOperation());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -698,72 +681,6 @@ public class PredicateBuilderReference extends BasePredicateBuilder {
|
||||||
return qp;
|
return qp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addPredicateCoords(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd) {
|
|
||||||
// FIXME KHS consolidate these predicate builders (e.g. all these mathods should have the same name)
|
|
||||||
myPredicateBuilder.addPredicateCoords(theResourceName, theParamName, theNextAnd);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPredicateDate(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd) {
|
|
||||||
myPredicateBuilder.addPredicateDate(theResourceName, theParamName, theNextAnd, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Predicate addPredicateDate(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd, SearchFilterParser.CompareOperation theOperation) {
|
|
||||||
return myPredicateBuilder.addPredicateDate(theResourceName, theParamName, theNextAnd, theOperation);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPredicateNumber(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd) {
|
|
||||||
myPredicateBuilder.addPredicateNumber(theResourceName, theParamName, theNextAnd, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Predicate addPredicateNumber(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd, SearchFilterParser.CompareOperation theOperation) {
|
|
||||||
return myPredicateBuilder.addPredicateNumber(theResourceName, theParamName, theNextAnd, theOperation);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPredicateQuantity(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd) {
|
|
||||||
myPredicateBuilder.addPredicateQuantity(theResourceName, theParamName, theNextAnd, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Predicate addPredicateQuantity(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd, SearchFilterParser.CompareOperation theOperation) {
|
|
||||||
return myPredicateBuilder.addPredicateQuantity(theResourceName, theParamName, theNextAnd, theOperation);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Predicate addPredicateReference(String theResourceName, String theParamName, List<? extends IQueryParameterType> theList, RequestDetails theRequest) {
|
|
||||||
return addPredicateReference(theResourceName, theParamName, theList, null, theRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPredicateString(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd) {
|
|
||||||
myPredicateBuilder.addPredicateString(theResourceName, theParamName, theNextAnd, SearchFilterParser.CompareOperation.sw);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Predicate addPredicateString(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd, SearchFilterParser.CompareOperation theOperation) {
|
|
||||||
return myPredicateBuilder.addPredicateString(theResourceName, theParamName, theNextAnd, theOperation);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPredicateTag(List<List<IQueryParameterType>> theAndOrParams, String theParamName) {
|
|
||||||
myPredicateBuilder.addPredicateTag(theAndOrParams, theParamName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPredicateToken(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd) {
|
|
||||||
myPredicateBuilder.addPredicateToken(theResourceName, theParamName, theNextAnd, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Predicate addPredicateToken(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd, SearchFilterParser.CompareOperation theOperation) {
|
|
||||||
return myPredicateBuilder.addPredicateToken(theResourceName, theParamName, theNextAnd, theOperation);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addPredicateUri(String theResourceName, String theParamName, List<? extends IQueryParameterType> theNextAnd) {
|
|
||||||
myPredicateBuilder.addPredicateUri(theResourceName, theParamName, theNextAnd, SearchFilterParser.CompareOperation.eq);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Predicate addPredicateUri(String theResourceName, String theName, List<? extends IQueryParameterType> theSingletonList, SearchFilterParser.CompareOperation theOperation) {
|
|
||||||
return myPredicateBuilder.addPredicateUri(theResourceName, theName, theSingletonList, theOperation);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Predicate addPredicateLanguage(List<List<IQueryParameterType>> theList) {
|
|
||||||
return addPredicateLanguage(theList,
|
|
||||||
null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Predicate addPredicateLanguage(List<List<IQueryParameterType>> theList,
|
private Predicate addPredicateLanguage(List<List<IQueryParameterType>> theList,
|
||||||
SearchFilterParser.CompareOperation operation) {
|
SearchFilterParser.CompareOperation operation) {
|
||||||
for (List<? extends IQueryParameterType> nextList : theList) {
|
for (List<? extends IQueryParameterType> nextList : theList) {
|
||||||
|
|
|
@ -32,11 +32,11 @@ public class PredicateBuilderToken extends BasePredicateBuilder {
|
||||||
private ITermReadSvc myTerminologySvc;
|
private ITermReadSvc myTerminologySvc;
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISearchParamRegistry mySearchParamRegistry;
|
private ISearchParamRegistry mySearchParamRegistry;
|
||||||
private final PredicateBuilderString myPredicateBuilderString;
|
private final PredicateBuilder myPredicateBuilder;
|
||||||
|
|
||||||
PredicateBuilderToken(SearchBuilder theSearchBuilder) {
|
PredicateBuilderToken(SearchBuilder theSearchBuilder) {
|
||||||
super(theSearchBuilder);
|
super(theSearchBuilder);
|
||||||
myPredicateBuilderString = theSearchBuilder.getPredicateBuilderString();
|
myPredicateBuilder = theSearchBuilder.getPredicateBuilder();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Predicate addPredicateToken(String theResourceName,
|
public Predicate addPredicateToken(String theResourceName,
|
||||||
|
@ -57,7 +57,7 @@ public class PredicateBuilderToken extends BasePredicateBuilder {
|
||||||
if (nextOr instanceof TokenParam) {
|
if (nextOr instanceof TokenParam) {
|
||||||
TokenParam id = (TokenParam) nextOr;
|
TokenParam id = (TokenParam) nextOr;
|
||||||
if (id.isText()) {
|
if (id.isText()) {
|
||||||
myPredicateBuilderString.addPredicateString(theResourceName, theParamName, theList);
|
myPredicateBuilder.addPredicateString(theResourceName, theParamName, theList);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue