Monday, February 4, 2013

UIComponents Allignment - Margins and Width

margin-left:35px //this property leaves left margin for the component
margin-top:5px // top margin
width:457px; // width 

you can also mention values in %

Tuesday, January 22, 2013

Programmatic ViewCriteria adf


               
http://docs.oracle.com/cd/B14099_19/web.1012/b14022/oracle/jbo/ViewCriteriaRow.html

     ViewCriteria viewCriteria =
                availableVO.createViewCriteria();

            ViewCriteriaRow viewCriteriaRow =
                viewCriteria.createViewCriteriaRow();

            viewCriteriaRow.setAttribute("VOAttribute", someValue);

            viewCriteria.add(viewCriteriaRow);

            availableVO.applyViewCriteria(viewCriteria);

            availableVO.executeQuery();

set an iterator to particular key adf

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);

    }