Sunday, September 7, 2014

ADF Exception Handling

Custom Exception Handlers can be used to suppress or alter exception reporting.


1. Model Layer

Extending  DCErrorHandlerImpl.
http://docs.oracle.com/cd/B31017_01/web.1013/b25947/web_val008.htm

1.Create class by extending DCErrorHandlerImpl.
2.Update DataBindings.cpx
<Application xmlns="http://xmlns.oracle.com/adfm/application" version="11.1.2.60.17" id="DataBindings"
             SeparateXMLFiles="false" Package="view" ClientType="Generic"
             ErrorHandlerClass="view.exception.MyCustDcExceptionHandler">
3. Handle,Extend or Skip Exceptions by overriding method
    public void reportException(DCBindingContainer dCBindingContainer,
                                Exception exception)

Got error
oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.InstantiationException, msg=view.exception.MyCustDcExceptionHandler

    public MyCustDcExceptionHandler(boolean b) {
        super(b);
    }
Change To
    public MyCustDcExceptionHandler() {
        super(true);
    }



References
http://adfwithejb.blogspot.com/2012/05/exception-handling-in-adf-part-1.html
http://deepak-adf.blogspot.com/2014/01/adf-exception-handling-taskflow.html

2.Task Flow Exception Handler


References
http://fortunefusionminds.blogspot.com/2013/08/how-to-handles-exceptions-in-adf.html
http://andrejusb.blogspot.com/2010/05/handling-exceptions-in-oracle-ui-shell.html
http://biemond.blogspot.com/2008/10/reusable-adf-task-flow-exception.html
http://multikoop.blogspot.com/2014/02/adf-handling-exceptions-from_14.html


Handling Exception at adfc-config
http://multikoop.blogspot.com/2014/02/adf-handling-exceptions-from_14.html

  public void handleExceptionShowMessageInPopupDialog() {

    ControllerContext cc = ControllerContext.getInstance();

    Exception ex = cc.getCurrentViewPort().getExceptionData();
    String message = ex.getMessage();


    FacesContext fc = FacesContext.getCurrentInstance();
    FacesMessage facesMessage =
      new FacesMessage(FacesMessage.SEVERITY_ERROR, "UTF: " + message, null);
    fc.addMessage(null, facesMessage);

    cc.getCurrentRootViewPort().clearException();
    fc.renderResponse();

  }

3.Controller Exception Handler

1)Create a Java class that extends ExceptionHandler
2)Create folder .adf\META-INF\services and add file with the name oracle.adf.view.rich.context.ExceptionHandler. Save with no extension.
Under .adf\META-INF\services File Type should be EXCEPTIONHANDLER File.
3)In the file, add the absolute name of your custom exception handler class (package name and class name without the “.class” extension)
eg.
com.exchandl.view.ArCustomExceptionHandler



References
https://blogs.oracle.com/jdevotnharvest/entry/extending_the_adf_controller_exception_handler
http://www.yenlo.nl/nl/adf-11g-handling-the-adfc-12000-controllerexception-with-custom-exception-handling/
http://ramannanda.blogspot.com/2013/04/adf-exception-handling-scenario.html





Trace
http://marxsoftware.blogspot.com/2008/09/surprisingly-simple-stacktraceelement.html
http://marxsoftware.blogspot.com/2010/10/reading-java-stack-traces-few-tips.html
public static String accessExceptionStackTraceViaPrintWriter(final Throwable throwable)
   {
      final Writer writer = new StringWriter();
      final PrintWriter printWriter = new PrintWriter(writer);
      throwable.printStackTrace(printWriter);
      return writer.toString();
   }

Tuesday, April 9, 2013

ADF set Focus on Table Component


 Write Below piece of code in Action / ActionListener        


 //t1 -- Your Table Id
 //it1-- Your text component inside table
 .........       
 FacesContext ctx = FacesContext.getCurrentInstance();
        String tableId = t1.getClientId(FacesContext.getCurrentInstance());
       
       
        String inputId = "";
        RowKeySet rks = t1.getSelectedRowKeys();
        if(rks != null && rks.size() > 0) {
            Object rowKey = rks.iterator().next();
            String rowId = t1.getClientRowKeyManager().getClientRowKey(FacesContext.getCurrentInstance(), t1, rowKey);
           
            inputId = tableId + ":" + rowId + ":" + "it1";
       
        }
       
        //compose JavaScript to be executed on the client
        StringBuilder script = new StringBuilder();
        //use client id to ensure component is found if located in
        //naming container 
        script.append("var textInput = ");
        script.append("AdfPage.PAGE.findComponentByAbsoluteId");
        script.append ("('"+inputId+"');");
       
        script.append("if(textInput != null){");
        script.append("textInput.focus();");
        script.append("}");
        //invoke JavaScript
        writeJavaScriptToClient(script.toString());
 .........

      public static void writeJavaScriptToClient(String script) {
        FacesContext fctx = FacesContext.getCurrentInstance();
        ExtendedRenderKitService erks = null;
        erks = Service.getRenderKitService(
                     fctx, ExtendedRenderKitService.class);
        erks.addScript(fctx, script);
      }


Detail Explanation can be found at
http://www.bartkummel.net/2009/11/oracle-adf-set-focus-to-input-field-in-data-table/

References
https://blogs.oracle.com/jdevotnharvest/entry/how_to_programmatically_set_focus

https://blogs.oracle.com/shay/entry/controlling_tab_order_in_an_ad

http://technology.amis.nl/2008/01/04/adf-11g-rich-faces-focus-on-field-after-button-press-or-ppr-including-javascript-in-ppr-response-and-clientlisteners-client-side-programming-in-adf-faces-rich-client-components-part-2/

Sunday, December 9, 2012

ADF Upload Blob File in Table Column


Create Table with Blob Column

create table xx_attachment(fileId Number, file_name VARCHAR2(255),
                                          file_content_type varchar2(100),file_data blob,
                                         CONSTRAINT xx_attach_pk PRIMARY KEY (fileId));



Create EO,VO add it to AM.

Create below variable and accessor inside Managed Bean or Backing Bean.

import org.apache.myfaces.trinidad.model.UploadedFile;
...
    private UploadedFile _file;   
   
    public UploadedFile getFile() {
        return _file;
    }

    public void setFile(UploadedFile file) {
        _file = file;
    }



On JSF Page(jspx/jsf) or Page Fragment(jsff)
1)From DataControl unde XxAttachmentVO1 --> Operations --> Drag CreateInsert method and drop as ADF Button.   (When you click this Button it creates Blank row).

2)From Common Components drag inputFile(af:inputFile) component and drop on page.
Make sure  you put value as  #{<yourMangedBean>.file}

<af:inputFile label="Upload File" id="if1"
                                  value="#{<yourMangedBean>.file}"/>
3)From Common Components drag Button and drop after inputFile component.
Write below code on Button action Listner.

<af:commandButton text="Upload" id="cb11"
                                      action="#{<yourManagedBean.uploadAttach}"/>

4)Add Commit action method in Bindings.

5)For Page Form make sure usesUpload property is True.
<af:form id="f1" usesUpload="true">


import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.event.PopupFetchEvent;

import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;

import oracle.jbo.Row;
import oracle.jbo.domain.BlobDomain;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.SQLException;
import javax.faces.event.ActionEvent;
...
    public String uploadAttach() {
        // Add event code here...
        //BindingContainer bindings = (BindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
    
        UploadedFile myfile = (UploadedFile)this.getFile();
       
        BindingContext bindingctx = BindingContext.getCurrent();
        BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
        DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
        DCIteratorBinding iter = bindingsImpl.findIteratorBinding("XxAttachmentVO1Iterator");
       
        Row row = iter.getCurrentRow();
        // Upload File into Blob Column
        row.setAttribute("FileData", createBlobDomain(myfile));
       
        // File Name
        String fileName = (String)myfile.getFilename();
        row.setAttribute("FileName", fileName);
       
        // File Content/MIME Type
        String fileContentType = (String)myfile.getContentType();
        row.setAttribute("FileContentType", fileContentType);
      
        //Commit Transaction
        OperationBinding method = bindings.getOperationBinding("Commit"); 
        method.execute();
       
        return null;
    }

    private BlobDomain createBlobDomain(UploadedFile file) {
        InputStream in = null;
        BlobDomain blobDomain = null;
        OutputStream out = null;

        try {
            in = file.getInputStream();

            blobDomain = new BlobDomain();
            out = blobDomain.getBinaryOutputStream();
            byte[] buffer = new byte[8192];
            int bytesRead = 0;

            while ((bytesRead = in.read(buffer, 0, 8192)) != -1) {
                out.write(buffer, 0, bytesRead);
            }

            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.fillInStackTrace();
        }

        return blobDomain;
    }






To download file.
http://hasamali.blogspot.com/2011/09/download-file-in-oracle-adf-gui.html



ADF Multi Select Options (af:selectMany)

ADF Code Corner
https://blogs.oracle.com/jdevotnharvest/entry/how_to_access_selected_rows


http://myadfnotebook.blogspot.com/2010/09/getting-string-value-or-item-code-of.html




Create Master Detail Table
create table xx_users(user_id NUMBER,user_name VARCHAR2(100),
                                  CONSTRAINT xx_users_pk PRIMARY KEY (user_Id));
create table  xx_roles(role_id NUMBER,role_name VARCHAR2(100),
                                   CONSTRAINT xx_roles_pk PRIMARY KEY (role_Id));
Create EO,VO for above 2 tables.



create table xx_user_roles(user_role_id NUMBER,user_id NUMBER,role_name VARCHAR2(100),
                    CONSTRAINT xx_user_roles_pk PRIMARY KEY (user_role_Id),
                    CONSTRAINT xx_user_roles_fk1
                      FOREIGN KEY (user_id)
                      REFERENCES xx_users(user_id));
Create ReadOnly VO based on Above table.

Add All VO instances into AppModule.

From DataControl Add CreateInsert Operation for XxUsersVo1 as Button on Page.
From DataControl XxUsersVo1 as ADF Form.

From Data Control add XxRolesLOVVO1 as ADF Select Many Choice
as
              <af:selectManyChoice value="#{bindings.XxRolesLOVVO1.inputValue}"
                                   label="#{bindings.XxRolesLOVVO1.label}"
                                   id="smc1">
                <f:selectItems value="#{bindings.XxRolesLOVVO1.items}"
                               id="si1"/>
              </af:selectManyChoice>



On Button Pressed

    public void addRoles() {
        BindingContext bctx = BindingContext.getCurrent();
        BindingContainer bindings = bctx.getCurrentBindingsEntry();
        JUCtrlListBinding allRolesList =
                 (JUCtrlListBinding) bindings.get("XxRolesLOVVO1");
          Object[] selVals = allRolesList.getSelectedValues();
          for (int i = 0; i < selVals.length; i++) {
            //Integer val = (Integer)selVals[i];
            String val = (String)selVals[i];
              System.out.println("Int Val "+val);

             // Insert into Table after getting selected Rows or your Code
              OperationBinding crRoleMethod = bindings.getOperationBinding("CreateInsertRoles"); 
              crRoleMethod.execute();
             
              DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
              DCIteratorBinding iter = bindingsImpl.findIteratorBinding("XxUserRolesVO2Iterator");

              Row row = iter.getCurrentRow();
              // Insert Role Name
              row.setAttribute("RoleName",val );
        
            //...
          }
    }


