Friday, January 18, 2013

Usage of getters in RowImpl of VO to get dynamic generated values


            ExampleAppModuleImpl appModule =
                (ExampleAppModuleImpl)getApplicationModule();
//Get the AppModule and call the required methods.you can pass row values like getId()

Pass an array to Stored Procedure ADF

http://technology.amis.nl/2008/07/16/oracle-jdbc-passing-a-table-of-custom-object-type-to-a-stored-procedure-implementing-efficient-single-round-trip-data-exchange-part-two-of-an-adf-application-on-a-plsql-api/

public String getCount(String[] parmArray, String sqlIn) {
        CallableStatement cs = null;
        Connection conn;
        try {
            cs =
 getDBTransaction().createCallableStatement("begin SP_CREATESQL(?,?,?,?,?);end;",
                                            0);

            conn = getDBTransaction().createStatement(1).getConnection();
         
           Object[] paramArray = new Object[2];
            paramArray[0] = parmArray[0];
            paramArray[1] = parmArray[1];


            ArrayDescriptor arrayDesc =
                ArrayDescriptor.createDescriptor("T_STRINGARRAY", conn);
// T_STRINGARRAY is a  Collection Type defined in the database schema
            ARRAY sqlArray = new ARRAY(arrayDesc, conn, paramArray);
            cs.setArray(1, sqlArray);
            cs.setString(2, sqlIn);
            cs.registerOutParameter(3, Types.VARCHAR);
            cs.registerOutParameter(4, Types.INTEGER);
            cs.registerOutParameter(5, Types.VARCHAR);
            cs.executeUpdate();
            System.out.println("Count " + cs.getString(3));
            System.out.println("Error Code: " + cs.getInt(4));
            System.out.println("Error Message: " + cs.getString(5));
            return cs.getString(3);


        } catch (SQLException e) {
            e.printStackTrace();
            throw new JboException(e);

        } finally {
            if (cs != null) {
                try {
                    cs.close();
                } catch (SQLException e) {
                    System.out.println(e.getMessage());
                    System.out.println(e.getSQLState());
                }
            }
        }
    }


Thursday, January 17, 2013

DynamicVO - Executes DynamicSQL Query

http://mahmoudoracle.blogspot.com/2012/05/adf-dynamic-view-object.html#.UPh5UB3AfSg

Create a VO with- select * from dual

    public void changeDynamicVoQuery(String sqlStatement) {
        ViewObject dynamicVO = this.findViewObject("DynamicVO");
        dynamicVO.remove();
        dynamicVO =
                this.createViewObjectFromQueryStmt("DynamicVO", sqlStatement);
        dynamicVO.executeQuery();
        ViewRowImpl row = (ViewRowImpl)dynamicVO.next();
     
        String count = (String)row.getAttribute(0).toString();
     
        this.setCount(count);

    }

Friday, January 11, 2013

Action Or Action Listener which is called first?

Action Listener then Action

Action Listener is called First

Difference between Action Listener vs Action
AL - return type void A- return type String
AL- accepts parameters A-Doesn't
AL- Can't Navigate to another page A- we can navigate to another page


How to pass a parameter to AL?
http://www.gebs.ro/blog/oracle/adf-send-parameter-to-actionlistener/

Thursday, January 10, 2013

Get TaskFlow's PageFlowScope Parameter in BackingBean


        ADFContext adfCtx = ADFContext.getCurrent();
        Map pageFlowScope = adfCtx.getPageFlowScope();    
        Object val = pageFlowScope.get("attributeName")

Tuesday, January 8, 2013

Get to see all the values in Select One choice

Set the Range size of associated VOIterator to -1 in the bindings of the page