Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-4314

Introduce a search bean which can hold properties with different names

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4.8, 2.5.4, 2.6.1
    • JAX-RS
    • None
    • Unknown

    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:

      // 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));
      }
      

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            sergey_beryozkin Sergey Beryozkin
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: