Tuesday, October 25, 2011

Reading adf-config.xml entires...

If you want to read the adf-config.xml entries from Java code, try getting ADFConfig object from ADFContext and read the map of entries by passing specific name spaces. An example is copied below-
 
 ADFContext aDFContext = ADFContext.getCurrent();  
 ADFConfig adfConfig= aDFContext.getADFConfig();  
 Map map= adfConfig.getConfigObject("http://xmlns.oracle.com/adfm/config");  
 Long rowLimit=(Long)map.get("jbo.row.limit");  

Thursday, October 13, 2011

An example for af:treeTable with af:inputComboboxListOfValues

Copying simple example for af:treeTable whose child column displays af:inputComboboxListOfValues component
 
<af:treeTable value="#{bindings.DepartmentsView2.treeModel}" var="node"  
                 selectionListener="#{bindings.DepartmentsView2.treeModel.makeCurrent}" rowSelection="single"  
                 id="tt1">  
      <f:facet name="nodeStamp">  
           <af:column id="c1">  
                <af:outputText value="#{node}" id="ot1"/>  
           </af:column>  
      </f:facet>  
      <f:facet name="pathStamp">  
           <af:outputText value="#{node}" id="ot2"/>  
      </f:facet>  
      <af:column headerText="Manager ID" id="c10">  
           <af:inputComboboxListOfValues rendered="#{not empty node.EmployeeId}" id="managerIdId"
                                               popupTitle="Search and Select #{node.bindings.ManagerId.label}"  
                                               value="#{node.bindings.ManagerId.inputValue}"  
                                               model="#{node.bindings.ManagerId.listOfValuesModel}"  
                                               partialTriggers="it9" label="LOV">  
                <f:validator binding="#{node.bindings.ManagerId.validator}"/>  
                <af:convertNumber groupingUsed="false" pattern="#{node.bindings.ManagerId.format}"/>  
           </af:inputComboboxListOfValues>  
      </af:column>  
      <af:column headerText="Dept ID" id="c11">  
           <af:inputText value="#{node.bindings.DepartmentId.inputValue}" id="it9" autoSubmit="true"  
                           label="DeptId">  
                <f:validator binding="#{node.bindings.DepartmentId.validator}"/>  
                <af:convertNumber groupingUsed="false" pattern="#{node.bindings.DepartmentId.format}"/>  
           </af:inputText>  
      </af:column>  
 </af:treeTable>  

Wednesday, October 12, 2011

Your Chance to Change the ADF Future !

An excellent initiative. Refer Grant's blog post - Your Chance to Change the ADF Future  for more details.

Sunday, October 9, 2011

Validating The Entity Collection When You Commit the Transaction

In this post I'm sharing an approach to trigger the validation once for the entire entity collection when you commit the transaction. Steps :
  • Define a method validator for the entity object. In the Add Validation Rule dialog, select the Validation Execution tab, and choose Defer the execution to Transaction Level 
  • Implement the validation method in your entity implementation class. An example is shown below:
    /**
     * Validation method for Departments.
     */
    public boolean validateDepartments(ArrayList ctxList) {

        Iterator iter = ctxList.iterator();
        while (iter.hasNext()) {
            JboValidatorContext entValContext = (JboValidatorContext)iter.next();
            DepartmentsImpl deptEO = (DepartmentsImpl)entValContext.getSource();
            if (deptEO.getDepartmentName() == null) {
                // if Dept is null, throw error- this is just an example to illustrate the usage of this method
                return false;
            }
        }

        return true;
    }
  • Ope the page which uses the above entity, keep SkipValidation="skipDataControls" in the page definition file
Download

You can download the sample workspace from here. [Runs with Oracle JDeveloper 11.1.2.1.0 (11g R2PS1) + HR Schema]

How to run this sample?

1. Run test.jsf
2. Nullify Department name field in multiple rows and click Commit. Validation gets triggered only once for the entire collection when you press commit.


Learn More ...

There are a lot more points like this. If  you are curious to learn the internals of the ADF Business Components and ADF Binding Layer,  the following book is for you - Oracle ADF Real World Developer’s Guide.
More details about this book can be found in this post- http://jobinesh.blogspot.in/2012/07/pre-order-your-copy-of-oracle-adf-real.html