[ 
https://issues.apache.org/jira/browse/CXF-4221?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13250426#comment-13250426
 ] 

Szu-Yu Wang commented on CXF-4221:
----------------------------------

and the code to use the attached FiqlParser:
{noformat} 
        public List<Merchant> getMerchants(SearchContext searchContext) throws 
DataNotFoundException {
                try {
                        String searchExpression = 
searchContext.getSearchExpression();
                        CriteriaBuilder builder = em.getCriteriaBuilder();
                        CriteriaQuery<Merchant> cq = 
builder.createQuery(Merchant.class);
                        Root<Merchant> root = cq.from(Merchant.class);
                        Predicate pred = new FiqlParser<Merchant>(
                                        Merchant.class).parse(searchExpression, 
root, builder );
                        cq.where(pred);
                        
                        TypedQuery<Merchant> q = em.createQuery(cq);
                        List<Merchant> results = q.getResultList();

                        return results;
                } catch (FiqlParseException fpe) {
                        throw new 
DataNotFoundException(DataExceptionEnum.DATA_NOT_FOUND);
                }
        }
{noformat} 
                
> FIQL visitor to return a generic <K> instead of String
> ------------------------------------------------------
>
>                 Key: CXF-4221
>                 URL: https://issues.apache.org/jira/browse/CXF-4221
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>            Reporter: Szu-Yu Wang
>         Attachments: FiqlParser.java
>
>
> It would be great if SearchConditionVisitor<T, K> where K was the return type 
> of the getResult() call.  This way, I can CriteriaQuery<T> instead of String.
> Also, incidentally, the operation isn't "getResult", it's more like 
> "getPredicate" or "getFilter"...

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to