Thursday, March 22, 2018

ADF - Customizing the Standard Search Functionality


In OAF - We have a bean called : QueryBean - which performs Automatic Search Functionality.
There are use cases where we do customization to the Standard Query bean.

Similarly in ADF too, there is search bean and also it provides custom logic to be implemented.

The Same is explained in this tutorial in detailed manner @

http://www.oracle.com/technetwork/developer-tools/adf/learnmore/30-table-filter-queries-169172.pdf









Java Logic Used is mentioned below : EmployeeQueryPG.java

package view.backing;

import java.util.Map;

import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.MethodExpression;

import javax.faces.context.FacesContext;

import oracle.adf.view.rich.component.rich.RichDocument;
import oracle.adf.view.rich.component.rich.RichForm;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.adf.view.rich.component.rich.input.RichInputDate;
import oracle.adf.view.rich.component.rich.output.RichMessages;
import oracle.adf.view.rich.event.QueryEvent;
import oracle.adf.view.rich.model.FilterableQueryDescriptor;

public class EmployeeQueryPG {
    private RichForm f1;
    private RichDocument d1;
    private RichMessages m1;
    private RichTable t1;
    private RichInputDate id1;

    public void setF1(RichForm f1) {
        this.f1 = f1;
    }

    public RichForm getF1() {
        return f1;
    }

    public void setD1(RichDocument d1) {
        this.d1 = d1;
    }

    public RichDocument getD1() {
        return d1;
    }

    public void setM1(RichMessages m1) {
        this.m1 = m1;
    }

    public RichMessages getM1() {
        return m1;
    }

    public void setT1(RichTable t1) {
        this.t1 = t1;
    }

    public RichTable getT1() {
        return t1;
    }

    public void setId1(RichInputDate id1) {
        this.id1 = id1;
    }

    public RichInputDate getId1() {
        return id1;
    }

    public void onQuery(QueryEvent queryEvent) {
        // Add event code here...
        System.out.println("user is searching");
       
        // pre-processing code here

         boolean invokeQuery = true;
         /*
         * Method called by the Query Listener. This method checks if
         * the DepartmentId parameter contains a valid number and puts
         * the DepartmentName into the expected case
         */
         FilterableQueryDescriptor fqd =
         (FilterableQueryDescriptor)
         queryEvent.getDescriptor();
         Map map = fqd.getFilterCriteria();
       
        // ensure DepartmentId contains a Number
         String EmployeeId = (String) map.get("EmployeeId");
       
         System.out.println("entered EmployeeId-->" + EmployeeId);
       
        if (EmployeeId != null && EmployeeId.length()>0){
           
            try {
              // try to parse String to integer
               Long.parseLong(EmployeeId);
               
            } catch (Exception ex) {
                // not a string
                System.out.println("Not a string");
                // add some error message here
                // unset selection
                map.remove("DepartmentId");
                invokeQuery = false;
            }
        }
       
        // ensure the initial character is in uppercase
        String departmentName = (String) map.get("FirstName");
        if (departmentName != null && departmentName.length()>0){
            StringBuffer sbuf = new StringBuffer();
            sbuf.append(departmentName.substring(0,1).toUpperCase());
            sbuf.append(departmentName.substring(1).toLowerCase());
            map.put("FirstName",sbuf.toString());           
        }
                       
        if (invokeQuery) {
            invokeMethodExpression("#{bindings.EmployeeEOVO1Query.processQuery}",
                                                   Object.class,QueryEvent.class,
                                                   queryEvent);
        }
       
       
       
    }
   
    public Object invokeMethodExpression(String expr, Class returnType, Class[] argTypes,Object[] args){
            FacesContext fc = FacesContext.getCurrentInstance();     
            ELContext elctx  = fc.getELContext();
            ExpressionFactory elFactory = fc.getApplication().getExpressionFactory();     
            MethodExpression methodExpr = elFactory.createMethodExpression(elctx,expr,returnType,argTypes);     
            return methodExpr.invoke(elctx,args);     
        }
   
   
    public Object invokeMethodExpression(String expr, Class returnType,Class argType, Object argument){   
        return invokeMethodExpression(expr, returnType,new Class[]{argType}, new Object[]{argument});
    }
   

}




Wednesday, March 21, 2018

ADF - Get Selected Rows - Single/Multi Selection


//Single Selection

    public String singleSelection_action() {
        // Add event code here...
       
        System.out.println("User Clicked on Single Button");
       
        DCBindingContainer bindings =
                    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
                DCIteratorBinding dcItteratorBindings =
                    bindings.findIteratorBinding("EmployeeEOVO1Iterator");
               
        // Get an object representing the table and what may be selected within it
                ViewObject voTableData = dcItteratorBindings.getViewObject();
       
                // Get selected row
                Row rowSelected = voTableData.getCurrentRow();
       
                // Display attribute of row in console output - would generally be bound to a UI component like a Label and or used to call another proces
                System.out.println(rowSelected.getAttribute("EmployeeId"));
               
               
               
        return null;
    }


//Multi Selection

    public String multipleSelection_action() {
        // Add event code here...
        System.out.println("User Clicked on Multiple Selection ");


        // RowKeySet Object can hold the selected rows from a user as follows
                RowKeySet rksSelectedRows =
                    this.getT1().getSelectedRowKeys();

                // Iterator object provides the ability to use hasNext(), next() and remove() against the selected rows
                Iterator itrSelectedRows = rksSelectedRows.iterator();

                // Get the data control that is bound to the table - e.g. OpenSupportItemsIterator
                DCBindingContainer bindings =
                    (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
                DCIteratorBinding dcIteratorBindings =
                    bindings.findIteratorBinding("EmployeeEOVO1Iterator");

                // Information from binding that is specific to the rows
                RowSetIterator rsiSelectedRows =
                    dcIteratorBindings.getRowSetIterator();

                // Loop through selected rows
                while (itrSelectedRows.hasNext()) {

                    // Get key for selected row
                    Key key = (Key)((List)itrSelectedRows.next()).get(0);

                    // Use the key to get the data from the above binding that is related to the row
                    Row myRow = rsiSelectedRows.getRow(key);

                    // Display attribute of row in console output - would generally be bound to a UI component like a Label and or used to call another proces
                    System.out.println(myRow.getAttribute("EmployeeId"));
                }
               
               
               
               
        return null;
    }

Thursday, March 01, 2018

ADF - Sample Java Code To Iterate VO Data



Following is the code snippet to extract the data from VO.

Below code is very similar to the logic which we write in OAF (Oracle Application Framework)

public class AppModuleAMTest {
   
     public static void main(String args[])
     {
       //bc4jclient --press enter 
         String amDef = "oracle.fod.storefront.model.module.AppModuleAM";
        String config = "AppModuleAMLocal";
        ApplicationModule am =
            Configuration.createRootApplicationModule(amDef, config);
        ViewObject vo = am.findViewObject("Employees1");
        vo.executeQuery();
        while(vo.hasNext())
        { 
             Row empRow = vo.next();
             System.out.println("Employee ID -->"+ empRow.getAttribute(1));
           
            }
        // Work with your appmodule and view object here
        Configuration.releaseRootApplicationModule(am, true);
         }
}

Tuesday, February 27, 2018

ADF build.xml File For : StoreFront Sample


Following is the build.properties file

Value for : jdeveloper.home is very important , Please check the below screenshot















# Master Ant properties file for Fusion Order Demo
# All build files refer to this master list of properties
# Continuous builds override these settings
# $Id: build.properties 812 2007-02-20 07:14:33Z lmunsing $

# Base Directory for library lookup
jdeveloper.home=C:/Oracle/Middleware/jdeveloper/
src.home=..//..

# JDBC info used to create Schema
jdbc.driver=oracle.jdbc.OracleDriver
jdbc.urlBase=jdbc:oracle:thin:@localhost
jdbc.port=1521
jdbc.sid=XE

# Information about the default setup for the demo user.
db.adminUser=system
db.demoUser=FOD
db.demoUser.password=fusion
db.demoUser.tablespace=USERS
db.demoUser.tempTablespace=TEMP


Running the build.xml ANT Script.












Buildfile: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\Ant\build.xml

init:
    [javac] Compiling 1 source file to C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\Ant\classes

setProperties:

createDatabase:

refreshSchema:
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] Failed to execute:       DROP USER FOD CASCADE
      [sql] java.sql.SQLSyntaxErrorException: ORA-01918: user 'FOD' does not exist

      [sql] 10 of 11 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
     [echo] Warning: An unlocked database user 'FOD' has been created, with create session, table, and sequence privileges.

createSchemaObjects:
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\createFODSchemaObjects.sql
      [sql] 489 of 489 SQL statements executed successfully

