ADF – Programatically Applying and Creating View Criteria

Apply an existing View Criteria Programmatically:

public void applyViewCriteria(ViewObjectImpl vo,HashMap criterias) 
{ ViewCriteria vc = vo.getViewCriteria("ViewCriteriaName"); vo.applyViewCriteria(vc); Iterator i = criterias.keySet().iterator(); String key=""; while (i.hasNext()) { key=i.next; vo.setNamedWhereClauseParam(key, criterias.get(key)); } vo.executeQuery(); }

Create a View Criteria Programmatically:

public void createViewCriteria(ViewObjectImpl vo, HashMap criterias)
    {
        ViewCriteria vc = vo.createViewCriteria();
        ViewCriteriaRow vcRow = vc.createViewCriteriaRow();
        Iterator i = criterias.keySet().iterator();
        String key="";
        while (i.hasNext()) {
           key=i.next;
           vcRow.setAttribute(key, criterias.get(key));
           vc.addRow(vcRow);
        }
        vo.applyViewCriteria(vc);
        vo.executeQuery();
    }

Reference Source

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.