Daily Archives: March 25, 2010

How to hide the viewcriteria from the af:query panel

If you want to hide the view criteria, then here is the easy way
The code is written in the setter of the af:query binding

public void setQuery_binding(RichQuery query_binding) {

 this.query_binding = query_binding;

 DCBindingContainer bindings = (DCBindingContainer)this.getBindings();
 DCIteratorBinding iter =

 ViewObjectImpl voimpl = (ViewObjectImpl)iter.getViewObject();
 ViewCriteria vc =  voimpl.getViewCriteriaManager().getViewCriteria("");
 vc.setProperty(ViewCriteriaHints.CRITERIA_SHOW_IN_LIST, ViewCriteriaHints.CRITERIA_HINT_FALSE);

  • getting the handle to the iterator
  • getting handle to the ViewCriteriaManager, and then getting handle to the specific view criteria that we wanted to hide
  • modifying the ViewCriteriaHints.CRITERIA_SHOW_IN_LIST property to false

note: helper method – getBindings()

 private BindingContainer getBindings() {
 if (this.bindings == null) {
 FacesContext fc = FacesContext.getCurrentInstance();
 this.bindings =
 return this.bindings;

Getting the value of Saved search in programatic way

This code can be added to the setter of the component from where you want to access the saved search of the af:query panel

QueryModel qm = (QueryModel)evaluateEL("#{bindings.<searchRegionFromThePageDef>.queryModel}");
for(int indexCount=0; indexCount<qm.getUserQueries().size();indexCount++)
 QueryDescriptor qd = qm.getUserQueries().get(indexCount);
 String queryDescriptorName = qd.getName();
 m = qd.getUIHints();
 isDefault = (Boolean) m.get(QueryDescriptor.UIHINT_DEFAULT);
 isRunAutomatically = (Boolean) m.get(QueryDescriptor.UIHINT_AUTO_EXECUTE);

 if (Boolean.TRUE.equals(isDefault) && Boolean.TRUE.equals(isRunAutomatically){
 //code goes here
 //else code

quick walk through..

  • Getting the handle to QueryModel
  • Iterating through the userQueries. ie. the Saved Searches
  • Get handle to the QueryDescriptor
  • get handle to UIHints from the QueryDescriptor
  • check for QueryDescriptor.UIHINT_DEFAULT and QueryDescriptor.UIHINT_AUTO_EXECUTE and implement the logic based on the value obtained.

Explicit validation for af:input components

Here is a simple way to get around with the red box validation that used to appear on af:input Components upon some validation

<af:inputText value="#{row.bindings.<attributeValue>.inputValue}"
 id="it3" validate="#{MyBean.validate}">

and in the MyBean class we have it like

public void validate(FacesContext facesContext, UIComponent uiComponent, Object value) {
        FacesMessage message = new FacesMessage();
        message.setDetail("Some Errror message");
        message.setSummary("Value Error message");
        throw new ValidatorException(message);

what are we doing here..

  • Getting the handle to the FacesMessage by explicitly instantiating it
  • Set the Detail,Summary and Severity for the message
  • Throwing the message as a ValidatorException

ADF Library

How normal jar library is different from ADF Library?

Whenever you create a deployment profile for the model project in ADF you wil select the ADF Library type rather an ordinary library type (java jar type)

Both act as a library archive supporting jar and zip files

What is the difference then?

  • ADF library differ in a way that it behaves. It has the uniqueness of automatically pulling in the dependent jar files that is referred by any of the files and written in to the manifest files. The dependent libraries that are needed at runtime is pulled n by Jdeveloper as secondary imports.
  • The library exposes the meta data files likes task flows allowing the user to drag and drop in their files as dependent files which normal jar will not expose and support. The dropped taskflow will be added as a region in the page.