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 - 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 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.


Anonymous said...

Can you provide the DB schema? It seems that employees table you are using is not an existing one under ORACLE DB.

Andrejus Baranovskis said...


You can download HR schema from this link -