Saturday, July 26, 2008

UKOUG 2008 Conference

I was informed this week, my paper - ADF Task Flow - Based On Practical JDeveloper 11g Experience is selected for UKOUG 2008 Conference (1st - 5th December 2008, ICC, Birmingham).

Really good news for me and I was happy to hear because this year it was high competition for abstract selection, read Grant Ronald blog post - UKOUG Paper selection bun fight.

During my session I will talk and will demonstrate how we are using ADF Task Flow features in our projects. You should expect deep technical level presentation, see you there in December ;-)

BGOUG Autumn' 2008 Conference

I was in Bulgaria last year Sofia - Beautiful City and this year I'm going again. I'm invited to deliver presentation on BGOUG (Bulgarian Oracle User Group) Conference during October 24th - 26th in Bansko.

My session title - Business Rules Implementation with JDeveloper/ADF 11g. Main problem that will be addressed in this session is about how to map business rules implemented in Oracle Forms to Model-View-Controller (MVC) architectural pattern. I will give clear understanding about common business rules in Oracle Forms world and how to develop those rules in J2EE world with ADF Business Components in Model layer, ADF Task Flow in Controller layer and ADF Faces Rich Client in View layer.

Wednesday, July 23, 2008

ODTUG 2008 Gallery from Frans Thamura

It was great time on ODTUG Kaleidoscope 2008 in New Orleans this year. Frans Thamura, Oracle ACE Director and friend from Indonesia, have posted on his blog pics from this event - ODTUG 2008 Gallery. Enjoy ! :)

Sunday, July 20, 2008

Import Functionality in Oracle ADF BC

By default, when you create new application in JDeveloper based on Fusion Web Application (ADF) template, two projects are generated - Model and ViewController. However, very often in real projects its not practical to have all ADF BC components just in one Model project. With one very big Model project it becomes quite complex to maintain application and usually when there are let's say around 200 components in one Model project, tool starts to work more slowly.

So, as you probably understood, there is a best practice to separate Model project into smaller projects and reuse ADF BC components across those projects. Goal of this post will be to tell you how to do Model project splitting. You can download sample application I have developed - ADFBC_Import.zip. As usually, this application is based on standard HR schema, available in Oracle XE database.

Developed sample contains three projects - Model, ModelShared and ViewController:


ModelShared holds one EO - Countries, this component will be imported into main Model project. In order to import and use Countries in separate Model project, we need to build JAR file for ModelShared:


Only Countries EO and ModelShared.jpx (describes ADF Business Components in current project) will be included into JAR file:


When Deployment Profile is declared, just build JAR file for ModelShared:


Now, we can reuse Countries EO in main Model project, and build Associations, View Links, View Objects based on imported Countries EO, even it is not visible in current project structure:


Import is done in Model.jpx, ADF BC description file, by adding JAR file with ModelShared project:


When import will be done, you can see imported Counties EO in all ADF BC wizards for Model project. For example, its possible to create Association between Regions and imported Countries:


Its possible in standard way to create VO based on imported EO:


Data Control structure in Application Module also can reflect Master-Detail relationship between normal VO (RegionsView) and VO (CountriesView) which based on imported EO:


And finally, everything works on single Web page: Master-Detail relationship between Regions and Countries:

Saturday, July 12, 2008

Customizing Applications with MDS - Practical Overview

During ODTUG Kaleidoscope 2008, I was discussing with Shaun O'Brien (Principal Product Manager from Oracle Development Tools group) about new functionality offered in JDeveloper 11g - development of customizable applications with MDS. This functionality is very critical for us - consultants, because its very common requirement when there is a need to have the same application but with smaller or bigger differences for different clients. In this blog post, I will not describe how to enable MDS functionality in your application, because you can find all needed information for this topic on OTN, read this Cue Card - Customize and Personalize an Application. What I will show in this blog, is how you can apply MDS in your project from first day - develop customized validation rules.

