Skip navigation.

Andrejus Baranovski

Syndicate content
Blog about Oracle technology
Updated: 37 min 50 sec ago

Versioning Navigator in JDeveloper 11g R1 PS1

Thu, 2009-11-26 09:36
Just a quick note about Versioning Navigator in JDeveloper 11g R1 PS1 - its not removed, it still here ;-). If you will not be able to find it, you should keep in mind that it is moved now to View -> Team -> Versioning Navigator menu:


CRUD Operations in Oracle ADF 11g Table Using PopUp Component

Wed, 2009-11-25 13:55
I was blogging on previous week about how to implement CRUD operations in table component using external dialog framework (new feature in JDeveloper 11g R1 PS1) - CRUD Operations in JDeveloper/ADF 11g R1 PS1 Table Component. I got several questions from my readers about how to catch dialog Cancel event when using inline windows through external dialog framework. However, there is no Cancel Listener available for external dialog framework in this release, so its not possible to catch Cancel event. In some specific use cases it can create problems, because we want to execute Rollback when user is closing dialog by pressing Cancel button. On other hand, af:popup component have Cancel Listener, today I will show how you can use af:popup for CRUD operations in Oracle ADF 11g table.

Download updated sample application - TableDialogEdit2.zip, this sample based on my previous post mentioned above. The key difference is that now I'm using af:popup to show currently edited or newly inserted record. Editing case:



Data is edited and changes are commited to database using OK button:



If user would press Cancel, (X) or Escape keyboard button - Rollback action would be triggered. Same applies when inserting new record:



If we will take a look into source code, we will see that I have created af:popup and this component is opened through af:showPopupBehavior operations declared for Insert and Edit buttons:



Popup component itself is defined with lazyUncached content delivery and two listeners - PopupFetchListener and PopupCanceledListener:



First one is invoked during popup opening and is used to trigger Insert mode when it is needed. And second is triggered when user wants to dismiss editing dialog. Editing dialog is based on DialogListener, where Commit or Rollback operations are called:



The main trick with af:popup component usage is on Insert. The problem is, when you define af:showPopupBehavior, framework will not execute Action or ActionListener defined for the same button. So, I'm calling CreateInsert operation from PopupFetchListener, during that moment when popup is rendering. This allows to make it work for Inserts through af:popup component. Additionally, I'm doing a check there and invoking CreateInsert operation only when Insert button was pressed and not when Edit:



DialogListener invokes Commit or Rollback operations based on user action:



PopupCanceledListener is extremelly helpful and is triggered when user is closing dialog with (X) or Escape keyboard button:


Integration in Oracle ADF with ADF Task Flows and ADF BC Imports

Tue, 2009-11-24 07:33
Inspired by a question about LOV reusability from one of my readers, I decided to post one more blog in integration series. Today I will refactor application and extract shared entity into common Model project, I will create shared LOV component as well. You can read my previous postings for the same topic from this blog - Building and Integrating Oracle ADF 11g Applications with OjDeploy Utility. I will describe how you can reuse your Model components from shared projects using ADF BC Import functionality (Import Functionality in Oracle ADF BC).

Download updated application - ADFIntegration6.zip. This sample contains one more project - CommonModel. It contains shared EO for Department and one LOV VO.

Originally, I had following Model structure for LocalApp application:



And following Model for RemoteApp application:



Let's say I got a requirement to join Employees VO in RemoteApp with Department table and declare LOV component on DepartmentName attribute. This means I need to have Departments EO available in RemoteApp. However, I already have this EO in another LocalApp application, if I will create again in RemoteApp it will be duplicate. This means I should extract Departments EO from LocalApp into common project and use it through ADF Library JAR import. I have created common Model project and declared Department EO there along with LOV component for Departments:



I deploy CommonModel project into ADF Library JAR as it is described in my post above and import it into LocalApp through Business Components Imports:



Now I can remove Departments EO from LocalApp Model and use it through imported library. You can see that Departments EO is included now from com.redsamurai.model package:



The same for RemoteApp project, I have included there same ADF Library JAR:



And I can use shared Departments EO in Association relationship between Departments and Employees EO's:



Probably you already noticed that LOV component is imported together with EO:



Then I can use it while declaring LOV for DepartmentName attribute:



Finally, before running my application, I will update its skin setting to fusion. My original application was developed with previous JDeveloper release, however I want to use new skin, I can change it trinidad-config.xml file:



On runtime I can see Employees table joined with Departments and DepartmentName LOV column rendered:


Tree Table Component in Oracle ADF

Mon, 2009-11-23 14:02
I want to share today, how we are using Tree Table components in Oracle ADF. Sure, you can implement Tree or Tree Table just by reading Oracle JDeveloper 11g documentation. However, I will try aggregate different information and to put all pieces together, in order to help those developers who are just starting to use Tree components and are curious how things work. My today post is based on information from Frank Nimphius article available on ADF Code Corner - How-to access the selected row data in a TreeTable or Tree.

Download sample application developed in JDeveloper 11g R1 PS1 - TreeComponents.zip. In this sample I'm using two Tree Table components, second is dependent on first. Dependency could easily work through View Link Master-Detail relationship, but I decided to make use case a bit more complex and to filter second Tree Table from Selection Listener method. Also, I decided to include editable fields into both Tree Table components.

First Tree Table represents three level Master-Detail relationship between Regions, Countries and Locations. Second Tree Table is Master -Detail between Departments and Employees:



Its worth to mention, that Departments VO contains Bind Variable and Where clause, this allows me to filter second Tree Table from first Tree Table Selection Listener method:



On the layout side in ViewController, I have used Panel Dashboard (new component in JDeveloper 11g) - it allows to align your panels with Tree Table components in very easy and elegant way:



When you decide to create Tree or Tree Table, you should drag and drop from Data Control only Master VO. From a wizard you can add Tree Levels (VO details) and specify attributes to be shown on each level:



When Tree Table will be generated, if you want to have multiple columns, you should add Column components manually and define output/input components manually. Make sure you are assigning correct values from node binding (see my sample application):



Second Tree Table is refreshed based on selection changes in first Tree Table, this means we should declare Partial Trigger dependency:



We override default Selection Listener on first Tree Table in order to perform filtering on second Tree Table component:



In Selection Listener I'm using Java code from Frank Nimphius article mentioned above. I'm accessing currently selected row and if this row belongs to third level (Locations), I'm filtering second Tree Table:



On runtime you can see how nicely Panel Dashboard allocates two Tree Table components in Panel Boxes:



Expanded Tree Table view, with editable columns:


Building and Integrating Oracle ADF 11g Applications with OjDeploy Utility

Thu, 2009-11-19 07:28
While attending Steve Muench session on OOW'09 I learned about Oracle Fusion Applications Teams' Best Practices. One of the things I was very interested - ojdeploy utility usage in automatic builds. In our project, we are building and maintaining custom Ant scripts to generate EAR file and to deploy it to WLS. However, it creates a lot of extra work, especially while migrating from one Oracle ADF release to another. Some customers are considering to use Maven Integration in JDeveloper 11g R1 PS1 (see article) for integration builds. But, while designing your integration build architecture, you should not forget about powerful ojdeploy utility offered by Oracle and shipped together with JDeveloper 11g. From my point of view, main strengths of ojdeploy are the following:
  • You can build deployment package directly from command line, same as it would be build using JDeveloper 11g wizards
  • Oracle ADF library references are resolved automatically, this means you dont need to maintain complex Ant scripts
For today post I have decided to use application from my previous post - Integration in Oracle ADF with ADF Task Flows and Shared Java Classes. I have created ojdeploy script for this application, you can download complete sample - ADFIntegration5.zip. More info about ojdeploy utility you can find from Steve Muench blog post.

Sample application is based on 3 applications, one of them is main application. First are build two dependent applications and then EAR file is produced based on main application. In the script you need to point to appropriate deployment profiles to be invoked for each application:


