Friday, December 18, 2009

Developing Large Oracle ADF 11g Applications on ODTUG Kaleidoscope 2010

Good news, my paper - Developing Large Oracle ADF 11g Applications is accepted for ODTUG Kaleidoscope 2010 in Washington, D.C.

During this session I will talk and mostly show how you can organize application structure when developing with Oracle ADF 11g. I will demo ADF Libraries usage for applications integration and will describe various reusability techniques based on my integration posts.

Thursday, December 17, 2009

Reusing Resource Bundles from Different Projects in ADF 11g

I got a question from blog reader about how to reuse Resource Bundles from different ADF BC projects. Actually its quite common requirement, when we were starting with JDeveloper 11g Tech Preview 3 we also wanted to reuse Resource Bundles, however it wasn't working. But good news, it works now perfectly.

Download sample application - MessageBundlesApp.zip, it contains two ADF BC projects (one project shares Resource Bundle with labels and another consumes it).

Here is the answer to my reader - in order to access Resource Bundle that doesn't reside within the current project package structure (Model project in this case):



You need to open Project Properties window for Model project, go to Resource Bundle section and there select second tab - Bundle Search. Press plus sign for Bundle List and choose ModelCommon project, its where your Resource Bundle resides:



Resource Bundle will be included into Bundle List:



After it will be included, you can go and define Label Text for your Attributes:



While selecting Text Resource, from Resource Bundle choice list select included Bundle:



You will be able to select Text Resource:



On runtime it picks correct label:


Friday, December 11, 2009

ADF Security Across Multiple WebLogic Managed Servers

While working with ADF Security I have noticed interesting behavior - if multiple applications are deployed on the same Managed Server, its enough to authenticate and authorize once and then security context will be transfered to another applications (something similar to Single-Sign-On). However, if same applications are deployed on different Managed Servers - user will be asked to enter login credentials again. Let's show this by examples.

I have created Countries application, where I have defined developer and support Application Roles:



Second application - Locations, contains only developer role:



I have configured two managed servers - dev1 and dev2:



Countries application is deployed on dev1:



While Location application is deployed on dev2:



Now I login into Countries with user scott/welcome1:



Both authentication and authorization is successful:



From the same Web browser session I open second application called Locations, and I will be asked now for username and password again:



Let's change target deployment for Locations application to dev1, same target where Countries are deployed:



Now Locations will be opened within the same browser session without asking to provide username/password again:



If I would try to login into Countries with another user, who is assigned with support role, but not developer role:



I will get authorization error while trying to open Locations:


Thursday, December 10, 2009

Oracle SOA 11g Bootcamp In Amman

Tomorrow I'm traveling to Amman (Jordan) for Oracle SOA 11g Bootcamp. I will deliver Oracle SOA 11g training based on the following main topics:
  • Mediators, Adapters
  • BPEL
  • Human Workflow
  • Business Rules
  • JMS
  • Business Events using EDN
  • Service Data Obects (SDO)
  • Oracle Service Bus
And I'm here, in Amman:



Tuesday, December 8, 2009

Solving Error 403--Forbidden in ADF Security

While developing new prototype application, it happened to me to get Error 403--Forbidden, while trying to login into application protected by ADF Security:



Error itself is logical, but in my case I was providing correct username/password, security permissions were defined correctly as well. I did a bit of research and found that weblogic.xml file was generated incorrectly. This file is accessible through JDeveloper 11g Application Navigator:



I saw that weblogic.xml was generated without required entries:



So, I added required security role assignment manually:



Now my application opens correctly:



If you will encounter same problem, make sure your weblogic.xml file is valid. Download working sample application - ADFSecurityValidUsers.zip.

Sunday, December 6, 2009

Overriding IsAttributeUpdateable Method for Conditional Rendering

While working on customer side during last week, we got a requirement to render table records and conditionally prevent editing based on history column. Its quite common requirement, and there are many ways in ADF to implement it. You can generate separate button for each row and conditionally disable it, but from user perspective it is far from the best approach. Don't forget that ADF allows to override standard methods, where we can customize behavior. One of those methods - isAttributeUpdateable(), you can override it in EO implementation class, use this method to enable conditional disable property rendering.

Download sample application - IsUpdateableByDate.zip. This app implements simple table:



We can insert new records:



Business rule says - record should be editable only when HireDate attribute value is in range of 20 days before current day. Example of editable newly inserted records (12/4/2009 and 12/1/2009):



If I will change HireDate attribute value to older date:



Record automatically will become disabled:



How it is implemented? Simply you need to define EO implementation class:



Create new transient attribute on EO level - EmployeeEditIndicator:



This attribute can be based on Groovy expression, and is used to calculate the difference between adf.currentDate and HireDate attribute. Make sure you check for null value, otherwise it will not work for newly created record:



Finally, our isAttributeUpdateable() method is overridden to compare the difference in days:


Wednesday, December 2, 2009

JDeveloper 11g IDE Thumbnail Feature for ADF Task Flow Call

There is one very useful feature in JDeveloper 11g related to ADF Task Flows, but it is a bit hidden from the user. Probably everyone have noticed, in the latest JDeveloper 11g R1 PS1 you can directly click on the page in ADF Task Flow and will get thumbnail displayed:



Same thing works for ADF Task Flow call, just you can't get it by simply clicking on activity itself, you need to right click and invoke thumbnail from the menu:



Finally, you will get called ADF Task Flow preview: