Showing posts with label ADF. Show all posts
Showing posts with label ADF. Show all posts

Wednesday, April 20, 2016

ADF sql wrapping and setNestedSelectForFullSql



FAQ #12 - How to disable query "wrapping" for expert mode queries in ADF 11g

http://jdeveloperfaq.blogspot.ca/2010/02/faq-12-how-to-disable-query-wrapping.html

    @Override
    protected void create() {
        super.create();
        setNestedSelectForFullSql(false);

    }

Friday, January 22, 2016

ADF : Filter View Object Rows


http://mahmoudoracle.blogspot.ca/2012/08/adf-filter-rows.html

1- Filter ViewObject

     //Get ViewObjectImpl object  
     ViewObjectImpl vo = getDeptVO();  
       
     //Filter using specific attribute value  
     Row[] filteredRows = vo.getFilteredRows("AttributeName", "AttributeValue");  
   
     //Filter using RowQualifier Class  
     //Use RowQualifier if you have more than one condition in filtering rows  
     RowQualifier rowQualifier = new RowQualifier(vo);  
     rowQualifier.setWhereClause("AttributeName=AttributeValue");  
     filteredRows = vo.getFilteredRows(rowQualifier);  

2- Filter RowSetIterator

     //Get ViewObjectImpl object  
     ViewObjectImpl vo = getAllAdvisorView();  
          
     //Get RowSetIteratorImpl object  
     RowSetIterator rsIterator=vo.createRowSetIterator(null);  
       
     //Filter using specific attribute value  
     Row[] filteredRowsRSI = rsIterator.getFilteredRows("AttributeName", "AttributeValue");  

Wednesday, January 7, 2015

RowSetIterator next never returns null, causing infinite loop

The recommended way of using "RowSetIterator" for a view object:

Always create a "Secondary Row Set Iterator" and close it when finished.
Do not use getRowSetIterator() as it impacts row currency on the front end so firstly you should use createRowSetIterator and you should call closeRowSetIterator on the iterator created through this because if you don't, framework will create new ViewRowSetIteratorImpl instances and keep on adding them.

Code example:
DCBindingContainer bc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
EmpVOImpl empVoImpl=(EmpVOImpl)bc.findIteratorBinding("EmpVO1Iterator").getViewObject();
    
RowSetIterator it = empVoImpl.createRowSetIterator(null);
while(it.hasNext()){
    EmpVORowImpl row=(EmpVORowImpl)it.next();
    if(row.getSal()!=null){
        totalAmount=row.getSal().add(totalAmount);
    }
}
it.closeRowSetIterator();
If necessary, use finally block

           try{
               while(it.hasNext()){
            EmpVORowImpl row=(EmpVORowImpl)it.next();
            if(row.getSal()!=null){ 
                  totalAmount=row.getSal().add(totalAmount);
            }
        }
} catch(Exception e) {
              //handle here
} finally {
      it.closeRowSetIterator();
}

Please refer to the links below for the issue:
https://community.oracle.com/thread/2242010
http://ramannanda.blogspot.ca/2013/04/adf-examining-memory-leaks.html
http://adfbugs.blogspot.ca/2009/07/iterating-through-view-object.html

https://community.oracle.com/message/12788828#12788828


Wednesday, July 30, 2014

ADF and Time zone


I will implement this and come back to this later.

Time zone
http://adfnbpel.wordpress.com/2013/03/20/to-set-user-timezone-for-adf-datetime-fields/

Tuesday, July 22, 2014

How to display date and time in ADF UI

In ADF, in order to display date + time in ADF UI, use <af:convertdatetime>:
<af:column filterable="true" headertext="#{bindings.View1.hints.DisplayDateTime.label}" id="c19" sortable="true" sortproperty="DisplayDateTime" width="150">
<f:facet name="filter">
<af:inputdate id="id6" value="#{vs.filterCriteria.DisplayDateTime}">
</af:inputdate></f:facet>
<af:outputtext id="ot33" value="#{row.DisplayDateTime}">
<af:convertdatetime datestyle="medium" locale="#{sessionScope.UserLocale}" pattern="#{bindings.View1.hints.DisplayDateTime.format}" timestyle="short" type="both"></af:convertdatetime></af:outputtext>
</af:column>

Tuesday, May 27, 2014

ADF SelectOneChoice Required Validation

<af:selectOneRadio value="" id="sor1" required="true" autoSubmit="true" label="text">                          <f:selectItems value=""" id="si2"/>
</af:selectOneRadio>

  • SelectOneChoice with no selection option as first item. It returns "" instead of NULL so required doesn't fire.
    • one solution is to remove the no selection option.

Monday, April 28, 2014

Apply patch 18277370 to JDeveloper 11.1.1.7.0


Why?


Oracle has fixes for ADF application running in Internet Explorer 11 (IE 11).

Without patch, ADF application can only run in compatibility mode in IE 11. You see a message box below:

How?


You need:
  • Download patch zip file from Oracle Support
  • Unzip it to a folder like C:\temp folder as example
  • Have Java JDK installed, e.g. C:\Java\jdk1.7.0_51

Apply the patch:

Open Command prompt and do it in two steps:
  • Step I
    • cd C:\temp\p18277370_111170_Generic\18277370\oui\18277370
    • set ORACLE_HOME=C:\oracle\Middleware\oracle_common
    • C:\oracle\Middleware\oracle_common\OPatch\opatch apply -jdk C:\Java\jdk1.7.0_51
  • Step II
    • cd C:\temp\p18277370_111170_Generic\18277370\sa\18277370
    • set ORACLE_HOME=C:\oracle\Middleware\jdeveloper
    • C:\oracle\Middleware\oracle_common\OPatch\opatch apply -jdk C:\Java\jdk1.7.0_51
Important: remove weblogic server cache and IE 11 cache.


After apply patch, running ADF applcation, no more ugly unsupported message box!

Friday, January 3, 2014

ADF selectBooleanCheckbox lost values

This is JDeveloper 11.1.1.6. In order to test it, I created a table in HR schema.

CREATE TABLE "DEPT_WITH_FLAG"
( "DEPTNO" NUMBER(2,0) PRIMARY KEY,
"DNAME" VARCHAR2(14),
"LOC" VARCHAR2(13),
"FLAG" CHAR(1)
) ;


Oracle ADF faces component selectBooleanCheckbox has an issue.

It can be reproduced with a very simple application created:
- create an entity object with database table
(one of the table columns has only Y/N values, which is the recommended way of boolean type column)
- create a view object based on this entity object
- create a page and drag the VO created to page as a table
- create a button binding and assoociate it to the boolean cloumn
- create a button to show / hide the table

When using selectBooleanCheckbox as column in a table, After hide -> show the table, all checked checkbox lost their value (unchecked). You can download the test source here: Checkbox.zip

Oracle forum for this issue:
https://community.oracle.com/thread/2594029