Invoke ojdeploy utility from command line (ojdeploy -buildfile ojdeploy-build.xml) and all three applications will be compiled and packaged automatically:


EAR and WAR files are generated for main application, along with ADF Library JAR files for dependent applications:


In order to build and integrate my application, I have defined following deployment profiles:


ADF Library JAR deployment for first dependent application.


ADF Library JAR deployment for second dependent application.


WAR deployment profile for main application.


EAR deployment profile for main application.

CRUD Operations in JDeveloper/ADF 11g R1 PS1 Table Component

Tue, 2009-11-17 02:01
While working on the customer side during last week, we have discussed a use case where user works with read-only tables and performs data editing through inline popup. In ADF 11g you can use clickToEdit editing mode for a table component in order to improve rendering performance. With this mode table will be rendered as read-only, but user will be able to edit rows by double clicking on current row. However this case was not suitable for the client, they wanted to edit and insert new rows in inline popup, mainly because there will be additional editable columns. We have tried to implement this requirement in JDeveloper/ADF 11g R1, using af:popup component, but it was not working for insert mode. Same week we got new Oracle JDeveloper release - JDeveloper 11g R1 PS1, and new functionality that allows to open ADF Task Flows as inline popups (read Frank Nimphius blog post - JDeveloper 11g R1 PS1 New Feature: Launching DHTML popup dialogs using the external dialog framework). In this blog post I will describe how you can enable CRUD operations in table component using ADF Faces external dialog framework.
Download sample application with implemented CRUD functionality - TableDialogEdit.zip. This sample provides a table component, with implemented Insert, Edit, Save, Delete and Undo functionality:

Table is read-only, Insert and Edit operations will be performed through inline dialog. User can select a row and by pressing Edit, will open a dialog to edit data:

When user will press Close button inside inline dialog, Dialog Return Listener method will be invoked to refresh parent table, see code in managed bean. Data in parent table is refreshed, user can commit his changes by pressing Save button or revert by pressing Undo:

In similar way, user can create new row by pressing Insert, blank row will be opened in inline dialog:

User can insert data, and close inline dialog with Close button:

Previously inserted blank row will be refreshed with entered data, same as in editing case user can commit or revert it:

I have implemented this functionality based on information from Frank Nimphius blog mentioned above. From main page located in ADF Unbounded Task Flow, I'm calling ADF Bounded Task Flow where editing JSPX page is implemented. If Insert button was pressed, before calling ADF Bounded Task Flow, CreateInsert operation Method Call is invoked:

Call for ADF Bounded Task Flow is defined to run as dialog and to be displayed as inline popup:

This allows us to open standard ADF Bounded Task Flow as inline dialog:

On the main page, table panel collection contains five buttons, two of them - Insert and Edit are opening inline dialog for data editing:

Those two buttons should be configured to open inline dialog, by setting UseWindow, WindowEmbedStyle and WindowModalityType properties accordingly:

Travel to South Africa

Sun, 2009-11-08 10:23
Yesterday I have started my trip to South Africa, and today I'm here - Hi Africa! I will deliver ADF 11g training and consulting in Johannesburg.
I was flying through Paris Charles de Gaulle International Airport, I was impressed by its architecture style:

Here is a place near my hotel in Johannesburg suburb, its build in old Italian style:

And its summer here now, all green:

Entertainment here is also good :)

Defining the LOV on a Reference Attribute in Oracle ADF 11g

Fri, 2009-11-06 06:59
Yesterday I got a question from my blog post reader about LOV components, about how to use LOV components on a reference attributes. Actually, its quite common requirement to have reference attribute shown in LOV, and not its code. I knew it from before, this functional requirement can be implemented in ADF 11g, Steve Muench described it in Oracle Magazine article year ago. However, I decided to implement sample application for this requirement and to give more light on this topic.
Download sample application - LOVByName.zip. It is based on instructions from Steve Muench article mentioned above.
I'm talking here about LOV, where description text is used directly in LOV component, and code is not shown:

