Sunday, February 8, 2015

Custom Login Page using Login Bean in ADF

In most of the Oracle ADF Applications, applications have a customized login page which is specific to the application.

While configuring ADF Security, it generates a default Login and Error page which is good for testing the environment. But for actual applications , Customized Login page is required for the application. In this post we will be looking at it.

Use Case
Creating a customized login page and login the user programmatically using Managed Bean.

Lets get started.

Created a simple ADF Application CustomLoginApplication.

It consist of two JSPX pages. Custom Login and Landing page. Below is the code for custom login page.



Saturday, January 31, 2015

Preselected CheckBox - SelectBooleanCheckBox in ADF Table

In this post, I will be extending the application from the post CheckBox in ADF Table and retrieve selected rows .

The use case is very common. When the table with checkbox (SelectBooleanCheckBox) in the rows is rendered, there should be preselected checkbox in the rows depending on some condition. To make it simple to understand in this post ,when the Departments Table is loaded on the page, the checkbox should be ticked for Departments IT and Marketing.


Lets get into the implementation.

For this use case, lets add a method in AMImpl class which has the logic to tick or pres elect the checkboxes for rows having department name as IT and Marketing. Below is the code in AMImpl class. Note that VOImpl and VORowImpl classes has been generated for DepartmentsVO.

CheckBox in ADF Table and retrieve selected rows

In this post I will explain a way to implement checkbox in the rows of ADF Table component. This is a generic approach and can also be used in other components but we will take example of table component for this post.

This is common requirement in many features e.g. Multiple Delete or assigning multiple things by selecting checkbox.

Lets dive into the implementation.

Created a simple ADF app with HR Schema using Departments Table. Created DepartmentsEO,VO and AM.

First since we need a checbox in every row of the Departments table, we need to add a transient attribute in DepartmentVO of Type Boolean. The value of this boolean (false or true) will render the checkbox as (checked or unchecked).

Friday, January 23, 2015

Custom Selection Listener for ADF Table

In this post I will be describing how we can  have a custom selection listener for ADF Table. By default when we drag and drop a ADF Table Component, it gives us the option to select a row. If that option is selected, it creates a default selectionListener for the table component that is
#{bindings.VO.currentModel.makeCurrent"} where Iterator is VO iterator. This operation synchronizes the current selected row with the Iterator to which this Tree Binding is pointing to.

In Addition to this it also adds a attribute selectedRowKeys which has a value
#{bindings.VO.collectionModel.selectedRow}. This makes the selected row from the collection.

But when you change this to your custom selection handler of your managed bean, then the operation which are performed by {bindings.Iterator.currentModel.makeCurrent"} and selectedRowKeys needs to be done programmatically.

One way is to invoke #{bindings.VO.currentModel.makeCurrent"} programmatically in the selectionListener of the managed bean. This has been explained very clearly by my friend Ashish Awasthi :- Custom Selection Listener

Monday, January 19, 2015

Get SelectOneChoice Code/Values in Managed Bean - ADF

The repeated question on OTN is how to get the code or value  of the selected item from SelectOneChoice. One of my post explains how we can achieve this using variable iterators in page definition. Here is the link for the post : http://rohanwalia.blogspot.sg/2013/09/retrieve-selected-value-from.html

Using the technique described in the above mentioned approach, we get hold of the id or value when we select the item from select one choice and we can use it on the page.

But the problem comes when this value is needed in a method of managed bean using ValueChange Listener . One scenario for this is that the code of selected item is required as an input to call a method exposed by ApplicationModule.

So our use case will be to get EmployeeId of selected Employee from LOV into valueChangeListener.

To start with lets quickly create a sample application. Used HR schema and created one jspx page selectOneChoice.jspx .

Go to the binding and create a new variable inside variable iterator.

Tuesday, December 30, 2014

Data Presenter article in Top 10 OTN WebCenter Articles for 2014

Happy to know that my article about Data Presenter on OTN is in top 10 Webcenter articles on OTN. Below is the link for the listing of top 10 webcenter articles on OTN.

https://blogs.oracle.com/archbeat/entry/top_10_otn_webcenter_articles

Congrats to all the persons whose article is there on the list.

Its Good to close 2014 on a Happy Note :)

Have loads of fun on New Year Eve and may you have an awesome 2015.

See you guys in 2015 with next post.

Thanks

Monday, December 22, 2014

Custom Exception Handling in ADF - Model Layer Generic Framework Design

I have observed that there are lot of users who asks questions on OTN and have problem in designing the custom generic exception handling framework. So in this and next some of the posts I will be describing how we can lay down a generic way to report custom exceptions to the page. These custom exceptions may be mostly for Business Specific errors for which we need to display a custom user friendly message on the page to the user.

In this post we will be seeing how we can customize the error on Model layer and take error messages from a resource bundle defined in the application.

Lets get started. We will first create a generic framework project where we will add exception handling related classes. We give it a name as FrameworkUtil. Framework util project will be dependent on model project from where custom Exceptions will be thrown in the enterprise applications.

First lets set up FrameworkUtil project - ADF Model Project