Use if you want to pull records based on Indices

    public void addRolesUsingIndices() {
        BindingContext bctx = BindingContext.getCurrent();
        BindingContainer bindings = bctx.getCurrentBindingsEntry();
        JUCtrlListBinding allRolesList =
                 (JUCtrlListBinding) bindings.get("XxRolesLOVVO1");
           int[] selVals = allRolesList.getSelectedIndices();
      
          for (int indx : selVals ) {
                  Row rw = allRolesList.getRowAtRangeIndex(indx);
                  Number id  = (Number)rw.getAttribute("RoleId");
                  String val = (String)rw.getAttribute("RoleName");
             
               // Insert into Table after getting selected Rows  or your Code
               OperationBinding crRoleMethod = bindings.getOperationBinding("CreateInsertRoles"); 
              crRoleMethod.execute();
             
              DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
              DCIteratorBinding iter = bindingsImpl.findIteratorBinding("XxUserRolesVO2Iterator");
   
              Row row = iter.getCurrentRow();
              // Insert Role Name
              row.setAttribute("RoleName",id+" "+val );
        
            //...
          }
    }






If the Choice List is Static eg.
            <af:selectManyCheckbox label="Roles" id="smc1"
                                   binding="#{backingBeanScope.Backing_xxUserCreation.smc1}"
                                   value="#{backingBeanScope.Backing_xxUserCreation.listValue}"
                                   autoSubmit="true">
              <af:selectItem label="Accountant" value="ACCOUNTANT" id="si3"
                             binding="#{backingBeanScope.Backing_xxUserCreation.si3}"/>
              <af:selectItem label="Sales Manager" value="SALES_MANAGER"
                             id="si1"
                             binding="#{backingBeanScope.Backing_xxUserCreation.si1}"/>
              <af:selectItem label="Finance Manager" value="FINANCE_MANAGER"
                             id="si2"
                             binding="#{backingBeanScope.Backing_xxUserCreation.si2}"/>
              <af:selectItem label="Buyer" value="BUYER" id="si4"
                             binding="#{backingBeanScope.Backing_xxUserCreation.si4}"/>
            </af:selectManyCheckbox>



Add below method call on Button Pressed

addRoles(listValue);


Add below code in Managed Bean or Backing Bean


    private Object[] listValue;
   
    public void setListValue(Object[] listvalue){
        this.listValue = listvalue;
    }
   
    public Object[] getListValue(){
        return listValue;
    }
   
    public String getListString(){
        return createString(listValue);
    }
   
    public String createString(Object[] arr){
        if(arr != null){
            String values = "[";
            for(int i=0;i<arr.length;i++) {
                values = values + arr[i];
                if (i <arr.length - 1)
                values = values + ",";
                }
        values = values + "]";
        return values;
       }
        return null;
     }


    public void addRoles(Object[] arr){
       
         BindingContext bindingctx = BindingContext.getCurrent();
         BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
        
        if(arr != null){
            //String values = "[";
            for(int i=0;i<arr.length;i++) {
                //values = values + arr[i];
                System.out.println("Roles to be added "+arr[i]);
                    // Insert Row into USer Roles table
                    OperationBinding crRoleMethod = bindings.getOperationBinding("CreateInsertRoles"); 
                    crRoleMethod.execute();
                   
                   
                    DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
                    DCIteratorBinding iter = bindingsImpl.findIteratorBinding("XxUserRolesVO2Iterator");
                   
                    Row row = iter.getCurrentRow();
                    // Insert Role Name
                    row.setAttribute("RoleName",arr[i] );
                //if (i <arr.length - 1)
                //values = values + ",";
                }
        //values = values + "]";
       }
     }


 

Monday, November 5, 2012

R12 SLA Tables

http://apps2fusion.com/at/58-pv/303-r12-sla-subledger-accounting

http://oracleapps88.blogspot.com/2011/11/r12-subledger-accounting-tables.html

 Oracle Sub Ledger accounting (SLA) is accounting hub in Oracle Application Release 12 (R12). It is used to derive all attributes required to account a transaction in Oracle General Ledger. In R12, SLA is used to derive the very basic accounting attributes like entered amount, accounted amount, Date, Currency code etc and the complex attributes like Ledger, Code Combination ID, Periods etc. After deriving these accounting attributes the transactions are then interfaced to GL from SLA. Thus in R12 no sub ledgers (AP, PO, PA etc) interfaces the transactions directly to GL, but all the transactions are interfaced to GL in following 2 steps:
1. Sub ledgers interface the data to SLA.
2. SLA derives the accounting information and interfaces the data to GL.

SLA gives the flexibility to manage the entire accounting rule at one place, which acts as a single source of truth for GL.


Run Create Accounting to Populate Accounting events (SLA)  tables. After running Creating Accounting user can view Accounting.

Key Tables for SLA

XLA_AE_HEADERS
XLA_AE_LINES
XLA_TRANSACTION_ENTITIES
XLA_DISTRIBUTION_LINKS
GL_IMPORT_REFERENCES


XLA_TRANSACTION_ENTITIES.entity_code IN (
'TRANSACTIONS',
"RECEIPTS',
'ADJUSTMENTS',
'PURCHASE_ORDER',
'AP_INVOICES',
'AP_PAYMENTS',
'MTL_ACCOUNTING_EVENTS',
'WIP_ACCOUNTING_EVENTS'
'EXPENDITURES'

-- Mapping Identifiers
--Menu: Setup > Subledger Accounting > Accounting Methods Builder > Events > Event Modal
--Entity Code                     Column Value                                Column in xla_transaction_entities
--EXPENDITURES           EXPENDITURE_ITEM_ID         SOURCE_ID_INT_1
--REVENUE                      PROJECT_ID                                SOURCE_ID_INT_1
--REVENUE                      DRAFT_REVENUE_NUM          SOURCE_ID_INT_2
--AP_INVOICES               INVOICE_ID                                SOURCE_ID_INT_1
--AP_PAYMENTS            CHECK_ID                                   SOURCE_ID_INT_1




Taking the example of Oracle Projects in 11i where after costing the transaction user need to run the ‘PRC: Interface Cost to General Ledger’ followed by ‘Journal Import’ followed by ‘PRC: Tieback process’. But in R12 user only need to run “PRC: Generate Cost Accounting Events” which will register events in SLA and thereafter SLA will take care of accounting the transaction and interfacing it to GL. There is no tieback process in R12, as there is one to one reference of event id between SLA and sub ledger tables.



Other Oracle Table Information
http://oracleappsviews.blogspot.com/2012/06/apps-tables-with-links.html#!/2012/06/apps-tables-with-links.html

XLA_AE_HEADERS XAH,
XLA_AE_LINES XAL,
xla.XLA_TRANSACTION_ENTITIES XTE,
XLA_DISTRIBUTION_LINKS XDL,
XLA_EVENTS XEVENT


R12 Error while running
PRC: Create Accounting
The application accounting definition Projects Standard Accounting owned by Oracle is not validated.  Please validate the application accounting definition or update the application accounting definitions contained in the subledger accounting method Standard Accrual.
Solution
Run Program
Validate Application Accounting Definitions with Ledger and Application Details.


Transaction data not found in XLA_TRANSACTION_ENTITIES

Solution
Query useing xla.xla_transaction_entities



http://oracle.anilpassi.com/mo-global-dive-into-r12-multi-org-design.html





exec fnd_global.apps_initialize(11787,20707,201);
exec mo_global.init ('PO');





http://oracle-ramaraj.blogspot.com/2013/01/oracle-app-s-link-between-gl-to.html

Oracle Apps GL Base Table and Interface Table
                          
GL_JE_HEADERS                      GL_INTERFACE
GL_JE_LINES                             GL_INTERFACE_HISTORY
GL_JE_CATEGORIES                GL_DAILY_RATES_INTERFACE  
GL_JE_SOURCES                      GL_BUDGET_INTERFACE
GL_SETS_OF_BOOKS              GL_IEA_INTERFACE
GL_DAILY_RATES
GL_CODE_COMBINATIONS
GL_BALANCES
GL_PERIODS
GL_PERIOD_SETS
GL_CURRENCIES
GL_HISTORICAL_RATES
GL_LOOKUPS   

---------------------------------------------------------------------------------

 
Oracle Apps  :  Link between GL to Subledger Account

GL_JE_BATCHES (je_batch_id)                                   => GL_JE_HEADERS (je_batch_id)

GL_JE_HEADERS (je_header_id)                                  => GL_JE_LINES (je_header_id)

GL_JE_LINES (je_header_id,  je_line_num)                      => GL_IMPORT_REFERENCES (je_header_id, je_line_num)

GL_IMPORT_REFERENCES (gl_sl_link_table, gl_sl_link_id)        => XLA_AE_LINES (gl_sl_link_table, gl_sl_link_id)

XLA_AE_LINES (application_id, ae_header_id)                   => XLA_AE_HEADERS (application_id, ae_header_id) 

XLA_AE_HEADERS (application_id, event_id)                     => XLA_EVENTS (application_id, event_id)  

XLA_EVENTS (application_id, entity_id)                        => XLA.XLA_TRANSACTION_ENTITIES 

Saturday, November 3, 2012

ADF Java Data Types




Type NameJava TypeGroovy Type
Arrayoracle.jbo.domain.Array-
BFileDomainoracle.jbo.domain.BFileDomain-
BigDecimaljava.math.BigDecimaljava.math.BigDecimal
BlobDomainoracle.jbo.domain.BlobDomainoracle.jbo.domain.BlobDomain
Booleanjava.lang.Booleanjava.lang.Boolean
Bytejava.lang.Bytejava.lang.Byte
Charoracle.jbo.domain.Charjava.lang.String
Characterjava.lang.Characterjava.lang.Character
ClobDomainoracle.jbo.domain.ClobDomainoracle.jbo.domain.ClobDomain
DBSequenceoracle.jbo.domain.DBSequencejava.lang.Long
Dateoracle.jbo.domain.Datejava.sql.Date
Doublejava.lang.Doublejava.lang.Double
Floatjava.lang.Floatjava.lang.Float
Integerjava.lang.Integerjava.lang.Integer
Longjava.lang.Longjava.lang.Long
NClobDomainoracle.jbo.domain.NClobDomainoracle.jbo.domain.NClobDomain
Numberoracle.jbo.domain.Numberjava.lang.Long
Objectjava.lang.Objectjava.lang.Object
OrdAudioDomainoracle.ord.im.OrdAudioDomainoracle.ord.im.OrdAudioDomain
OrdDocDomainoracle.ord.im.OrdDomainoracle.ord.im.OrdDomain
OrdImageDomainoracle.ord.im.OrdImageDomainoracle.ord.im.OrdImageDomain
OrdImageSignatureDomainoracle.ord.im.OrdImageSignatureDomainoracle.ord.im.OrdImageSignatureDomain
OrdVideoDomainoracle.ord.im.OrdVideoDomainoracle.ord.im.OrdVideoDomain
REForacle.sql.REF-
Raworacle.jbo.domain.Raw-
RowIDoracle.jbo.domain.RowIDjava.lang.String
Shortjava.lang.Shortjava.lang.Short
Stringjava.lang.Stringjava.lang.String
Timestamporacle.jbo.domain.Timestampjava.sql.Timestamp
TimestampLTZoracle.jbo.domain.TimestampLTZjava.sql.Timestamp
TimestampTZoracle.jbo.domain.TimestampTZjava.sql.Timestamp

Thursday, November 1, 2012

ADF Generic Code and Information

ADF Blogs
https://blogs.oracle.com/shay/entry/new_adf_blogs

http://andrejusb-samples.blogspot.com/


Some WebCenter blogs with good ADF related content:
WebCenter A-Team - https://blogs.oracle.com/ATEAM_WEBCENTER/
John Brunswick - http://www.johnbrunswick.com/
George Maggessy - http://george.maggessy.com
And of course Frank Nimphius Code Corner
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html

Oracle Demo Page
http://jdevadf.oracle.com/adf-richclient-demo/faces/feature/layoutBasics.jspx
http://jdevadf.oracle.com/adf-richclient-demo/faces/components/index.jspx

Backing Bean Handy Codes
http://biemond.blogspot.com/2009/03/some-handy-code-for-backing-beans-adf.html


ADF with OAF
https://blogs.oracle.com/jruiz/entry/adf_and_oracle_e_business2

ADF get Current Row Attribute Value
import oracle.adf.model.BindingContext;
import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.jbo.domain.Number;
....
        DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry(); 
        DCIteratorBinding iterBind= (DCIteratorBinding)dcBindings.get("XxTestStgVO1Iterator"); 
        Number attItemId = (Number)iterBind.getCurrentRow().getAttribute("ItemId");



Accessing Data Controls and Bindings

Access AM
DCBindingContainer bc = getBindingContainer();
MyAppModule myAM =
(MyAppModule)bc.findDataControl("MyAppModuleDataControl").getDataProvider();

Getting Attribute from Iterator Binding
DCBindingContainer bc = getBindingContainer();
String ename = (String)bc.findIteratorBinding("EmpIter").getCurrentRow().getAttribute("EName");

Access Binding Container with Convenience API
BindingContainer  bc = BindingContext.getCurrent().getCurrentBindingEntry();


Programmatic Commit
import oracle.adf.model.BindingContext;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
....
        BindingContext bindingContext = BindingContext.getCurrent();
        BindingContainer bindings = bindingContext.getCurrentBindingsEntry();
        OperationBinding commitOper = (OperationBinding) bindings.get("Commit");
        commitOper.execute();

Alternate Keys
http://docs.oracle.com/cd/E28280_01/web.1111/b31974/bcentities.htm#CJACCDID

How to programmatically access ADF binding values
FacesContext fctx = FacesContext.getCurrentInstance();
ELContext elctx = fctx.getELContext();
Application application = fctx.getApplication();
ExpressionFactory exprFactory = application.getExpressionFactory();
ValueExpression valueExpr = exprFactory.createValueExpression( elctx, "#{bindings.DepartmentId.inputValue}", Object.class);
oracle.jbo.domain.Number departmentId = null;
departmentId = (oracle.jbo.domain.Number) valueExpr.getValue(elctx);

ADF LOV
https://blogs.oracle.com/prajkumar/entry/create_lov_in_adf_application
http://www.baigzeeshan.com/2010/03/how-to-create-adf-lov-with-view.html

1)Create LOVVO or ViewCriteria for MasterLookup table depending on your condition.
2)Open VO and its attribute on which you want to create List Of Values. Click on List of Values -> Add. It will open Form and default List Of Values name.
a)In Configuration Enter ListDataSource as LOV VO or ViewAccessor or Master Lookup TableVO.
   In case of MasterLookupTableVO after adding DataSource click edit to add ViewCriteria.
b)Mention ListAttribute name.
3)In UI Hints you can add Meaning or Description columns.



ADF Set on Current row after Rollback Execute or page refresh
http://oracleadf-java.blogspot.in/2012/10/set-on-current-row-after-rollback.html?goback=%2Egde_1801839_member_180755619
DCIteratorBinding Iter = (DCIteratorBinding)bindings.get("<YourIteratorName>");
Key parentKey = Iter.getCurrentRow().getKey();
BindingContainer binding = getBindings();
OperationBinding RollbackBdg = binding.getOperationBinding("Rollback");
RollbackBdg.execute();
OperationBinding ExcBdg  = binding.getOperationBinding("Execute");
ExcBdg.execute();
Iter.setCurrentRowWithKey(parentKey.toStringFormat(true));



VO WHERE Clause at Runtime
ViewObject vo = am.findViewObject("<YourViewObject>");
String whereClause = " Emp_id = 10";
vo.setWhereClause(whereClause);
vo.setOrderBy(orderByClause);



Using Named Bind Variables

ViewObject vo = am.findViewObject("<YourViewObject>");
vo.setNamedWhereClauseParam("pEmpId",10);
vo.executeQuery();

Add named Bind Variables at Runtime
vo.setWhereClause(" emp_id = :pEmpId");
vo.defineNamedWhereClauseParam("pEmpId,null,null);
vo.setNamedWhereClauseParam(pEmpId,10);



View Criteria Programmatically
ViewCriteria vc = <yourVO>.createViewCriteria();
ViewCriteriaRow   HeadDeptRow = vc.createViewCriteriaRow();
ViewCriteriaRow   MaintDeptRow = vc.createViewCriteriaRow();

HeadDeptRow.setAttribute("DeptId",10);

MaintDeptRow.setAttribute("DeptId",20);

vc.addElement(HeadDeptRow);
vc.addElement(MaintDeptRow);

<yourVO>.applyViewCriteria(vc);
<yourVO>.executeQuery();


View Object get Executed Query
Inside VORowImpl -- ExecuteQuery
sop(getQuery());
http://codingwithpassion.blogspot.in/2010/11/oracle-adf-write-view-object-query-with.html



Iterate through VO inside  VOImpl

        RowSetIterator iter = createRowSetIterator(null);
        while (iter.hasNext()) {
        Row r = iter.next();
            System.out.println("Ename *** VoImpl " + r.getAttribute("Ename"));
        // Do something with the current row.
        }
        // close secondary row set iterator
        iter.closeRowSetIterator();
        or
        Row row;
        while ((row = this.next()) != null)
        {
        System.out.println("Ename " + row.getAttribute("Ename"));
         



What are validation Options in ADF ?
I)Business services:
a)ADF BC
         Metadata (declarative validation)
         Java (programmatic validation)
b)Database (PL/SQL)
II)User interface



ADF Logging in Deployed Apps
https://blogs.oracle.com/groundside/entry/adf_logging_in_deployed_apps?utm_source=dlvr.it&utm_medium=twitter



ADF - Passing Parameter Value between Pages
https://www.youtube.com/watch?v=4eyzBiIf5MM
https://www.youtube.com/watch?v=wrpciIzIN9A&feature=related


ADF Create with Parameters
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/13-create-with-params-169140.pdf
http://andrejusb.blogspot.com/2011/02/createwithparams-operation-for-oracle.html



ADF Bounded and Unbounded Task Flows













Managed Bean and Backing Bean
Managed Bean can be configured in
a)adfc-config
b)Task Flow Definition File

Backing Bean on page can be created while
a)Creating new jsf/jspx  or jsfff
b)After creation go to Page Design . Tools --> Design --> Page Properties --> Component Binding
 Click Auto Binding if you want all components on page to be included in Backing bean with acccessors.


Task Flow Refresh
http://adfdeveloper.blogspot.com/2012/05/task-to-refresh-task-flow.html?showComment=1380229598207#c9183905827530201763




JSF ADF LifeCycle


























Custom Phase Listener
http://docs.oracle.com/cd/E12839_01/web.1111/b31974/adf_lifecycle.htm#CIAJGBID
for fragments you should extend oracle.adf.model.RegionController

http://adfpractice-fedor.blogspot.com/2012/02/understanding-immediate-attribute.html
http://www.baigzeeshan.com/2011/05/how-to-run-java-code-on-every-page-load.html
https://forums.oracle.com/thread/918299?tstart=0
https://blogs.oracle.com/jdevotnharvest/entry/how_to_configure_an_adf_phase_listener_and_where_to_put_the_file

In page add
<f:view beforePhase="#{backingBeanScope.CheckListBackingBean.refreshPageNVC}">

    public void refreshPageNVC(PhaseEvent phaseEvent) {
        refreshPage(phaseEvent);
    }


Diif in af:commandButton,af:commandLink  and  af:goButton,af:goLink
Command
Submit requests and fire action event when activated.
Typically ued for internal validation.
Go
Navigate directly without server side actions.
Do not use control flow rules.
Typically used for external validation.

Implementing Security
https://forums.oracle.com/forums/thread.jspa?threadID=2216386
http://download.oracle.com/docs/cd/E17904_01/web.1111/b31974/adding_security.htm#BABDEICH
http://download.oracle.com/docs/cd/E17904_01/web.1111/e13707/atn.htm
http://e-ammar.net/Oracle_TIPS/filtering_adf_pgaes_based_on_log.htm
http://ramannanda.blogspot.com/2011/09/opss-adf-security-utility.html

http://docs.oracle.com/cd/E14571_01/web.1111/b31974/adding_security.htm
http://docs.oracle.com/cd/E15523_01/webcenter.1111/e10273/security.htm
https://forums.oracle.com/thread/1074565

http://andrejusb.blogspot.com/2010/11/things-you-must-know-about-adf-faces.html

Security Basics
http://myadfnotebook.blogspot.com/2011/11/adf-security-basics.html


Duplicate Anonymous Role Fix
http://udayarocks.wordpress.com/2012/09/06/how-to-fix-the-adf-security-error-jpsanonymousroleimpl-in-jdev-11-1-1-6-0/
http://matt-shanto.blogspot.com/2012/07/adf-security_6473.html


ADF Working with Popups
http://www.adftips.com/2010/10/adf-ui-popuputil-class-to-show-or-hide.html



Oracle Forms to ADF
From Forms to ADF - When, Why, How?
https://www.youtube.com/watch?v=C4Dz8zO623U
When-Validate-Record  in Forms  -->  Add Entity Level Validation(Business Rules) in ADF.


http://jdeveloperandadf.blogspot.com/2011/02/oracle-adf-interview-questions-and.html



ADF Multi Choice List
http://myadfnotebook.blogspot.com/2010/09/getting-string-value-or-item-code-of.html
https://blogs.oracle.com/jdevotnharvest/entry/how_to_access_selected_rows


ADF Date Format Conversion
http://mahmoudoracle.blogspot.com/2012/03/date-classes-conversion-in-adf.html
http://journal.kaush.co/2012/03/13/how-to-convert-between-joda-and-oracles-date-classes/

ADF Using doDML
    protected void doDML(int operation, TransactionEvent e) {
       
        // super.doDML(i, transactionEvent);
        if(operation == DML_INSERT){
            Date vDate = getCurrentDateWithTime();
        setCreationDate(vDate);
        }
http://andrejusb.blogspot.com/2012/05/how-to-update-data-from-db-view-using.html
http://jneelmani.blogspot.com/2012/01/adf-11g-get-user-name-role.html


ADF Skip Validation on Page
http://andrejusb.blogspot.com/2012/12/skip-validation-for-adf-required-tabs.html
Open page definition file and select root tag in the structure window.
Go to Properties window and search for SkipValidation property. Set SkipValidation to true:


Diff in Vo.getFetchedRowCount()  and  Vo.getRowCount()
http://andrejusb.blogspot.com/2011/08/difference-between-fetched-row-count.html

To String
BigDecimal big = new BigDecimal("987654321");
String str = big.toString();

Export to PDF BI Publisher Integration or  Jasper Reports
http://www.ramkitech.com/2011/11/jsf-jpa-jasperreports-ireport.html
https://pinboard.in/search/u:OracleADF?query=BI_Publisher
http://jdevelopertips.blogspot.com/2009/08/integrating-bi-publisher-into-jdevelo.html


http://www.vogella.com/articles/JavaPDF/article.html

https://forums.oracle.com/forums/thread.jspa?threadID=2198973
https://forums.oracle.com/forums/thread.jspa?threadID=2320987

some of the links are on that threads.
http://sameh-nassar.blogspot.com/2009/10/using-jasper-reports-with-jdeveloper.html


BI Publisher/PDF Showing ???? for non English FOnts.
https://blogs.oracle.com/BIDeveloper/entry/non-english_characters_appears




Static Class or Static methods can not be instantiated.


System Files Location
C:\Users\<user_home>\AppData\Roaming\JDeveloper\system11.1.1.5.37.60.13

Popup Not Closing on clicking any button.
Fix -- af:popup Auto Cancel Enabled

Column value entered in Popup and after Closing popup it removes all previously entered records.
Fix -- Change Auto Submit property to True for previuos fields.



How to import custom classes from model to view controller in adf?


Right click your ViewController project > Project properties > Dependencies > Select Model and click the pencil. Here you select 'Build output' and press OK twice. Rebuild your application and you should be able to access classes from your model in your viewcontroller.


File Download
http://smconsultants.in/file-download-in-adf/

Display selected table row number and total rows
eg.
Row #{(bindings.EmpVO1Iterator.rangeStart < 0 ? 1 : bindings.EmpVO1Iterator.rangeStart+1) + ( bindings.EmpVO1Iterator.currentRowIndexInRange == -1 ? 0 : bindings.EmpVO1Iterator.currentRowIndexInRange)} of #{bindings.EmpVO1Iterator.estimatedRowCount}


Summit Application
https://blogs.oracle.com/jdevotnharvest/entry/adf_summit_sample_application_a

ADF Logger
https://blogs.oracle.com/groundside/entry/adventures_in_logging_index



ADF Refresh
http://jjzheng.blogspot.com/2010/11/manually-refresh-row-in-table-after.html


Data Dirty
http://oracleadfhowto.blogspot.com/2012/03/iterator-uncommitted-data-availability.html
#{!bindings.Commit.enabled}
#{!controllerContext.currentRootViewPort.dataDirty}
#{!controllerContext.currentViewPort.dataDirty}
 
#{!bindings.EmployeesView1Iterator.dataControl.TransactionDirty} 

http://adfbugs.blogspot.com/2009/12/pending-changes-in-adf-application.html
http://adfsnippets.blogspot.com/


AM Handle from Bean
http://ioracle-erp.blogspot.com/2012/08/different-ways-of-getting-handle-to-am.html

AM acces from VO
ViewObjectImpl.getApplicationModule()



ADF Performance Tuning
http://docs.oracle.com/cd/E16764_01/core.1111/e10108/adf.htm#BDCCCEAB



ADF Page Variables to Store Data.
http://andrejusb.blogspot.com/2011/10/page-definition-variables-to-store.html

1)Create Page Variable in Page Definition    P_INPUT
2)Add Page Variable in Bindings as _var(Just to rename)  P_INPUT_VAR
3)On Input Text put as Value    #{bindings.P_INPUT_VAR.inputValue}
4)From Backing bean access
String vinput = (String)evaluateEL("#{bindings.P_INPUT_VAR.inputValue}");


    public static Object evaluateEL(String el) {
    FacesContext facesContext = FacesContext.getCurrentInstance();
    ELContext elContext = facesContext.getELContext();
    ExpressionFactory expressionFactory =
    facesContext.getApplication().getExpressionFactory();
    ValueExpression exp =
    expressionFactory.createValueExpression(elContext, el,
    Object.class);
        return exp.getValue(elContext);
    }




ADF InputText Field Suffix
From Navaneetha
https://forums.oracle.com/forums/thread.jspa?threadID=2190564

<af:panelFormLayout id="pfl1">
<af:panelLabelAndMessage id="plam2"
label="#{bindings.Email.hints.label}">
<af:inputText value="#{bindings.Email.inputValue}"
required="#{bindings.Email.hints.mandatory}"
columns="#{bindings.Email.hints.displayWidth}"
maximumLength="#{bindings.Email.hints.precision}"
shortDesc="#{bindings.Email.hints.tooltip}" id="it1"
simple="true">
<f:validator binding="#{bindings.Email.validator}"/>
</af:inputText>
<f:facet name="end">
<af:outputText value="@SubbanaSolutions.com" id="ot1"/>
</f:facet>
</af:panelLabelAndMessage>
</af:panelFormLayout>
1) Ensure that the label for the component is set in the af:panelLabelAndMessage
2) For the inner component, set simple="true" so that there is no label displayed for it.




ADF EL Expression
Calling Method from EL Expression
http://technology.amis.nl/2009/12/04/adf-security-simple-el-expression-to-check-if-user-has-a-role/
Calling EL from Bean
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/003-advanced-el-tips-169117.pdf



ADF Search Form
http://docs.oracle.com/cd/E23943_01/web.1111/b31974/web_search_bc.htm
http://www.baigzeeshan.com/2010/04/creating-simple-search-form-in-oracle.html


ADF Programmatically Select check boxes
http://umeshagarwal24.blogspot.com/2012/06/selectdeselect-all-check-box-in-table.html


ADF Download FIle
http://hasamali.blogspot.com/2011/09/download-file-in-oracle-adf-gui.html

ADF Regular Expression Validation

<af:inputText label="Email Validation" id="it1"
                                         binding="#{backingBeanScope.backing_MainPage.it1}">
                                <af:validateRegExp pattern="[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"
                                  messageDetailNoMatch="The value {1} is not a valid email address:"/>
 </af:inputText>
https://forums.oracle.com/forums/thread.jspa?threadID=972049


try this one...
<af:validateRegExp pattern="^[0]{2}:[0]{2}-[2-3]{2}:[0-9]{2}$" messageDetailNoMatch="Format must be 00:00-23:99"/>

use online regex tester...http://www.regexplanet.com/advanced/java/index.html


http://vtkrishn.com/2012/09/08/how-to-in-jdeveloper-adf-to-have-hour-and-time-format-restriction-for-inputtext/


Date Validations
http://mychanneladf.blogspot.com/2012/06/comparing-dates-and-displaying.html