User can select value from LOV popup:

And return it back:

So, what you need to do in order to make it work this way. Actually, nothing new comparing to LOV with code value. As usual, include reference attribute, key attribute will be added automatically:

Those attributes are added as reference attributes, means not updateable:

Main thing here is to declare LOV on reference attribute - JobTitle:

You should set JobTitle as LOV attribute and additionally return real key attribute - JobId:

Calling Custom Entity Method From View Object Implementation Class

Thu, 2009-11-05 02:42
Few days ago I got a question from one of my colleagues about how to call custom method from EO implementation class. Colleague wanted to call this method from VO implementation class. I would not recommend you to follow this approach, because instead calling method in EO, you can invoke same code in VO row implementation class. But yes, exist different use cases and sometimes you may need to call EO from VO. In this post I will describe how you can do this.
Download sample application - CallingEntityMethodFromView.zip, this sample implements Java classes for EO and VO.
In EmployeesImpl.java, implementation class for EO, I have created simple custom method - calculateEmployeeRate(). This method multiplies salary with commission value per row:

Then you need to create VO and VO row implementation classes:

Create method in VO implementation class. This method should accept a row, based on this row it will retrieve EO implementation class and invoke custom method available there:

In order to make it work from ViewController, expose method you just created in VO implementation class through Client Interface:

Any exposed method can be declared in Page Definition. Pay attention for parameter value, I specified to accept current row. This means method in VO implementation always will get current row and based on it will invoke my custom method in EO:

On runtime, press Calculate Rate button that invokes custom logic in Model, and you will get result:

Groovy Validation Hint in Oracle ADF 11g

Wed, 2009-11-04 04:40
There is one very powerful option for Groovy validation in Oracle ADF 11g. This option is somehow hidden from developers and quite often not used. I decided to blog about it, in order to put some light on it. This option is about how to get old and new values for edited attribute. Groovy provides two reserved keywords - oldValue and newValue, you can use those keywords while writing Groovy validation script.
Download sample application - GroovyValidation.zip. This sample implements pretty simple validation rule, to demonstrate how you can use mentioned Groovy keywords:

Reserved keyword oldValue is used to implement validation logic:

Developer can specify token method expressions in validation failure message based on the same oldValue and newValue:

On runtime, if validation rule will fail, it will show current wrong value. If you will not use newValue, it will show currently in database stored value, which is not correct.

Business Logic Groups in Oracle ADF 11g

Tue, 2009-11-03 06:10
I was reviewing Business Logic Groups functionality in Oracle ADF BC and was getting problems - correct Business Logic Unit wasn't invoked when needed. Its because I misunderstood documentation, and was trying to configure discriminator property for attribute. Its seems everything much more simple, you just need to specify discriminator value in Business Logic Unit name. Thanks to Steve Muench for this pointer. Actually, there is a tip in documentation as well, which I skipped while reading - 4.8.2 How to Create a Business Logic Unit.
Download sample application with working Business Logic Group defined for Employees EO - BusinessGroups.zip.
In order to define Business Logic Group, you need to specify which attribute from EO will be used as discriminator to choose between available Business Logic Units:

Next step is to define Business Logic Unit. Its very important at this step to enter correct Unit Name. It should reflect discriminator value for this Business Logic Unit. In my case it is IT_PROG, for employees working as programmers. It is a place where you need to specify discriminator:

In sample application I have created two Business Logic Units, one for IT_PROG and another for ST_CLERK JobId's:

In Business Logic Unit, you need to override attributes you want to change. Then you can change those attributes properties, add validation rules. In this example I have created validation rule for overridden Salary attribute:

Another validation rule for Salary attribute is defined in ST_CLERK Business Logic Unit:

I have specified different Salary attribute labels for IT_PROG and ST_CLERK Business Logic Units:

Additionally through Business Logic Unit you can implement custom behavior in Business Logic Unit Java class:

On runtime you can see Business Logic Group related behavior for IT_PROG:

And for ST_CLERK:

Oracle ACE Presentations on Google Advertisement

Mon, 2009-11-02 12:53
Its fun, today while reading my email, I saw Google advertisement about Oracle ACE presentations on Oracle OpenWorld 2009:

It points to Oracle ACE Materials on OTN. Thanks to OTN team !

SOA Advisory Board and BMW Oracle Racing

Sun, 2009-11-01 14:07
Here is a cool pic from SOA Advisory Board in Oracle HQ, Redwood Shores. You can see me also on a boat:
It is taken by Juergen Kress - SOA Partner Adoption blog.

How To Refactor Page Definition Files in JDeveloper 11g

Fri, 2009-10-30 03:34
You probably have noticed, if there is a custom folder structure in Oracle ADF ViewController project, newly generated Page Definition file always is placed in default location no matter where JSF page resides. I have heard, in next releases Oracle will generate Page Definition files based on JSF page package structure. However, now instead refactoring manually, we can use JDeveloper 11g automatic refactoring for Page Definitions.
Let's say developer creates Method Call in ADF Task Flow, this call invokes action from bindings - Create:

This means associated Page Definition file will be generated:

Its generated in default package location, while we want to have it specific package. We can move it manually, or we can use JDeveloper 11g refactoring functionality. Just select Page Definition file you want to move and from Refactor menu invoke Move command:

Page Definition file will be successfully moved to location you want and required changes will be done in DataBindings.cpx file as well:

How To Solve java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet

Fri, 2009-10-30 01:59
While developing and deploying our Oracle ADF application on embedded JDeveloper 11g WLS (WebLogic Server), couple of times we have experienced strange WLS behavior. When developer was trying to run application from JDeveloper 11g IDE, after WLS server was starting up, application deployment was failing with following exception - java.lang.ClassNotFoundException: javax.faces.webapp.FacesServlet.

When we first encountered this exception, we didn't found any solution except just to do fresh check-out from SVN. After fresh check-out, application was running perfectly - strange things happen, there is always some magic ;-)
Later we found real cause for this deployment exception. We found solution as well, but still we didn't found exact scenario how to reproduce it in sample application, if you know scenario - feel free to post in comments. Now I will describe the reason and solution for this exception.
Exception happens, because for some unknown reasons, JDeveloper 11g IDE in very rare cases generates ViewController files in Model project:

This happens automatically, even when developer is not doing any work in Model. And then during deployment, WLS finds ViewController files in Model. And since Model don't have appropriate JAR libraries on class path (for absolutely logical reasons), it throws exception about javax.faces.webapp.FacesServlet not found:

In order to fix this exception, just go to file system and remove public_html folder from Model project:

Now go to your Model project, refresh it - not needed Web Content is gone:

When Web Content is removed from Model, you are ready to deploy and run your application again.

Integration in Oracle ADF with ADF Task Flows and Shared Java Classes

Mon, 2009-10-26 04:20
I continue a series of posts about Oracle ADF application structuring, splitting and integration. You can read my previous hints and advices from this blog post - Integration in Oracle ADF with ADF Task Flows and Common Files. Today I will show, how you can reuse Java classes through project dependencies.
Download updated sample application - ADFIntegration4.zip. I have updated it with one more application - SharedApp, where I have extracted common Java classes I have used previously - JSFUtils and ADFUtils. Lets see how it works.
First, I have application where I'm using common Java classes - JSFUtils and ADF Utils:

There are more applications in my infrastructure, and all of them are using same classes. You can imagine, if we need to do change in those classes, we will need to replicate it across all infrastructure. In order to avoid this, we would prefer to keep those classes in unique physical location, so when there will be any change it will be propagated automatically - since all applications are pointing to the same location.
Lets refactor applications and extract common Java classes into separate project. I will delete local common files and will copy them to SharedApp application, Shared project:

