Thursday, September 22, 2011

Book Review: "Oracle WebCenter 11g PS3 Administration Cookbook"

There are three major components in the WebCenter product stack:
  1. WebCenter Framework
    • Allows you to embed portlets, ADF Taskflows, content, and customizable components to create your WebCenter Portal application
    • All Framework pieces are integrated into the Oracle JDeveloper IDE, providing access to these resources as you build your applications
  2. WebCenter Services
    • Are a set of independently deployable collaboration services
    • Incorporates Web 2.0 components such as content, collaboration, discussion, announcement and communication services
  3. WebCenter Spaces
    • Is an out-of-the-box WebCenter Portal application for team collaboration and enterprise social networking
    • Is built using the WebCenter Framework, WebCenter services, and Oracle Composer
As the strategic portal product of Oracle, WebCenter Framework plays in the Enterprise portal space, and WebCenter Services/Spaces plays in the Collaboration Workspace space.

What's Portal Application?

A portal can be thought of as an aggregator of content and applications or a single point of entry to a user's set of tools and applications. It is a web-based application that is customizable by the end-user both in the look and feel of the portal and in the available content and applications which the portal contains.

The key elements of portals include:
  • Page hierarchy
  • Navigation
  • Delegated administration and other security features
  • Runtime customization and personalization.

To design a successful enterprise web portal is hard, but getting easier and more practical with Oracle WebCenter which is built on top of Oracle ADF technology. As an enterprise portal, security is extremely important. Unauthorized people should never get access, and different groups may have different permissions. Customers, partners and employees should be able to use a single login to access all relevant information and applications.

The Book

To design, test, deploy, and maintain a successful web portal is nontrivial to say the least. Therefore, a cookbook like Oracle WebCenter 11g PS3 Administration Cookbook is needed. In fourteen chapters, it provides over a hundred step-by-step recipes that help the reader through a wide variety of tasks ranging from portal and portlet creation to securing, supporting, managing, and administering Oracle WebCenter.

In the book, it covers many new features introduced by the 11g R1 Patch Set 3 version of the Oracle WebCenter product. It also touches upon all three components: WebCenter Framework, WebCenter Services, and WebCenter Spaces and roughly in that order. Besides important topics such as customization and security , it also discuss the analytics aspect of the product (i.e., Activity Graph).

Resource Catalog

Using resource catalog as an example, in this book, you'll learn that:
  • How to create a resource catalog either at design time or runtime
  • How to specify a catalog filter or a catalog selector
  • How to add a link to the resource catalog
  • How to add an existing resource catalog to the catalog
  • How to add custom components to a resource catalog
  • How to add custom folder to the resource catalog
At each step, you'll learn how it works and why. For example, when you add a resource catalog at runtime, an XML file will also be created, but it will be stored in the MDS (Metadata Service Repository) which is a repository used by WebCenter to store metadata.


After the introduction of different approaches, the author also discusses the trade-offs of each approach. For example, with WebCenter Spaces, it allows you to build collaborative intranets without needing to develop a lot. The problem you will be having with WebCenter Spaces is that it is not as easily customizable as a regular WebCenter Portal application. Therefore, you can combine the best of both worlds. When you need a high level of customization or you need to extend the site with your custom functionality, then you should create a WebCenter Portal application. When you need a collaborative environment where customization or added functionality is not as important as the collaborative services, then go for WebCenter Spaces.

  1. Oracle WebCenter 11g PS3 Administration Cookbook
  2. Creating a Successful Web Portal
  3. Oralce WebCenter (Wikipedia)
  4. Oracle ADF Task Flow in a Nutshell
  5. Book Review: Web 2.0 Solutions with Oracle WebCenter 11g
  6. Oracle® Fusion Middleware Enterprise Deployment Guide for Oracle WebCenter Content 11g Release 1 (11.1.1)

Saturday, September 17, 2011

ADF View Criteria By Example

There are different filtering approaches to query row data provided in Oracle ADF 11g:
  • By adding WHERE clause to View Object SQL statement
  • By creating View Criteria Programmatically
  • By using named View Criteria
In this article, we will examine these different approaches followed by the discussion of view criteria.

Not that all three examples shown in the article are defined in the application module.

Adding WHERE Clause

In the first example (i.e., getChannel1), it gets the query statement from the View Object and appends it with a WHERE clause. Then the PreparedStatement is executed with specified filtering.
public OracleCachedRowSet getChannel1(Long channelId)
throws SQLException
ResultSet rs = null;
ViewObjectImpl vo =
(ViewObjectImpl) this.findViewObject("ChannelOnly");
StringBuffer query = new StringBuffer(vo.getQuery());
query.append(" where ChannelEO.CHANNEL_ID =").append(channelId);
DBTransaction txn = this.getDBTransaction();
PreparedStatement ps =
txn.createPreparedStatement(query.toString(), 1);
rs = ps.executeQuery();
OracleCachedRowSet ocs = new OracleCachedRowSet();

return ocs;
catch (Exception e)
if (AppsLogger.isEnabled(AppsLogger.SEVERE))
AppsLogger.write(OsmmSetupUiModelAMImpl.class, e);
if (rs != null)
return null;

Creating View Criteria Programmatically

In the second example (i.e., getChannel2), it shows that a ViewCriteria object is created at runtime by using ViewCriteriaRow's, which in turn are composed of ViewCritiaItem's. Then this ViewCriteria object is applied to the View Object and used in the filtering.
 public  void getChannel2(Long channelId)
// Create and populate criteria rows to support query-by-example.
ViewObject channelVO = this.findViewObject("ChannelOnly");
ViewCriteria vc = channelVO.createViewCriteria();
ViewCriteriaRow vcRow = vc.createViewCriteriaRow();

// ViewCriteriaRow attribute name is case-sensitive.
// ViewCriteriaRow attribute value requires operator and value.
// Note also single-quotes around string value.
ViewCriteriaItem jobItem = vcRow.ensureCriteriaItem("ChannelId");


// Multiple rows are OR-ed in WHERE clause.
System.out.println("Demo View Criteria");

// Should print channel with specified channel ID

public  void printViewObject(ViewObject vo)
// Execute the query, print results to the screen.

// Print the View Object's query
System.out.println("Query: " + vo.getQuery());

while (vo.hasNext())
Row row =;
String rowDataStr = "";

// How many attributes (columns) is the View Object using?
int numAttrs = vo.getAttributeCount();

// Column numbers start with 0, not 1.
for (int columnNo = 0; columnNo < numAttrs; columnNo++)
// See also Row.getAttribute(String name).    
Object attrData = row.getAttribute(columnNo);
rowDataStr += (attrData + "\t");

Using Named View Criteria

In the third example (i.e., getChannel3), it finds a named View Criteria (i.e., findByChannelId) which is defined at design time. After setting the value of named Bind Variable (i.e., ChannelIdBV), the view criteria is applied to the View Object and used in querying the row data.

public Row[] getChannel3(Long channelId)
ChannelVOImpl viewObj = (ChannelVOImpl) this.getChannelOnly();
if (viewObj != null)
ViewCriteria vc = viewObj.getViewCriteria("findByChannelId");
viewObj.setNamedWhereClauseParam("ChannelIdBV", channelId);
Row[] allRows = viewObj.getAllRowsInRange();
return allRows;
return null;

What's View Criteria

Before the advent of Oracle ADF 11g, to show an employee list filtered by company role on one page and by department number on another page, you would have needed to either create separate view objects for each page or write custom code to selectively modify a view object's WHERE clause and bind variable values. With the new release, you can now use a single view object with multiple named view criteria filters to accomplish the same task.

A view criteria you define lets you specify filter information for the rows of a view object collection. The view criteria object is a row set of one or more view criteria rows, whose attributes mirror those in the view object. The view criteria definition comprises query conditions that augment the WHERE clause of the target view object. Query conditions that you specify apply to the individual attributes of the target view object. Check out here for:
  • How to Create Named View Criteria Declaratively
  • How to Test View Criteria Using the Business Component Browser
  • How to Create View Criteria Programmatically

Advantages of Using Named View Criteria

Among the different approaches, the third one is the preferred approach. This is because view criteria that you define at design time can participate in these scenarios where filtering results is desired at runtime:
  • Supporting Query-by-Example search forms that allow the end user to supply values for attributes of the target view object[2].
  • Filtering the list of values (LOV) components that allow the end user may select from one attribute list (displayed in the UI as an LOV component)[3].
  • Validating attribute values using a view accessor with a view criteria applied to filter the view accessor results[4].
  • Creating the application module's data model from a single view object definition with a unique view criteria applied for each view instance[5].


  1. Working with Named View Criteria
  2. Creating Query Search Forms
  3. Creating a Selection List
  4. How to Validate Against a View Accessor
  5. How to Define the WHERE Clause of the Lookup View Object Using View Criteria
  6. Reusable ADF Components—Application Modules
  7. Oracle Application Development Framework
  8. Oracle ADF Essentials