Pages

Thursday, July 5, 2012

How to pass Oracle Table Type Object from Java Code to Oracle Stored Procedure

I had a requirement to pass Oracle Table Type Objects to a Store procedure. In this blog, I will explain how we can pass the Table type object from Java code.

The table type objects I used are: 
JTF_NUMBER_TABLE               //Table type of Number Type       JTF_VARCHAR2_TABLE_100  //Table type of Varchar2(100) Type
These two objects are input parameters to the stored procedure.

If you have Number, String Array as shown below:
Number[] srContactPointId = new Number[4];
String[] contactType = new String[4];   

These can be passed as Table type Object using the following code.

//Getting hold of the transaction
DBTransaction txn = (DBTransaction)wrsAmImpl.getDBTransaction();
OracleCallableStatement cstmt = (OracleCallableStatement)txn.createCallableStatement(cs, 1);

//Getting the Connection Object
Connection conn = cstmt.getConnection();

//Creating oracle.sql.ArrayDescriptor Object for corresponding Table Type Object.
ArrayDescriptor numberDescriptor =  new ArrayDescriptor("APPS.JTF_NUMBER_TABLE", conn);
ArrayDescriptor stringDescriptor =  new ArrayDescriptor("APPS.APPS.JTF_VARCHAR2_TABLE_100", conn);

//Creating oracle.sql.ARRAY object to be passed to the Oracle Stored Procedure
ARRAY contactPointId = new ARRAY(numberDescriptor , conn, contactPartyId);
ARRAY contType = new ARRAY(stringDescriptor , conn, contactType);

Tuesday, July 3, 2012

Defining a tooltip for Table filter column/field.

In one of my project I had a requirement to show tool tip/short description for a table column filter. In this post, I will explain how to define tool tip for table filter.

- Select the column in the table for which you want to define tool tip. 

- Expand Column facets node for that column and select filter facet

- Inside the filter facet insert an Input Text component and set it's value property to #{vs.filterCriteria.Summary}, where vs is the VarStatus property in the table and Summary is the attribute name. 
Setting this value, will query the column attribute, without customizing the filter component.


 - The custom tool tip for the table column filter can now be set on the shortDesc property of Input Text. After this modification, the column code looks like:


UI

Monday, July 2, 2012

Using groovy expression for throwing dynamic error message

In this post, I will explain a simple use case of groovy expression for throwing error message.

If there is a Business rule defined on an Entity Object attribute such that, a Date value cannot be less than the current Date and if this Business Rule is violated an error message should be thrown like : The value entered, <enteredDate> is less than the Current Date <currDate>.

For this add an attribute validator on the date attribute.

Select the rule type as Script Expression and define the rule as shown below:


In the failure handling tab, define the message string as shown:


Map the enteredDate to newValue and currDate to adf.currentDate in the token message expressions.

When this rule is violated the error message is shown as: