@CoverageIgnore @Override CompositeParam<A,B> newInstance() { return new CompositeParam<A,B>(myLeftType, myRightType); }
@Search() public List<Observation> searchByComposite( @RequiredParam(name=Observation.SP_CODE_VALUE_DATE, compositeTypes= {TokenParam.class, DateParam.class}) CompositeParam<TokenParam, DateParam> theParam) { // Each of the two values in the composite param are accessible separately. // In the case of Observation's name-value-date, the left is a string and // the right is a date. TokenParam observationName = theParam.getLeftValue(); DateParam observationValue = theParam.getRightValue(); List<Observation> retVal = new ArrayList<Observation>(); // ...populate... return retVal; } //END SNIPPET: searchComposite
private void addPredicateComposite(String theResourceName, RuntimeSearchParam theParamDef, List<? extends IQueryParameterType> theNextAnd) { // TODO: fail if missing is set for a composite query IQueryParameterType or = theNextAnd.get(0); if (!(or instanceof CompositeParam<?, ?>)) { throw new InvalidRequestException("Invalid type for composite param (must be " + CompositeParam.class.getSimpleName() + ": " + or.getClass()); } CompositeParam<?, ?> cp = (CompositeParam<?, ?>) or; RuntimeSearchParam left = theParamDef.getCompositeOf().get(0); IQueryParameterType leftValue = cp.getLeftValue(); myPredicates.add(createCompositeParamPart(theResourceName, myResourceTableRoot, left, leftValue)); RuntimeSearchParam right = theParamDef.getCompositeOf().get(1); IQueryParameterType rightValue = cp.getRightValue(); myPredicates.add(createCompositeParamPart(theResourceName, myResourceTableRoot, right, rightValue)); }
qp = new CompositeParam<>(leftParam, rightParam); break; case REFERENCE:
private void addPredicateComposite(String theResourceName, RuntimeSearchParam theParamDef, List<? extends IQueryParameterType> theNextAnd) { // TODO: fail if missing is set for a composite query IQueryParameterType or = theNextAnd.get(0); if (!(or instanceof CompositeParam<?, ?>)) { throw new InvalidRequestException("Invalid type for composite param (must be " + CompositeParam.class.getSimpleName() + ": " + or.getClass()); } CompositeParam<?, ?> cp = (CompositeParam<?, ?>) or; RuntimeSearchParam left = theParamDef.getCompositeOf().get(0); IQueryParameterType leftValue = cp.getLeftValue(); myPredicates.add(createCompositeParamPart(theResourceName, myResourceTableRoot, left, leftValue)); RuntimeSearchParam right = theParamDef.getCompositeOf().get(1); IQueryParameterType rightValue = cp.getRightValue(); myPredicates.add(createCompositeParamPart(theResourceName, myResourceTableRoot, right, rightValue)); }
@CoverageIgnore @Override CompositeParam<A,B> newInstance() { return new CompositeParam<A,B>(myLeftType, myRightType); }
qp = new CompositeParam<>(leftParam, rightParam); break; case REFERENCE: