Thursday, December 30, 2010

Hiding a view criteria Item from af:query

Define a Binding for the af:query and in its setter method write this code

Where TopicVO1Iterator is the ViewObject,findByTitleCriteria is the VC and ABSTRACT_SUMMARY is the ColumnName attr for the VC.

    public void setRichQuery(RichQuery richQuery) {
this.richQuery = richQuery;
DCIteratorBinding iter = ADFUtil.getDCIteratorBinding("TopicVO1Iterator");
ViewObjectImpl voimpl = (ViewObjectImpl)iter.getViewObject();
ViewCriteria vc = voimpl.getViewCriteriaManager().getViewCriteria("findByTitleCriteria");
while(vc.hasNext()){
ViewCriteriaRow vcr = (ViewCriteriaRow)vc.next();
if (vcr != null) {
ViewCriteriaItem[] vcis = vcr.getCriteriaItemArray();
for (ViewCriteriaItem vci : vcis) {
if(vci != null && "ABSTRACT_SUMMARY".equals(vci.getColumnName()))
vci.setProperty(ViewCriteriaItemHints.CRITERIA_RENDERED_MODE,
ViewCriteriaItemHints.CRITERIA_RENDERED_MODE_NEVER);
}
}
}
}