Tuesday, November 27, 2007

JDeveloper 11g - Create, Edit and Delete operations in ADF Faces af:table component

In this post, I have decided to implement JDeveloper 11g Technical Preview 2 sample application, based on one of my most popular blog post - Create, Edit and Delete operations in ADF Faces af:table component. I already received several requests to provide sample application for similar functionality in JDeveloper 11g, so here it comes.

Developed sample application EditableTable11.zip, provides read-only table with those actions - Delete, Create, Edit, Save, Cancel. Row selected for editing is shown in editable mode and can be updated. Application is based on HR schema that comes with Oracle XE database. Application logic is based on Jobs entity from HR schema.

This sample is developed using the same principle as described in my previous post. I will describe what are the differences in implementation:

1. In JDeveloper 11g CreateInsert operation is not hidden anymore, you can use it directly from Data Control. This operation is used to create new row in table:


2. In From field of af:setActionListener, defined for Edit button, is used access to row - #{bindings.JobsView1Iterator.currentRow}, instead of access to individual column - {row.JobId}.

3. isEnableEditing() method in ValueHolder.java is changed, new code:


What's the difference here? First thing - since ValueBinding is deprecated, I'm using ValueExpression to access column value in a table. And second - I'm using oracle.jbo.server.ViewRowImpl to hold selected row.

How it works? JDeveloper 11g comes with ADF Faces Rich Client, it gives new level of usability in Web applications - you will notice this immediately. Create functionality is invoked by pressing Create button:


When data is entered, Save button allows to store information into database:


There is no more ugly radio button components for row selection, you can use just your mouse to select any row for editing:


And finally, several words about some of new features available in af:table component that comes with JDeveloper 11g ADF Faces Rich Client. First feature - standard functionality allows to rearrange columns in a table on runtime:

Filter can be used, to execute search directly in the table:


And, when let's say wrong input is provided, nice error message is shown at the same time when new value is typed:


I'm sure, you will like af:table component that comes with JDeveloper 11g ADF Faces Rich Client ;-)

Tuesday, November 20, 2007

Oracle JDeveloper/ADF Real Life Story on Oracle OpenWorld

Yes, that right - I was presenting Oracle JDeveloper/ADF Real Life Story on Oracle OpenWorld in Unconference section. Everyone was free to come and listen hints I have delivered for Oracle JDeveloper/ADF development based on real life experience. Based on feedback received from auditory, I think session was successful.

I have started session with presentation based on this outline:
  • About Oracle ACE Directors
  • J2EE Development - JDeveloper 11g and Oracle ADF (future book)
  • Oracle JDeveloper/ADF in IBM GBS Norway
  • Real Development with JDeveloper/ADF
  • Demo of Sample Applications from http://andrejusb.blogpost.com
  • Technical Resources
Yes, I'm writing now book about JDeveloper 11g and ADF. This book will based mostly on practical material. I have presented with several slides my current project in IBM GBS Norway and turned to main part of session - Real Development. In this part I was developing Web application with JDeveloper and ADF just on the fly, at the from of auditory. Application development from beginning to testing took for me 45 minutes. And lastly I presented my blog and have talked about technical resources each JDeveloper/ADF developer should know and use in his daily work.

In this post I want to concentrate on application I have developed during real time development. Developed application - OOWUnconference.zip is based on standard HR schema available in Oracle XE database, application contains 3 Web pages - for viewing and editing data from JOBS table, and also for viewing data from EMPLOYEES table.

I have developed this application based on those steps:

1. I created Business Components diagram. I was using declarative approach to create Model layer. Jobs and Employees entities were added to the Model declaration:


2. Second step was to show how test created Model layer with ADF BC Test utility that comes with JDeveloper:


3. Next step was to show how to add validation logic. Jobs entity object was chosen, I added and tested validation rule for MinSalary attribute:


4. When Model layer was done, I moved to ViewController and have created there page structure along with navigation:


5. First page I developed was - jobs.jspx. This page contains one read-only table and two buttons according to logic defined in faces-config.xml file.


6. Second page was editJob.jspx. This page provides a form for data from Jobs entity editing:


7. Third page - employees.jspx. Here employees who belong to specified job are listed in the table:


8. And of course I have tested validation logic in editJob.jspx page, it worked good:

However, there was a question from auditory about how to make Back button work in a case when validation error is displayed. Hint - you should set Immediate=true for Back button:


9. Ok, everything works fine, but one thing is not ok. If you have noticed, it is possible to update minimal salary with some value, even higher comparing to salaries of existing employees. That not good, and I have implemented solution for this as well. At first, I have created new read-only View object that select all employees with selected JOB_ID and SALARY lower comparing to provided value:


10. When View object was created, I implemented custom method in Application Module. This method is used to execute read-only View object and to return result to ViewController:


11. In ViewController I have created methodAction declaration for checkEmployeeSalary method and in editJob page backing bean implemented a call to defined methodAction:


12. Now second validation rule is also implemented:


Oracle OpenWorld was great event, with two Larry Ellison keynotes and a lot of technical material in Oracle Develop. I even don't talk about entertainment part, it was amazing. See you next year in San Francisco ;-).

When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.

Thursday, November 15, 2007

Blog on iPod Touch

It's how my blog looks on iPod Touch from Apple :-)

Monday, November 12, 2007

Oracle OpenWorld Unconference - Presentation Time

I have registered today my presentation time at Oracle Unconference:

Session Title : Oracle JDeveloper/ADF Real Life Story
Time : 3PM
Date : Wednesday, November 14
Location : Moscone West 3rd Floor Overlooks
Room : 1




You are welcome, see you on Wednesday ! ;-)

San Francisco - Oracle OpenWorld

Today is my first day in San Francisco, Oracle OpenWorld Conference. It's amazing, city lives with Oracle spirit during conference days.


My day have started with presentation - Integrating Spatial into Enterprise with Standard Frameworks, I have delivered this presentation at Oracle Spatial SIG meeting. Right after it I was participating in Oracle ACE Director briefing. Topics covered there:
  • Oracle Fusion Middleware Platform Overview
  • Grid Enabled SOA. What's New in SOA
  • Oracle Identity Management
  • Oracle WebCenter
  • Oracle ACE Director Roundtable Discussion
  • Oracle Database Briefing

Monday, November 5, 2007

Presentation at Oracle Spatial SIG during Oracle OpenWorld

During Oracle OpenWorld in San Francisco I will participate in Oracle Spatial SIG meeting. My presentation title - Integrating Spatial into Enterprise with Standard Frameworks. It will be focused mostly on demonstrations of my blog content about JDeveloper, WebCenter, and MapViewer. I will show and explain how Oracle Spatial plugs into Oracle Fusion Middleware.

Meeting time: Sunday, November 11th at 10:00 am - 11:30 am
Meeting place: Moscone West, San Francisco, CA
Room: 2008
Session Code: S292934

Friday, November 2, 2007

Calculated Column in ADF Faces af:table Component

It happens that sometimes you need to implement calculated column in ADF Faces af:table column. Value for this column is calculated based on values in other columns. There could be many approaches to achieve this, as one of the most simple I can suggest to add calculated attribute into View object, on which af:table is based.

You can download developed sample application - CalculatedValue.zip. This sample is based on standard HR schema available in Oracle XE database.

Calculated attribute can be added to View object in two steps:

1. Define new object attribute on View object, just provide name and type:


New attribute will be created as Transient:


2. Generate View Row Class for View object, just by selecting check-box in View Object Editor:


In generated class, edit getSalaryDiff() method and put needed logic here:


When described two steps are done, in Data Control calculated value becomes available and you can use it in your application User Interface layer:


Implemented sample application provides table with calculated value included - difference between maximal and minimum salaries:


When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.