Oracle WebCenter 11g PS3: Working with Navigation Models and Page Hierarchies

Over 100 advanced recipes to secure, support, manage, and administer Oracle WebCenter with this Oracle book and eBook

 

Oracle WebCenter 11g PS3 Administration Cookbook

Oracle WebCenter 11g PS3 Administration Cookbook

Over 100 advanced recipes to secure, support, manage, and administer Oracle WebCenter 11g with this book and eBook

        Read more about this book      

(For more resources on this subject, see here.)

Creating a navigation model at runtime

Lots of administrators will not have access to JDeveloper, but they will need to manage navigation models. In WebCenter, you can easily create and manage navigation models at runtime.

In this recipe, we will show how you can add navigation models at runtime.

Getting ready

For this recipe, you need a WebCenter Portal application.

How to do it...

  1. Run your portal application.
  2. Log in as an administrator.
  3. Go to the administration page.
  4. Select Navigations from the Resource tab.
  5. Press the Create button.
  6. Specify a name, for example, hr.
  7. Specify a description, for example, Navigation model for HR users.
  8. Leave copy from empty. In this list, you can select an existing navigation model so the newly created model will copy the content from the selected model.
  9. Press the Create button:

    Oracle WebCenter 11g PS3 Administration tutorial

The navigation model is now created and you can add components to it.

How it works...

When you add a navigation model at runtime, an XML file will be generated in the background. The navigation model will be stored in the MDS. You can request the path to the actual xml file by selecting Edit properties from the Edit menu when you select a navigation model. In the properties window, you will find a field called Metadata file. This is the complete directory to the actual XML file.

There's more...

Even at runtime, you can modify the actual XML representation of the navigation model. This allows you to be completely flexible. Not everything is possible at runtime, but when you know what XML to add, you can do so by modifying the XML of the navigation model. This can be done by selecting Edit Source from the Edit menu. This way you will get the same XML representation of a navigation model as in JDevleoper.

Adding a folder to a navigation model

A folder is the simplest resource you can add to your navigation model. It does not link to a specific resource. A folder is only intended to organize your navigation model in a logical way.

In this recipe, we will add a folder for the HR resources.

Getting ready

We will add the folder to the default navigation model so you only need the default WebCenter Portal application for this recipe.

How to do it...

  1. Open default-navigation-mode.xml from Web Content/oracle/Webcenter/portalapp/navigations.
  2. Press the Add button and select Folder from the context menu.
  3. Specify an id for the folder. The id should be unique for each resource over the navigation model.
  4. Specify an expression language value for the Visible attribute.

How it works...

Adding a folder to a navigation model will add a folder tag to the XML with the metadata specified:

<folder visible="#{true}" id="hr">
<attributes>
<attribute isKey="false"
value="folder" attributeId="Title"/>
</attributes>
<contents/>
</folder>

The folder tag has a contents tag as a child. This means that when you add a resource to a folder, these will be added as a child to the contents tag.

There's more...

You can also add a folder at runtime to a navigation model. This is done by selecting your navigation model and selecting Edit from the Edit menu. From the Add menu, you can select Folder. You are able to add the id, description, visible attribute and iconUrl.

        Read more about this book      

(For more resources on this subject, see here.)

Adding a link to a navigation model

A link in a navigation model is more than just a link as you would expect. A link in a navigation model can be a lot of things. It can be a link to an external application, page, taskflow, portlet, and so on.

You can also specify to render the link in a specific page template. This way you can add links to taskflows or external pages but still keep the look and feel of your portal.

Getting ready

For this recipe, you need a WebCenter Portal application.

How to do it...

  1. Open default-navigation-mode.xml from Web Content/oracle/Webcenter/portalapp/navigations.
  2. Press the Add button and select Link from the context menu.
  3. Specify an id for the link. This must be unique within the navigation model.
  4. Specify the type of link:
    • External link: Creates a link to an external page.
    • External application: Creates a link to an external application. This way when the user has configured a username and password for this application, the user will be automatically logged on to the application.
    • Page: Creates a link to a JSP or JSPX page from within your project.
    • Taskflow: Creates a link to a taskflow from your application or resource palette.
    • Portlet: Creates a link to a portlet from a provider that has been registered to your application.
    • Content: Creates a link to content from a content repository.
    • Other: Creates a link to any type of component as long as you specify the Factory Class.
  5. Specify Factory Class: When you have specified Other as the link type, you will need to specify the factory class that is responsible for instantiating the resources. When you have selected another type, the factory class will be greyed out.
  6. Specify the URL. In most cases, you can use the magnification glass next to the URL field. This is contextually bound to the type of link. Based upon the selected type, you are able to select the resource from a popup.
  7. Specify whether or not to render the URL in a page template or just redirect to the URL.
  8. Specify an expression language value for the visible attribute
  9. Specify a value in the Title attribute because this value will be used when displaying the link.

How it works...

When you add a link to a navigation model, a url tag will be added to the XML:

<url visible="#{true}" factoryClass="oracle.Webcenter.
portalframework.sitestructure.rc.AdfPageResourceFactory" id="url8"
url="page://oracle/Webcenter/portalapp/pages/home.jspx">
<attributes>
<attribute isKey="false" value="my Page" attributeId="Title"/>
<attribute isKey="false" value="false"
attributeId="Redirect"/>
</attributes>
</url>

The url tag contains the basic information about the link like the id, visible attribute and factoryClass. It will also contain the actual url. Based upon the type, the url can have a different format. For example, a link to a portlet will start with portlet:// while a link to a taskflow will start with taskflow://. In the example above, the url contains a link to a page from a project.

It is best that you use the popup to select a resource instead of entering the URL by yourself because in most cases it can be a very complex one.

An url also has a set of attributes. These contain additional attributes, for example, the title and the attribute that is responsible for redirecting the link or displaying it on the same page.

When you specify a specific template to render the URL, an additional parameter will be added to the url tag. This parameter will contain the path to the template that will be used to render the url :

<url visible="#{true}" factoryClass="oracle.Webcenter.
portalframework.sitestructure.rc.AdfPageResourceFactory" id="url8"
url="page://oracle/Webcenter/portalapp/pages/home.jspx">
...
<parameters>
<parameter id="pageTemplate">/oracle/Webcenter/portalapp/
pagetemplates/pageTemplate_globe.jspx</parameter>
</parameters>
</url>

When you create a link to a taskflow or a portlet, than this template will be used to render the taskflow or portlet in. At first sight, it does not seem logical to link to a taskflow or a portlet, but in fact, it can be very useful. In some cases, you will create a page with only one component on it and you should add that page to your navigation. By using a link to a taskflow or portlet, you don't need to create pages for each taskflow or portlet. This way, it gives greater flexibility in designing the look and feel of your portal.

This technique is also used to show a portlet or taskflow in full page mode. When you have a page with multiple components on it, it can be useful to provide a link to a page with only one taskflow or portlet so it will be rendered bigger.

There's more...

You can also add a link to a navigation model during runtime. This is done by editing a navigation model and selecting link from the add menu. During runtime, you don't need to specify the type, but you can also use a popup to select the resource for the URL. Based upon the selected URL, the factory class will automatically be populated:

Oracle WebCenter 11g PS3 Administration tutorial

        Read more about this book      

(For more resources on this subject, see here.)

Managing the page hierarchy

A page hierarchy describes where each page of your portal is in relation to another page. It is a parent-child relationship where each page can have different child pages.

The page hierarchy also defines the security for each page. You can specify security for each node or you can also let each node inherit the security from its parent.

Page hierarchies are used in combination with navigation models in order to create a user-friendly navigation.

A WebCenter application can only have a single page hierarchy, but the navigation model can have multiple references to the page hierarchy with each reference another entry point. This way you use the page hierarchy in a dynamic way.

In this recipe, we will show you how to add a page to the page hierarchy and manage the security on it.

Getting ready

For this recipe, you need a WebCenter portal application.

How to do it...

First we will create a new JSPX page based upon a default template:

  1. Press Ctrl + N to open the New Gallery.
  2. From the left menu, select JSF from the Web Tier.
  3. From the right menu, select JSF Page.
  4. Press the OK button.
  5. File Name: myPage.jspx.
  6. Directory: public_html\oracle\Webcenter\portalapp\pages.
  7. Check the Create as XML document checkbox.
  8. Select Oracle Three Column Layout as page layout.
  9. Press the OK button.

We don't need to modify anything on the page. We only created it so we can add it to the page hierarchy.

Now we can add the page to the page hierarchy:

  1. Open pages.xml from the Web content/oracle/Webcenter/portalapp/pagehierarchy folder.
  2. Select the Root element.
  3. Press the Add button.
  4. Browse to the newly created page and select it.
  5. Press the Open button.
  6. Select myPage from the hierarchy.

Now you have added the page to the hierarchy and you can see its properties. You can also modify the security or set the page as invisible by unchecking the Visible checkbox.

How it works...

The page hierarchy is a simple XML file containing all the pages in the correct places:

<?xml version="1.0" encoding="windows-1252" ?>
<pagesDef xmlns="http://xmlns.oracle.com/Webcenter/page"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/Webcenter/
page/pagesDef.xsd">
<pageDef contentMRef="/oracle/Webcenter/portalapp/pages/home.jspx"
hidden="false" shared="false" hasSubPages="false"
id="home"/>
<pageDef contentMRef="/oracle/Webcenter/portalapp/pages/myPage.jspx"
hidden="false" shared="false" hasSubPages="false"
id="myPage"
overridePolicy="false"/>
</pagesDef>

Each page is defined by a pageDef tag. This tag contains the contentMRef attribute which points to the path of the page.

When the page has sub pages, the hasSubpages attribute will be set to true. Once a page has subpages, it will have its own page hierarchy, so each page hierarchy only has one level of pages. All the other levels will be added by including the other page hierarchies.

There's more...

You can easily use the drag and drop method to organize the page hierarchy.

For example, suppose that we want our page myPage.jspx should be a child node of the Home page. This can be done by dropping myPage from the page hierarchy on the Home node in the hierarchy.

Summary

In this article we saw crate and manage navigation model to guide the user through your portal and also manage the page hierarchy.


Further resources on this subject:


Books to Consider

Oracle Database 11g – Underground Advice for Database Administrators
$ 21.00
Oracle 10g/11g Data and Database Management Utilities
$ 29.99
comments powered by Disqus
X

An Introduction to 3D Printing

Explore the future of manufacturing and design  - read our guide to 3d printing for free