Tuesday, September 25, 2012

Launching News Articles Using WebCenter Navigation Model’s Display Options



Custom WebCenter Portal  Application - 11.1.1.6.0 (PS5)

One of our customers had a requirement to display news articles on their custom
WebCenter Portal. On the home page of the portal, user can see a list of news articles
and clicking on any of them, displays the full news article. User can click on a “Send
Email” link on the full news article page and type in an email id to send the link to. The
recipient can then click on the email link to view the full article. This is a very common
behavior in most of the news sites today.

In our solution, the news articles are created and stored as HTML documents in the
WebCenter Content store. Creation and management of the news articles is out of
scope for this blog.

WebCenter Portal provides many out of the box document management task flows for
displaying and managing HTML content. We used Document Viewer, for displaying the
articles (HTML content stored in the WebCenter Content) and also for providing
comments and Likes features available with Document Viewer task flow. Using the
“featuresOff” parameter, we can hide all the other features not required on the
Document Viewer task flow.

To provide additional customer specific functionality like “Send Email” and calendar
events, a custom ADF task flow was created as a wrapper for the Document Viewer taskflow.  The task flow defines an input parameter “newsId” to identify the article to be
displayed and passes this input parameter value to the document viewer task flow’s
input parameter “resourceId”.

For making the page accessible through a link in the email, WebCenter Navigation
Model‘s display options “ExternalId” attribute was used.

Here’s a step by step implementation for creating the article page and using the
navigation model to make it accessible externally.


  1. Create a custom task flow called “NewsArticle” and define input parameter as “newsId”. Map the value to #{pageFlowScope.currentNewsId}
  2. Add a view activity and map it to view.jsff file.
  3. In the view.jsff add Document Viewer task flow and map the bind parameter resourceId to #{‘UCMConnection#dDocName:’}#{pageFlowScope.currentNewsId}where UCMConnection is the name of the connection to the WebCenter Content server.
  4. Create a WebCenter page “newsarticle.jspx” under /oracle/webcenter/portalapp/pages/news. (Note: This page could be anywhere in the Web Content folder, but to make it manageable at runtime; it must reside under /oracle/webcenter/portalapp folder.)
  5. Add the custom task flow “NewsArticle” to the newsarticle.jspx page and map its input parameter “newsId” to ${facesContext.externalContext.requestParameterMap['newsId']} This code retrieves the value of the newsId request parameter and passes it to the NewsArticle Task Flow.
  6. Define a new navigation model e.g. link-navigation-model.xml under /oracle/webcenter/portalapp/navigations folder in the WebCenter project. This is mainly to avoid the page appearing on the main portal navigation. This can be also handled by using default navigation model and hiding the newsarticle node programmatically. But if there are many such pages used in the portal, then using a separate navigation model is more efficient.)
  7. Add the newsarticle.jspx page to the new navigation model by opening the navigation model and dragging and dropping the newsarticle page in the model.
  8. Select the page in the model and click on the plus sign under URL Attributes and select ExternalId. Specify the Display Value as “MyNews”.
This completes the display part. Let's take a look at the link creation.

  1. “ExternalId” is “an ID to enable a direct reference to a node in the navigation model from a static link in the page”. This attribute can also be used with a non-default navigation model to make a node in the non-default navigation model accessible through static links.
  2. The URL to use is /faces/wcnav_externalId/MyNews?wcnav.model=/oracle/webcenter/portalapp/navigations/ link-navigation-model&newsId=<newsId>
    Where
    MyNews – is the externalId attribute value, specified for the newsarticle node.
    wcnav.model value is the full path to the non-default navigation model (without the xml extension)
    newsId – is the id of the news article currently being viewed by the user. In our case, the navigation from the home page to full news page was implemented using “Resource Action Handling” framework.
  3. One challenge we faced, in implementing this solution, is that the Oracle documentation has the parameter name as “wcnav.modelPath” where as the actual parameter required to specify the model path is “wcnav.model”. We found it the hard way, but hope this blog helps others.
  4. Append host, port and web context root information at the beginning of the URL to form an absolute URL. Send the URL in an email body using Java Mail API.
  5. When the recipient clicks on the link, WebCenter framework can identify the page by looking at the wcnav.model and ExternalId attributes. The article id passed in the “newsId” request parameter identifies the article to be displayed, which is passed to the Document Viewer task flow.

    By using WebCenter navigation model’s display option attribute “ExternalId”, we can make a WebCenter page accessible externally. Using a simple request parameter approach and a Document Viewer task flow, we can display news articles that are accessible from the external URLs.
Note: Document Viewer task flow displays some additional document information like 
name of author and last updated date. This can be easily hidden by using skinning
techniques.

1 comment:

  1. Hey guys if you are really the multiplayer game player then here on our homepage you will play happy wheel play free online game on your pc tablet and on your smartphone without any download and registration it is really an awesome game you loves to play it.

    ReplyDelete