When refactoring is completed, I can come back to original application and add project from SharedApp application, yes we can add project even from different application:

Shared project is added, I can see common Java classes are there:

When we have Shared project added, one thing we need to do, is to specify ViewController project dependency on external Shared project:

Dependency is set:

ADFUtils are now imported from shared location:

Its important to mention, when you will generate ADF Library JAR from your application, classes included through dependency will not be included into JAR package. This means, you will need to enable same dependency in your master application - in order for common Java classes to be loaded on runtime.

Hajo blogs about SOA Manifesto

Mon, 2009-10-26 02:10
Fellow Oracle ACE Director and SOA community member Hajo Normann blogs about SOA Manifesto - The SOA Manifesto: Business Value and Architecture First.
Read his article, in order to get better understanding about SOA Manifesto initiative. If you support described ideas, come on board and put your virtual signature.

Integration in Oracle ADF with ADF Task Flows and Common Files

Fri, 2009-10-23 13:22
While I was on Oracle OpenWorld'09 last week, I heard lots of questions about how to split and integrate Oracle ADF applications. It seems quite hot topic now on the market, mainly because many people started Oracle ADF 11g projects recently, and now they are in a phase when applications are growing and becoming large. Naturally, when application growing, its harder to control it and keep performance on suitable level. In my project - Slides: Oracle ADF 11g Production Project Experience, we did application splitting into smaller applications and this helped us to keep development performance on solid level. Because splitting/integration topic is hot, I decided to continue a series of my posts and describe how you can reuse common files across splitted applications. Check my previous posts for the same topic:
  1. Integration in Oracle ADF Through ADF Libraries and ADF Task Flows
  2. Integration in Oracle ADF with ADF Task Flows and ADF Security Configuration
I have developed sample application for today post - ADFIntegration3.zip. This application is based on applications from my previous posts mentioned above. It contains one new application called CommonApp, I have created there property file with internationalization support and simple Java class to get currently logged in user name:

Java class and labels will be reused in all three splitted applications. Main strength - common files will be included into different applications, however physically those files will reside on one location. This means, no matter from which application common files will be modified, other applications will be updated with this change automatically.
Common Java class - SecurityUtils.java and file with labels - ButtonsBundle.properties are included into LocalApp application structure:

Same files are included in RemoteApp application structure:

In order to include Java classes, its enough to put Java class files from separate application on your current project Source Path - point to src folder:

Regarding label bundles, additionally I would recommend to register reusable bundle in Bundle Search window, this will allow to use bundles available on Source Path directly through Set Text wizard when assigning labels:

With registered bundle, you can use labels from bundles available in separate applications and declared on project Source Path, same as they would exist in your current project - through Select Text Resource wizard:

You can use common Java classes, by declaring Managed Beans for example. In all three applications I have declared securityUtils bean, its based on common Java class from separate application:

I can use this bean as usual, through Expression language:

On runtime, when I'm running integrated application, I can see labels are assigned properly, current user name is returned correctly from securityUtils bean as well:

Same thing works well in integrated application, common labels are visible and Managed Bean logic is executed:

OOW'09 Video: Oracle ADF: Oracle Fusion Applications Teams' Best Practices

Mon, 2009-10-19 19:52
For those who missed Oracle OOW'09, you can watch my video recordings for Steve Muench session - Oracle ADF: Oracle Fusion Applications Teams' Best Practices. You can download slides from Steve Muench blog. Thanks to Justin Kestelyn and his approval to post those videos.
Part 1:


Part 2:


Part 3:


Part 4:


Part 5:


Part 6:


Part 7:

OOW'09 Video: An Architect's View of the New Features of Oracle SOA Suite 11g Release 1

Sun, 2009-10-18 11:16
Here is my video recordings of Clemens Utschig (Sr. Principal Product Manager, SOA Architect at Oracle Corporation) session on Oracle OpenWorld'09. I enjoyed his talk and demos, he gave great and clear overview for Oracle SOA 11g.
Part 1:

Part 2:

Part 3: