Sunday, July 3, 2011

Oracle WebCenter 11g PS3/PS4 Workaround for User Session Timeout Error 404

Most of you who are developing/using WebCenter 11g PS3/PS4 apps, probably noticed one annoying behavior related to user session timeout - Error 404 Resource not Found. Starting from ADF 11g PS3, user session timeout is handled by ADF with a new session timeout warning functionality. By default, 2 minutes before session expiry, ADF informs user to resume activity, if no action was taken after 2 minutes another warning message will inform about session timeout. Once user comes back and press OK for session timeout warning - automatic redirect happens to landing login page, this behavior is controlled by ADF Security. Read more about session timeout warning functionality from Frank Nimphius blog - How-to enable user session time out warning (JDev 11.1.1.4).

While this works well with ADF, it doesn't want to work so well with WebCenter. Mainly because WebCenter navigation model prevents ADF Security to redirect successfully to login page. However, I have found workaround for WebCenter project as well, you are free to use it, until it will be fixed in future versions. Download sample WebCenter 11g PS4 application, where user session timeout is handled properly - EnterprisePortalApp_v4.zip. I will describe below, what type of workaround is applied for this sample application.

Described error is reproduced with any type of WebCenter 11g PS3/PS4 application.

In order to reproduce user session timeout error, enable session timeout period for 5 minutes time:


When user session will be about to expire, we receive initial warning message:


Finally, if user takes no action, user session expires:


Not in 100% of the cases, but in 95% - when user press OK, WebCenter application generated Error 404 - Not Found:


This happens because WebCenter navigation model prevents ADF Security to redirect to login page successfully. Instead it keeps pointing to previously selected menu item from WebCenter navigation model. Since session becomes expired now, authentication is lost and we don't have access to navigation model anymore - its why Error 404 - Not Found is generated.

We can workaround this by defining our own filter class WCSessionExpiryFilter and mapping it to Faces Servlet - this would allow to intercept all requests processed by application:


Filter class should be predefined with initialization parameter describing URL address to redirect after session timeout will happen. In my case it will be login page -  /faces/oracle/webcenter/portalapp/pages/login.jspx:


Main logic for this workaround is implemented inside our custom filter class, doFilter() method:


We are relying on ADF Security and trying to access User Principal object from request. User Principal can be Null, when user is not authenticated. Or in other words, either user is not yet logged in, or session was expired. We need to check request URI, in case if login page is accessed during request - we do nothing. But in case when User Principal is Null and request URI is not pointing to login page, we would force to redirect to login page and ignore unauthenticated navigation from WebCenter - its when user session expired:


Confirm Page Expired message by pressing OK button and now we are redirected nicely to login page, thanks to our custom filter class described above:


Sunday, June 26, 2011

ADF 11g R2 Improvement - ADF Table AutoHeightRows Property

There are lots of new features in ADF 11g R2, one of them improved handling for ADF Table AutoHeightRows property. Read my previous blog post, to understand how this property was supported in ADF 11g R1 - ADF Table AutoHeightRows Property. In ADF 11g R1 it was working only with ContentDelivery set to immediate for table component (otherwise dynamic height resizing was not happening). Good news - it works now with all ContentDelivery modes.

Download sample application migrated to ADF 11g R2 - ADFTableAutoHeightR2.zip.

ContentDelivery property is set to default - whenAvailable:


AutoHeightRows is set to be 25, dynamic height resizing happens for less than 25 rows in result set:


Maximum 25 rows are shown, when result set size exceeds AutoHeightRows value:


Saturday, June 25, 2011

ODTUG - Oracle ADF 11g – Driving Power for SOA/BPM/WebCenter 11g Integration

Heading to Los Angeles, ODTUG Kscope11 conference:


I will be presenting there:

(1) Oracle ADF 11g - Driving Power for Oracle SOA/BPM/WebCenter 11g Integration (Abstract ID:149)

Andrejus Baranovskis, Red Samurai Consulting
Session 14, 06/29/2011, 1:45 PM-2:45 PM

Fusion Middleware - Web Center

Abstract:

Oracle Fusion Middleware 11g is industry standard for enterprise applications. One of the key technical advantages of Oracle Fusion Middleware 11g is a unified approach for application development. You can implement and reuse Oracle ADF 11g applications across entire Oracle Fusion Middleware 11g stack. This session will explain how to use ADF Faces components for Human Tasks UI implementation. An application will be invoked in Oracle BPM 11g Worklist application. Also how to call Human Worklow service of Oracle SOA/BPM 11g Suite directly without using the Oracle BPM 11g Worklist application will be demonstrated. The presenter will show how to consume Human Worklow services from custom ADF Task Flows, using standard Web Service Data Control. These ADF Task Flows will implement custom screens for Human Workflow functions - initiate, approve, and reject actions. Human Task payload will be populated from ADF Business Components module. Implemented ADF Task Flows will be invoked and demonstrated inside Oracle WebCenter Spaces 11g environment.

(2) Birds of Feather (FMW BoF) session:

Oracle Universal Content Management 11g and Oracle ADF/WebCenter 11g

The Bof’s will take place on Monday Night in Rooms 203A, 203B, or 203C, at the Long Beach Convention Center, from 7:00 p.m. to 8:30 p.m

Looking forward to meet you in LA !

Sunday, June 19, 2011

JDev 11g R2 - ADF BC Dependency Diagram Feature

Most of the projects tend to contain huge number of ADF BC objects and different dependencies between them. It was always very complex job, especially during refactoring, to understand these dependencies and make sure no Association or View Link is lost. With JDeveloper 11g R2, this job becomes much easier - we are given ADF BC diagrammer tool out of the box. This diagrammer tool can visualize ADF BC Association and View Link dependencies between EO's and VO's respectively.

Let's generate ADF BC objects with Associations and View Links for HR schema. Departments EO will be generated among other objects, let's open it:


ADF BC wizards are coming with additional tab - Diagram. It shows relationships between dependent objects for selected EO:


Diagram relationship feature is supported for VO's as well:


Download sample application - ADFBCDiagram.zip.

How to Open ADF BC Configuration Wizard in JDev 11g R2

It might be misleading how to open ADF BC configuration wizard in JDev 11g R2. Same menu option exists as in previous JDev releases - right click on AM and choose Configurations. This should open ADF BC configuration wizard, but in latest JDev release it opens bc4j.xcfg file and lists available configurations. However, there is no option to edit existing configurations (only add or remove):


Property inspector displays some settings for selected configuration, but its only subset of all available properties we can define:


In order to open complete ADF BC configuration wizard, you should go through workaround path and open AM module wizard first and then select Configurations section there:


Select edit option for available configuration, ADF BC configuration wizard will be opened, where we can define AM Pool parameters, etc.:


One more thing to learn about JDev 11g R2 - JDBC Data Source is set now by default for AM database connection:


Monday, June 13, 2011

ADF BC 11g R2 - Java Extended For Oracle Data Type Map

There is one fundamental change in ADF BC from 11g R2. It's not recommended anymore to use oracle.jbo.domain.Number type for numeric data types. As per ADF developer guide for 11g R2 - New Fusion web applications should use the default Java Extended for Oracle type. Java Extended For Oracle as Data Type Map is suggested by default, when you want to generate ADF BC, Oracle Domains type is still supported though:


With Java Extend For Oracle we don't have anymore one single type for numbers, but java.math.BigDecimal, java.math.BigInteger, etc. Somehow, I will miss good oracle.jbo.domain.Number, just think how complicated will be now refactoring - if we need to synchronize and change ADF BC based on customer request, we would need to care now about proper type usage. But anyhow, we should follow best practices and use Java Extended For Oracle type with new ADF applications.

I saw on the OTN Forum today, one issue was reported related to java.math.BigInteger type and ADF BC - Bug: JBO-25029: Domain class BigInteger is not found. JDeveloper11.1.2.0.0. I wanted to reproduce it with test case - created NUMBER(20) type column (BIG_INTEGER) in database:


EO is generated with all three numeric types - java.math.BigDecimal, java.math.BigInteger and java.lang.Integer - not too happy with this (imagine if database column precision will be changed, we would need to change type accordingly inside managed bean method and ADF BC implementation classes for certain attribute). Imagine into what horror we could end up, if we would need to refactor this EO (and 100 others), and change numeric types:


Run application, without doing any change for auto-generated code and you get error reported on OTN forum - domain class BigInteger is not found:


This error happens, because EO attribute of java.math.BigInteger type is not correctly auto-generated by ADF BC - type is not specified correctly:


Change BigInteger into java.math.BigInteger:


It works well:


Download sample application - ADFBCTypes.zip.

Update from Duncan Mills, posted on ADF EMG related to this blog:

In the limited use case that you explain here where the data model is changeable then you probably want to stick with the JBO Number domain. However, this is a corner case and not representative of most systems so the recommendation to use the new default stands. Saying that, we'll not be dropping the old typemap. It will be there forever, there is just way too much code that uses it, so there is no problem with continuing to use it.

Texas A&M Researchers Innovate & Engage with WebCenter - Video

With Oracle WebCenter, researchers at Texas A&M University are able to spend more time innovating and less time on administration, allowing them to collaborate more efficiently and uncover new discoveries:


Red Samurai is excited to deliver Oracle WebCenter platform solution to our customer - Texas A&M TEES.