Reset ExecuteWithParams - a different approach

This blog speaks about a quick and efficient way to clear a form based on a View-Criteria, which is exposed on the GUI as an ADF form field.
The setup is simple enough.
1. Create a ViewObject - EmployeesVO, based on the EMPLOYEES table of HR schema. 2. Create a ViewCriteria - EmployeeSearchCriteria, with criteria of your choice. 3. Shuttle the ViewCriteria onto the View Object's Application Module instance. 4. Drag and drop the ExecuteWithParams action on the GUI as an ADF form. 5. Add two buttons - Search and Reset.
Here's how it stands now:

And this is how the GUI looks:

The "Search" button calls the ExecuteWithParams action. Nothing exciting there.
But how do we reset the form? One crude way is to just get hold of each attribute binding, and setting them to NULL. But what if your View-Criteria has many attributes to search on? It becomes really tedious to individually set each attribute to null.
Here is where the ADF BC comes to our rescue.
The ViewCriteria class…

Set current row after commit/rollback (with a twist)

One of the most common requirements from user experience perspective is to keep the currently edited row selected after commit or rollback, or mark the newly created row as the current row.
For edit use-case, this is quite simple to achieve. Step 1: Store the current row key. Step 2: Edit record and commit. Step 3: Execute query. Step 4: Set the old row as the current row in the Row Set.
Here's a code snippet:

Does this logic holds good for new rows?. Well yes, almost!

Imagine this scenario:
1. You have a table of employees with a search option.You have searched for department id 10. That shows up all employees from department id 10.
2. Now you create a new employee, but this time, for department 20.
3. Now, after commit, you try to set the set the new row as the current row.
Now you get an exception! oracle.jbo.RowNotFoundException: JBO-25020:View row of key oracle.jbo.Key[201] not found in EmployeesVO1Iterator.

Quite obvious, isn't it? The new employee from department 20 does not exist …

Passing tokens to ADF Faces Message

The following article shows how to add tokens to Faces Messages popped up on GUI.
Tokenization can be achieved by using java.text.MessageFormat class' format method. The format method takes in 2 arguments:

1. A String message - you can add a bundle text with tokens. The tokens will be replaced by supplied values, and the completed message will be displayed on the GUI.
2. Arguments of type Object array (Object[ ]).

The end results are as follows:

So how do we achieve this?

Step 1: We build the object arguments from the EmployeesVO1Iterator current row.
Step 2: We fetch the display message from the ViewControllerBundle file.
Step 3: We pass the arguments to the message, and the message is formatted using those arguments, and finally displayed on the GUI.

The below image shows the above logic inside a button action listener:

The "emp_click_message" bundle key looks something like this:

And here is how tokenization is achieved for the two arguments {0} and {1}:

You can add …

Complex datatypes for ADF AM/VO client service methods

JDev: Source: GitHub
One very recent work-related requirement was to pass and return complex data types from an Application Module Implementation class method.