createSequenceTriggers:
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\createSequenceTriggers.sql
      [sql] 20 of 20 SQL statements executed successfully

populateTables:
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 4 of 4 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
     [echo] Demo Options Created
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\AVAILABLE_LANGUAGES.sql
      [sql] 5 of 5 SQL statements executed successfully
     [echo] Available Languages Created
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 244 of 244 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 244 of 244 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 244 of 244 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 244 of 244 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 244 of 244 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
     [echo] Country Codes Created
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 66 of 66 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 66 of 66 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 66 of 66 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 66 of 66 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 66 of 66 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
     [echo] Lookup Codes Created
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\ADDRESSES.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\DISCOUNTS_BASE.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\MEMBERSHIPS_BASE.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\SHIPPING_OPTIONS_BASE.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\SUPPLIERS.sql
      [sql] 173 of 173 SQL statements executed successfully
     [echo] Addresses, Memberships, Discounts, Shipping Options and Suppliers Created
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\DISCOUNT_TRANSLATIONS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\ELIGIBLE_DISCOUNTS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\MEMBERSHIP_TRANSLATIONS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\PERSONS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\SHIPPING_OPTION_TRANSLATIONS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\WAREHOUSES.sql
      [sql] 117 of 117 SQL statements executed successfully
     [echo] Persons, Warehouses, Discount Translations, Shipping Option Translations, and Eligible Discounts Created
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\ADDRESS_USAGES.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\CUSTOMER_IDENTIFICATIONS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\PAYMENT_OPTIONS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\PRODUCT_CATEGORIES_BASE.sql
      [sql] 197 of 197 SQL statements executed successfully
     [echo] Address Usages, Customer Identifications, Payment Options, Product Categories, and Orders Created
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\CATEGORY_TRANSLATIONS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\CUSTOMER_INTERESTS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\ORDERS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\PRODUCTS_BASE.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\WAREHOUSE_STOCK_LEVELS.sql
      [sql] 425 of 425 SQL statements executed successfully
     [echo] Products, Warehouse Stock Levels, Coupon Usages, Categories, and Customer Interests Created
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\ALTER_TABLES.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\COUPON_USAGES.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\HELP_TRANSLATIONS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\ORDER_ITEMS.sql
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\DataScripts\PRODUCT_TRANSLATIONS.sql
      [sql] 165 of 165 SQL statements executed successfully
     [echo] Coupon Usages, Product Translations, Order Items, and Help Translations Created
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\PackageScripts\user_context.sql
      [sql] 2 of 2 SQL statements executed successfully
     [echo] USER_CONTEXT Package Created

createIndexes:
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\createIndexes.sql
      [sql] 2 of 2 SQL statements executed successfully
     [echo] Indexes Created

compileImagesApp:
    [javac] Compiling 3 source files to C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\classes
    [javac] Note: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\src\oracle\fodemo\share\imageloader\EnvProvider.java uses or overrides a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\src\oracle\fodemo\share\imageloader\EnvProvider.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
     [copy] Copying 5 files to C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\classes

populateImages:
     [java] Feb 27, 2018 10:25:26 AM oracle.adf.share.ADFContext getCurrent
     [java] WARNING: Automatically initializing a DefaultContext for getCurrent.
     [java] Caller should ensure that a DefaultContext is proper for this use.
     [java] Memory leaks and/or unexpected behaviour may occur if the automatic initialization is performed improperly.
     [java] This message may be avoided by performing initADFContext before using getCurrent().
     [java] For more information please enable logging for oracle.adf.share.ADFContext at FINEST level.
     [java] Feb 27, 2018 10:25:28 AM oracle.mds
     [java] NOTIFICATION: PManager instance is created without multitenancy support as JVM flag "oracle.multitenant.enabled" is not set to enable multitenancy support.
     [java] oracle.jbo.JboException: JBO-29000: Unexpected exception caught: java.lang.NoClassDefFoundError, msg=oracle/jdbc/OracleClob
at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:764)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.Main.start(Main.java:179)
at org.apache.tools.ant.Main.main(Main.java:268)
Caused by: oracle.jbo.JboException: JBO-29115 Unable to construct the error message due to error java.lang.ClassNotFoundException: oracle.jbo.client.remote.StringManagerImpl. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-29000. Error message parameters are {0=java.lang.NoClassDefFoundError, 1=oracle/jdbc/OracleClob}
at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:602)
at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2396)
at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2270)
at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3169)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:592)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:525)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:520)
at oracle.jbo.client.Configuration.getApplicationModule(Configuration.java:1609)
at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1514)
at oracle.fodemo.share.imageloader.LoadImages.main(LoadImages.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
... 33 more
Caused by: java.lang.NoClassDefFoundError: oracle/jdbc/OracleClob
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at oracle.jbo.server.ComponentObjectImpl.createRef(ComponentObjectImpl.java:221)
at oracle.jbo.server.ApplicationModuleImpl.doCreateViewObject(ApplicationModuleImpl.java:4057)
at oracle.jbo.server.AMViewUsage.createViewObject(AMViewUsage.java:112)
at oracle.jbo.server.ApplicationModuleDefImpl.loadViewObject(ApplicationModuleDefImpl.java:659)
at oracle.jbo.server.ApplicationModuleDefImpl.loadComponents(ApplicationModuleDefImpl.java:922)
at oracle.jbo.server.ApplicationModuleImpl.createRootApplicationModule(ApplicationModuleImpl.java:512)
at oracle.jbo.server.ApplicationModuleHomeImpl.create(ApplicationModuleHomeImpl.java:87)
at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:158)
at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:73)
at oracle.jbo.common.ampool.ApplicationPoolImpl.instantiateResource(ApplicationPoolImpl.java:2836)
at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:583)
... 48 more
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleClob
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1094)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
... 64 more
--- Nested Exception ---
oracle.jbo.JboException: JBO-29115 Unable to construct the error message due to error java.lang.ClassNotFoundException: oracle.jbo.client.remote.StringManagerImpl. Use the exception stack trace and error code to investigate the root cause of this exception. Root cause error code is JBO-29000. Error message parameters are {0=java.lang.NoClassDefFoundError, 1=oracle/jdbc/OracleClob}
at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:602)
at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2396)
at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2270)
at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3169)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:592)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:525)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:520)
at oracle.jbo.client.Configuration.getApplicationModule(Configuration.java:1609)
at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1514)
at oracle.fodemo.share.imageloader.LoadImages.main(LoadImages.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:764)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.Main.start(Main.java:179)
at org.apache.tools.ant.Main.main(Main.java:268)
Caused by: java.lang.NoClassDefFoundError: oracle/jdbc/OracleClob
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at oracle.jbo.server.ComponentObjectImpl.createRef(ComponentObjectImpl.java:221)
at oracle.jbo.server.ApplicationModuleImpl.doCreateViewObject(ApplicationModuleImpl.java:4057)
at oracle.jbo.server.AMViewUsage.createViewObject(AMViewUsage.java:112)
at oracle.jbo.server.ApplicationModuleDefImpl.loadViewObject(ApplicationModuleDefImpl.java:659)
at oracle.jbo.server.ApplicationModuleDefImpl.loadComponents(ApplicationModuleDefImpl.java:922)
at oracle.jbo.server.ApplicationModuleImpl.createRootApplicationModule(ApplicationModuleImpl.java:512)
at oracle.jbo.server.ApplicationModuleHomeImpl.create(ApplicationModuleHomeImpl.java:87)
at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:158)
at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:73)
at oracle.jbo.common.ampool.ApplicationPoolImpl.instantiateResource(ApplicationPoolImpl.java:2836)
at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:583)
... 48 more
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleClob
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1094)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
... 64 more
## Detail 0 ##
java.lang.NoClassDefFoundError: oracle/jdbc/OracleClob
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at oracle.jbo.server.ComponentObjectImpl.createRef(ComponentObjectImpl.java:221)
at oracle.jbo.server.ApplicationModuleImpl.doCreateViewObject(ApplicationModuleImpl.java:4057)
at oracle.jbo.server.AMViewUsage.createViewObject(AMViewUsage.java:112)
at oracle.jbo.server.ApplicationModuleDefImpl.loadViewObject(ApplicationModuleDefImpl.java:659)
at oracle.jbo.server.ApplicationModuleDefImpl.loadComponents(ApplicationModuleDefImpl.java:922)
at oracle.jbo.server.ApplicationModuleImpl.createRootApplicationModule(ApplicationModuleImpl.java:512)
at oracle.jbo.server.ApplicationModuleHomeImpl.create(ApplicationModuleHomeImpl.java:87)
at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:158)
at oracle.jbo.common.ampool.DefaultConnectionStrategy.createApplicationModule(DefaultConnectionStrategy.java:73)
at oracle.jbo.common.ampool.ApplicationPoolImpl.instantiateResource(ApplicationPoolImpl.java:2836)
at oracle.jbo.pool.ResourcePool.createResource(ResourcePool.java:583)
at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2396)
at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2270)
at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3169)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:592)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:525)
at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:520)
at oracle.jbo.client.Configuration.getApplicationModule(Configuration.java:1609)
at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1514)
at oracle.fodemo.share.imageloader.LoadImages.main(LoadImages.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:764)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:218)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:132)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:105)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:416)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.Main.start(Main.java:179)
at org.apache.tools.ant.Main.main(Main.java:268)
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleClob
at org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1400)
at org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1341)
at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:1094)
at java.lang.ClassLoader.loadClass(ClassLoader.java:246)
... 64 more
     [java] Java Result: -1

revokePrivs:
      [sql] Executing resource: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
      [sql] 6 of 6 SQL statements executed successfully
   [delete] Deleting: C:\Users\sriyerram\Documents\Sridhar\Cloud\ADF\FusionOrderDemo_R2_1_revised\Infrastructure\DBSchema\Scripts\SQLRunner1246245679.sql
     [echo] Cleaning up database user privileges.

createDatabase:
     [echo] Database (Re)Creation Complete

buildAll:

BUILD SUCCESSFUL
Total time: 18 seconds

Thursday, February 15, 2018

ADF - Code Snippets

Extract the value from the text input component

Write the below method in the managed bean.

    public Object cb1_action() {
        // Add event code here...
       
        FacesContext facesContext = FacesContext.getCurrentInstance();
            UIViewRoot root = facesContext.getViewRoot();
            RichInputText inputText = (RichInputText)root.findComponent("it1");
            String val = (String)inputText.getValue();
            System.out.println("Entered Value -->"+ val);
        return null;

    }

Thursday, December 14, 2017

Comparison of Files Created For HelloWorld Application in OAF and ADF

In this post, i would like to provide very basic level of files comparison between OAF and ADF

HelloWorld - OAF Application Requires the following :

Below are the bare minimum files, which are required to create HelloWorld Page in OAF.

Workspace - .jws file
Project  - .jpr file
Application Module : AM.xml , AMImpl.java
UI Page - HelloWorldPG.xml

Below are the files, which are required to create HelloWorld Page in ADF
Workspace - .jws file
Project- ViewController.jpr , Model.jpr
UI Page - HelloWorldPG.jspx
Config Files : adf-config.xml, weblogic-application.xml, adfc-config.xml, faces-config.xml, trinidad-config.xml, web.xml


Few Observations in this HelloWorld ADF Sample :

  • AM is not required to run HelloWorld PG in ADF
  • 2 Projects are created by Default in ADF
  • ADF runs on Embedded Weblogic Server(While Running from Desktop)
  • No DB connection is required






OAF - Code Snippet to get list of AM's Loaded in the page

             OAApplicationModule parentAM = pageContext.getRootApplicationModule() ;
             String[] nestedAMNames = parentAM.getApplicationModuleNames();
           
             // If you want to retrieve all currently loaded nested Application Modules
             ApplicationModule[] nestedAMs = new ApplicationModule[nestedAMNames.length];

             // oracle.apps.ar.hz.components.account.customer.server.HzPuiCustActAMImpl hzCustAccountAM = null;
             oracle.apps.ar.hz.components.account.contact.server.HzPuiActContRoleAMImpl  HzPuiActContRoleAM  = null;
             for (int i = 0; i < nestedAMNames.length && temp==0; i++)
             {
             nestedAMs[i] = parentAM.findApplicationModule(nestedAMNames[i]);
                 pageContext.writeDiagnostics(this,"nestedAMs["+i+"]" + nestedAMs[i],OAFwkConstants.STATEMENT);
              if(nestedAMs[i] instanceof HzPuiActContRoleAMImpl)
               {
                   temp = 1;
                   HzPuiActContRoleAM = (HzPuiActContRoleAMImpl)nestedAMs[i];
                   pageContext.writeDiagnostics(this,"Matching AM Found ; nestedAMs["+i+"]" + nestedAMs[i],OAFwkConstants.STATEMENT);
               }
             }

Wednesday, December 06, 2017

Oracle SCM - Lookups

mtl_txn_request_lines  -Line Status Lookup


select lookup_code, meaning
from mfg_lookups 
where lookup_type = 'MTL_TXN_REQUEST_STATUS' 

order by lookup_code