http://oracleanil.blogspot.com/2009/04/itemco.html

OnDate2
<af:validateDateTimeRange minimum="#{DATE1}"
                                                      messageDetailMinimum="Date2 must be greater than Date1"/>
or
On Date1
<af:validateDateTimeRange messageDetailMaximum="DATE1 must be prior to DATE2"
                                                      maximum="#{DATE2}"/>

ADF Contextual Events
http://www.jobinesh.com/2009/07/programmatically-publishing-contextual.html
http://www.jobinesh.com/2010/11/triggering-navigation-from-contextual.html
http://one-size-doesnt-fit-all.blogspot.com/2010/08/jdev-11g-programmatic-contextual-events.html
http://andrejusb.blogspot.com/2010/10/contextual-events-framework-and-adf-11g.html
http://biemond.blogspot.com/2009/11/adf-contextual-events-in-11g-r1-ps1.html

Contextual Events

http://www.oracle.com/technetwork/issue-archive/2011/11-may/o31adf-352561.html
http://docs.oracle.com/cd/E24382_01/web.1112/e16182/contextual_events.htm
http://antonis-antoniou.blogspot.in/2011/11/adf-contextual-events.html

ADF Layouts
http://www.jobinesh.com/2010/03/adf-faces-layout-tips.html


Grid Layout using Trinidad
https://blogs.oracle.com/jdevotnharvest/entry/grid_layouts_in_adf_faces_using_trinidad






ADF Mobile
https://blogs.oracle.com/brunoborges/entry/first_steps_with_oracle_adf
http://www.oracle.com/technetwork/developer-tools/adf/adf-mobile-samples-1865088.html


ADF Tree Component
http://anindyabhattacharjee.blogspot.com/2010/08/adf-tree-navigation-to-third-level-and.html




ADF Maps
https://blogs.oracle.com/shay/entry/working_with_the_adf_dvt
https://blogs.oracle.com/middleware/entry/integrating_google_maps_with_adf
http://docs.oracle.com/cd/E17904_01/web.1111/b31973/dv_map.htm
https://blogs.oracle.com/imc/entry/excellent_example_of_oracle_adf
https://blogs.oracle.com/emeapartnerweblogic/entry/adf_mobile_geo_location_and



ADF Sending Email
http://rnuka.blogspot.com/2013/03/using-javamail-api-to-send-emails-from.html
http://oracleadf-java.blogspot.com/2013/04/gmail-integration-with-oracle-adf-using.html
https://forums.oracle.com/thread/2578027?start=0&tstart=0
https://forums.oracle.com/thread/2405087



ADF Error

JBO-25014: Another user has changed the row with primary key oracle.jbo.Key

http://www.jobinesh.com/2011/02/yet-another-reason-for-jbo-25014.html


ADF Exception Handling
http://www.oracle.com/technetwork/issue-archive/2013/13-mar/o23adf-1897193.html

Task Flow Exception Handler
http://www.awasthiashish.com/2013/04/global-exception-handler-for-adf-task.html


Error Message Reference
http://docs.oracle.com/cd/E16340_01/core.1111/e10113/toc.htm

Custom Error Message
http://amit-adf-work.blogspot.in/
http://jobinesh.blogspot.com/2011/03/customizing-business-components-error.html


ADF Selection Listener
http://www.adftips.com/2010/11/adf-ui-selectionlistener-example-for.html



ADF Lov Default 
http://adfnbpel.wordpress.com/2013/02/25/to-set-default-value-as-first-value-in-select-one-choice/comment-page-1/#comment-82

in VoRowImpl
    public BigDecimal getDeptId() {
        if(getAttributeInternal(DEPTID)!=null)
        return (BigDecimal) getAttributeInternal(DEPTID);
        else
        {
        Row row = (Row)this.getDeptLovVA().first();  // first row from view accessor
        if(row!=null)
        return (BigDecimal)row.getAttribute("DeptId");
        }
        return null;
    }

ADF Internationalization/Localization
http://technology.amis.nl/2012/08/11/supporting-multiple-languages-in-adf-applications-backed-by-resource-bundles-and-programmatically-controlling-the-jsf-locale/
http://biemond.blogspot.com/2009/02/change-language-locale-in-adf.html


ADF Table Custom QueryListener
http://huysmansitt.blogspot.com/2012/09/adf-table-filters-case-insensitive-and.html?showComment=1391636428311#c1383289211844255867

ADF SelectOneRadio
http://technology.amis.nl/2010/11/11/adf-11g-selectoneradio-in-table-layout/
http://adfgoodies.blogspot.com/
http://lucbors.blogspot.com/2010/11/adf-11g-selectoneradio-in-table-layout.html



ADF Javascripts
http://biemond.blogspot.com/2010/11/adf-faces-rich-client-development.html
http://stackoverflow.com/questions/9425862/including-a-js-file-in-jsf-adf-page
http://adfgoodies.blogspot.com/

ADF Sorting Transient VO's
https://blogs.oracle.com/vijaymohan/entry/sorting_transientvo_vs_queryeo_based_vo
//Populate your transient VO rows.
//VO.setSortBy("YourVOAttrName");
//VO.setQueryMode(ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
//VO.executeQuery();



ADF Iterate Lov View Accessor
        DCBindingContainer bindings = (DCBindingContainer)ADFUtil.evaluateEL("#{bindings}");
        DCIteratorBinding voIterBndg = bindings.findIteratorBinding(pTrIteratorName);
        ViewObject mainVO = voIterBndg.getViewObject();
        Row[] mainVORow = voIterBndg.getAllRowsInRange();
        RowSet attributeVA = (RowSet)mainVORow[0].getAttribute("<YourViewAccessorName>");
        attributeVA.executeQuery();

http://middiu.blogspot.com/2012/08/adf-refresh-child-iterator.html
http://www.jobinesh.com/2012/03/forcefully-executing-view-accessor.html