Updated based on the review comments
This commit is contained in:
parent
0411967e26
commit
de845300c2
|
@ -530,17 +530,17 @@ public class SearchBuilder implements ISearchBuilder {
|
||||||
theQueryStack.addSortOnQuantity(myResourceName, theSort.getParamName(), ascending);
|
theQueryStack.addSortOnQuantity(myResourceName, theSort.getParamName(), ascending);
|
||||||
break;
|
break;
|
||||||
case COMPOSITE:
|
case COMPOSITE:
|
||||||
List<RuntimeSearchParam> theCompositList = param.getCompositeOf();
|
List<RuntimeSearchParam> compositList = param.getCompositeOf();
|
||||||
if (theCompositList == null) {
|
if (compositList == null) {
|
||||||
throw new InvalidRequestException("The composite _sort parameter " + theSort.getParamName() + " is not defined by the resource " + myResourceName);
|
throw new InvalidRequestException("The composite _sort parameter " + theSort.getParamName() + " is not defined by the resource " + myResourceName);
|
||||||
}
|
}
|
||||||
if (theCompositList.size() != 2) {
|
if (compositList.size() != 2) {
|
||||||
throw new InvalidRequestException("The composite _sort parameter " + theSort.getParamName()
|
throw new InvalidRequestException("The composite _sort parameter " + theSort.getParamName()
|
||||||
+ " must have 2 composite types declared in parameter annotation, found "
|
+ " must have 2 composite types declared in parameter annotation, found "
|
||||||
+ theCompositList.size());
|
+ compositList.size());
|
||||||
}
|
}
|
||||||
RuntimeSearchParam left = theCompositList.get(0);
|
RuntimeSearchParam left = compositList.get(0);
|
||||||
RuntimeSearchParam right = theCompositList.get(1);
|
RuntimeSearchParam right = compositList.get(1);
|
||||||
|
|
||||||
createCompositeSort(theQueryStack, myResourceName, left.getParamType(), left.getName(), ascending);
|
createCompositeSort(theQueryStack, myResourceName, left.getParamType(), left.getName(), ascending);
|
||||||
createCompositeSort(theQueryStack, myResourceName, right.getParamType(), right.getName(), ascending);
|
createCompositeSort(theQueryStack, myResourceName, right.getParamType(), right.getName(), ascending);
|
||||||
|
@ -568,24 +568,14 @@ public class SearchBuilder implements ISearchBuilder {
|
||||||
case DATE:
|
case DATE:
|
||||||
theQueryStack.addSortOnDate(myResourceName, theParamName, theAscending);
|
theQueryStack.addSortOnDate(myResourceName, theParamName, theAscending);
|
||||||
break;
|
break;
|
||||||
case REFERENCE:
|
|
||||||
theQueryStack.addSortOnResourceLink(myResourceName, theParamName, theAscending);
|
|
||||||
break;
|
|
||||||
case TOKEN:
|
case TOKEN:
|
||||||
theQueryStack.addSortOnToken(myResourceName, theParamName, theAscending);
|
theQueryStack.addSortOnToken(myResourceName, theParamName, theAscending);
|
||||||
break;
|
break;
|
||||||
case NUMBER:
|
|
||||||
theQueryStack.addSortOnNumber(myResourceName, theParamName, theAscending);
|
|
||||||
break;
|
|
||||||
case URI:
|
|
||||||
theQueryStack.addSortOnUri(myResourceName, theParamName, theAscending);
|
|
||||||
break;
|
|
||||||
case QUANTITY:
|
case QUANTITY:
|
||||||
theQueryStack.addSortOnQuantity(myResourceName, theParamName, theAscending);
|
theQueryStack.addSortOnQuantity(myResourceName, theParamName, theAscending);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new InvalidRequestException("This server does not support _sort specifications of type "
|
throw new InvalidRequestException("Don't know how to handle composite parameter with type of " + theParamType + " on _sort="+ theParamName);
|
||||||
+ theParamType + " - Can't serve _sort=" + theParamName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue