ADF: Handling deletion in TreeTables

For the current project that I am working for, we had the requirement to display information in a table that should consist of Master and Detail rows. I knew that there is a component in ADF to solve this requirement quite easily: af:TreeTable.

af:treeTable

So I added my master as a TreeTable component and added the detail as a new level. Under display attributes you can select the attributes that shall be displayed.

Unbenannt

After adding the af:treeTable component you have to adjust the components in your page –

Unbenannt

for example will the added attributes be displayed in one af:outputText component in one node. To change that add new columns to the tree table by performing a rightclick on it -> insert inside Tree Table -> column. You can choose the values by using writing for example:

value=”#{node.Name}”

Hint: In Jdeveloper version 12.1.3 I faced the issue that there was only an autosuggest for the Master attributes. Just type your detail attributes likewise, seems like this is a bug.

Deleting selected row

When it came to deleting rows I had the same problem as probably  many more developers before me: I thought that I can just use the standard delete operation from the bindings. Well that is just working for the master. So I did some research and found following blog entry:
http://www.jobinesh.com/2010/05/crud-operations-on-tree-table.html

The author discribes how to implement methods in the Bean to extract the RowIterator and the key of the af:TreeTable. With that you can implement a method in the model to delete the any selected row and add it as a client implementation.

After that I asked myself, if that was all or if I would have to implement some more. You have to modify your association to be able to delete Master records and cascade the deletion to the details. For that, open the association and click on relationship. Under behavior you find the option composite association & implement cascade delete. When you select this option, the deletion of a master row will result in deleting all child records.

Unbenannt

 

 

 

 

 

 

 

JDeveloper Plugin for Forms2ADF Migration

I’ve migrated my first Oracle Forms module last week. It is the first time for me to be part of a migration project. The colleagues that I am working with instead have a high experience when it comes to ADF and migrating Forms to this technology, while my focus the last couple of years was mostly Oracle Forms. I think that is a possible scenario for many projects, where the aim is to migrate Forms to ADF.

So how can Forms developers start to migrate their application? The first step for me was to gather information on ADF, its architecture and the basics. I tried this with some self training, online materials and the help of my colleagues. When I came to the point to migrate the first module by myself I used the Forms Developer & PITSS.CON to understand how the form worked before and how the workflow was. There are people out there, that tell you that tools won’t do the job for you – and I agree. But they can make your job as a developer much easier. My colleague Mathias Waedt has developed a plugin for JDeveloper, that helps you as a developer when struggling with a migration. It helped me to understand which objects in ADF have been generated and which not. It showed me, were I had to put my effort into. The plugin fetches its information from the PITSS.CON repository.


Unbenannt

When the plugin is started it shows the basic information of the project like the database scheme, the names packages for the different objects (entity objects, view objects, etc.) and some other parameters. With a click on the details tab it is possible to see information of single forms. The form summary tab displays information regarding how many Forms objects already have been transformed to ADF components with PITSS.CON. This gave me a first overview of the upcoming work for that specific module. I saw, that most of the graphical objects were generated and only small modifications  were neccessary here, while I had to modify the business logic that was formerly located in triggers and program units.


Unbenannt2

 

With a click on Form Details it is possible to see which objects have been generated and which not. So for me as a newbie it was a big relief to use this kind of a checklist.


Unbenannt3

You can see all the objects from Oracle Forms and the corresponding generated objects in ADF – with a doubleclick you will directly jump into the generated object (e.g. Java Bean). As a future functionality it is planned to mark the objects that were added by the developer and are considered to be done. So you can work your way through the module without the danger to forget a functionality that was present in Forms up to 100%. The plugin is currently in the beta phase.

ADF Tip: Custom Excel Export Performance

I’ve been working on my first ADF-project the last couple of months and its time for a first blog post regarding ADF-development. We had the requirement to export data from the new developed ADF-Application to Excel. The standard Excel Export functionality was not sufficient, since also the chosen search criteria and other values should be exported, too.

For that purpose we used the docx4j project, with which the manipulation of excel, word and powerpoint files is possible. To export the data from the view objects to the java class that is responsible for creating the excel, the view object class and the view row class was created on view object level. In the view row class we used following code to export the data of the view object:

ModelUtils.getText(writeXML(1, XMLInterface.XML_OPT_ALL_ROWS));

In the beginning the view object had a Master-Detail-Relationship. When testing the export with a huge amount of data we ran into performance issues. We found out, that the relation was the cause of the bad performance and merged the different view objects into one view object – with that change the performance increased a lot. It seems that ADF evaluates all details and concatenates the resulting XML – and that takes time.

So when you have the requirement to export a lot of data and the standard ADF functionality is not enough, keep in mind that the XML-export could cause performance issues due to a Master-Detail relationship.

Useful Resources for ADF Beginners

Autumn is coming and its time to get some lecture for the cold days that are ahead – at least thats what I did to get to know ADF. So in this post I would like to give you some recommendations if you also plan to learn ADF. Since I am new to ADF I asked colleagues and looked around myself to get to know the framework.

Like many I started with reading Grant Ronalds’s book “Quick Start Guide to Oracle Fusion Development” which gives you the basic ideas behind ADF, but as the author and the title states it is a “quick start” and the aim of the book is not to “hold your hand through every keypress”. So if you want dive directly into ADF or to understand the bases, this book is what you are probably searching for. The book uses the OE (Oracle Entry) schema that is available in Oracle databases.

If you search for a complete guided learning path, I would recommend Oracle ADF Real World Developer’s Guide which explains in details how to use ADF business components, task flows and EJBs etc. It is illustrated with many pictures and explanations. I especially like the way the author explains, how the ADF components work together. This book uses the HR schema that is also shipped with Oracle databases.

Also the the ADF Insider Essentials on youtube are worth looking at. They provide a step by step introduction to ADF. So if you don’t need a book in your hands, this channel is a good start.

If you you can recommend any books or know where to find materials & tutorials – please leave a comment.