Showing posts with label search criteria. Show all posts
Showing posts with label search criteria. Show all posts

Thursday, April 14, 2016

Get Search Criteria value entered by the user (af:query search value on a page) ADF

        String searchField = null;
        RichQuery queryComp = theQueryComp; //qryId1 is the Id of af:query; (theQueryComp is binded to the bean)     QueryDescriptor queryDescriptor = queryComp.getValue();
        List criterionList = queryDescriptor.getConjunctionCriterion().getCriterionList();
        for (Criterion criterion : criterionList) {
            AttributeDescriptor attrDescriptor = ((AttributeCriterion) criterion).getAttribute();

            if (attrDescriptor.getName().equalsIgnoreCase("SearchFieldAttribute_from_VO ")) { // EmployeeId is one of the query items in the search pane
                searchField = (String) ((AttributeCriterion) criterion).getValues().get(0);

                //This is how we will access the query field
                System.out.println("searchField :" + searchField );//output should be 5000 with repect to the image shown below

            }
        }