[ 
https://issues.apache.org/jira/browse/CXF-4314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sergey Beryozkin updated CXF-4314:
----------------------------------

    Description: 
At the moment, in order to capture a FIQL expression into a list of Search 
conditions, one needs to provide a bean which needs to have a matching property 
per every property name in the expression, for example, an expression such as 
"name==bar;id=234" will require a bean with properties 'name' & 'id' available. 
This is reasonable when the set of properties is limited, but is too 
restricting in cases where one needs to experiment with an open-ended set of 
properties, which would require a bean to be updated every time a new search 
property gets introduced.

Adding a simple SearchBean bean with a Map property will make it much simpler 
to convert FIQL expressions into SQL/etc expressions, as well as capture the 
FIQL expressions and analyze them without having to introduce a custom bean 
every time...

For example, this is how it would look like when printing SQL expressions:

{code:java}
// Search context represents this query: "name==foo*;(name!=*bar,level=gt=10)"
SearchCondition<SearchBean> filter = 
searchContext.getSearchCondition(SearchBean.class);
SQLPrinterVisitor<SearchBean> visitor = new 
SQLPrinterVisitor<SearchBean>("table");
filter.accept(visitor);
String sql = visitor.getResult();
assertTrue(("SELECT * FROM table WHERE (name LIKE 'foo%') AND ((name NOT LIKE 
'%bar') "
                   + "OR (level > '10'))").equals(sql)
                   || ("SELECT * FROM table WHERE (name LIKE 'foo%') AND "
                   + "((level > '10') OR (name NOT LIKE '%bar'))").equals(sql));
}
{code}


  was:
At the moment, in order to capture a FIQL expression into a list of Search 
conditions, one needs to provide a bean which needs to have a matching property 
per every property name in the expression, for example, an expression such as 
"name==bar;id=234" will require a bean with properties 'name' & 'id' available. 
This is reasonable when the set of properties is limited, but is too 
restricting in cases where one needs to experiment with an open-ended set of 
properties, which would require a bean to be updated every time a new search 
property gets introduced.

Adding a simple SearchBean bean with a Map property will make it much simpler 
to convert FIQL expressions into SQL/etc expressions, as well as capture the 
FIQL expressions and analyze them without having to introduce a custom bean 
every time...

    
> Introduce a search bean which can hold properties with different names
> ----------------------------------------------------------------------
>
>                 Key: CXF-4314
>                 URL: https://issues.apache.org/jira/browse/CXF-4314
>             Project: CXF
>          Issue Type: Improvement
>          Components: JAX-RS
>            Reporter: Sergey Beryozkin
>            Assignee: Sergey Beryozkin
>
> At the moment, in order to capture a FIQL expression into a list of Search 
> conditions, one needs to provide a bean which needs to have a matching 
> property per every property name in the expression, for example, an 
> expression such as "name==bar;id=234" will require a bean with properties 
> 'name' & 'id' available. This is reasonable when the set of properties is 
> limited, but is too restricting in cases where one needs to experiment with 
> an open-ended set of properties, which would require a bean to be updated 
> every time a new search property gets introduced.
> Adding a simple SearchBean bean with a Map property will make it much simpler 
> to convert FIQL expressions into SQL/etc expressions, as well as capture the 
> FIQL expressions and analyze them without having to introduce a custom bean 
> every time...
> For example, this is how it would look like when printing SQL expressions:
> {code:java}
> // Search context represents this query: "name==foo*;(name!=*bar,level=gt=10)"
> SearchCondition<SearchBean> filter = 
> searchContext.getSearchCondition(SearchBean.class);
> SQLPrinterVisitor<SearchBean> visitor = new 
> SQLPrinterVisitor<SearchBean>("table");
> filter.accept(visitor);
> String sql = visitor.getResult();
> assertTrue(("SELECT * FROM table WHERE (name LIKE 'foo%') AND ((name NOT LIKE 
> '%bar') "
>                    + "OR (level > '10'))").equals(sql)
>                    || ("SELECT * FROM table WHERE (name LIKE 'foo%') AND "
>                    + "((level > '10') OR (name NOT LIKE 
> '%bar'))").equals(sql));
> }
> {code}

--
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