My blog post is based on sample application I have created - MDSValidation.zip. MDS functionality is enabled based on the steps provided in Cue Card I have mentioned. In order to run this application in your environment, you will need to deploy a customization class - right click on Model project, and select Deploy -> to JAR file. After JAR file will be created, ensure it is available in JDEVELOPER_HOME\jdev\lib\patches\ directory.

Developed application don't use any customizations in ViewController layer, only in Model. When I was developing it, at first I have generated ADF BC, have created ADF Task Flow and implemented JSPX page - nothing new, just common steps. When application was done, I decided to add 2 profiles - headquarters and remoteoffices. With headquarters profile active, validation rule is applied for Salary attribute in Employees entity. With remoteoffices profile active, no validation rules are applied. So, first things I did - I have deployed and registered customization class - SiteCC. Also have created customization.properties file, where active profile for my application is set:


After those 2 things were done, I have switched my JDeveloper 11g TP4 to Customization Developer role, in order to apply specific validation rule for headquarters profile:


JDeveloper 11g have restarted in order to apply required settings and I got Customizations Property tab available:


With headquarters role selected, I have opened Employees entity object wizard and defined specific validation rule on Entity level in order to compare Salary value with Minimal and Maximal salary values allowed for specific Job assigned for Employee:


When this rule was defined, metadata file related to headquarters role was created by JDeveloper. This metadata file contains customizations applied for selected role:


Ok, validation rule specific for selected role is defined, now we can switch back JDeveloper 11g to Default Role mode:


When JDeveloper 11g restarts in Default Mode, you can open Employees entity object wizard again, and check Validators section - no Validation rules. Its because, we have defined validation rule only for headquarters role and customizations are applied not only on runtime, but in development mode also:


When application will be deployed in production, its enough to set profile information in customization file:


And since there are no validation rules defined for remoteoffices profile, there is no validation applied for Salary attribute:


But, if second deployment will have different setting in customization file:


Validation rule defined for headquarters will be applied:


Looks like MDS is really very powerful feature in new JDeveloper release - JDeveloper 11g.

Saturday, July 5, 2008

Declarative Security in JDeveloper/ADF 11g

In JDeveloper 11g, with a help of Oracle ADF framework you can in easy and straightforward way add security to your application. And this way is based on declarative approach, no coding is needed. Main goal of this post is not to describe about how to configure security, but more about how it can be applied in your applications.

Let's take a case when there is a requirement to open the same form in different modes (editable/read-only) for users with different sets of roles assigned. With JDeveloper 11g you can implement this requirement in 3 quick steps. I will describe those steps here, also you can download developed sample application - DeclarativeSecurity.zip. In order to run this sample, you need to have standard HR schema in your database. Additionally, you need to use this system-jazn-data.xml file, where two users are defined - john (managers) and scott (clerks). For both users password - welcome is defined.

Three steps you need to use in order to implement declarative security:

1. Entity Object level security

This step will allow to secure row data. In Entity Object wizard, define Security Operation Mapping. I have secured two standard Actions - Update and Delete for Jobs Entity:


When security options are defined, specify authorization for Jobs Entity. In my sample, I allowed Update and Delete actions only for users with managers role:


2. Page Definition level security

In this step we will secure Actions defined in Page Definition:


Example of Security definition for Delete action:


In Authorization settings, I have specified Delete action availability only for managers role:


3. Expression Language

And last step is to specify using EL, disabled property for button component. This will allow to have button in disabled state, when user is not authorized to perform associated action. EL expression is pointing to Action security in Page Definition:


All 3 steps are explained, now will show how it works. At first, let's login as scott user, this user have clerks role assigned:


Security definition in Entity Object makes row data read-only, since clerks are not allowed to modify it. Delete button also appears disabled:


But, what is nice, when Search Find button is pressed, Oracle ADF automatically puts form into Find mode:


And finally, when entering using john account:


Since john is granted with permission to update and delete existing rows, form appears in edit mode with Save and Delete buttons enabled: