Oracle® Fusion Middleware Developer's Guide for Oracle WebCenter 11g Release 1 (11.1.1.4.0) E10148-12 |
|
![]() Previous |
![]() Next |
Resource Catalogs define and organize the resources available for inclusion in a page, page template, or task flow. You can create them in JDeveloper so that they are deployed with the application. Resource Catalogs can also be created and edited in the runtime Resource Manager. This chapter describes the default Resource Catalog and explains how to customize this catalog and create new catalogs in JDeveloper.
For information about managing Resource Catalogs at runtime, see "Working with Resource Catalogs" in Oracle Fusion Middleware User's Guide for Oracle WebCenter Spaces.
This chapter contains the following sections:
The Resource Catalog, also known as Oracle Business Dictionary, provides a consolidated view of the contents of one or more otherwise unrelated repositories in a unified search and browse user interface. Resources originate in their source repository and are then exposed through the Resource Catalog as shown in Figure 15-1.
When using JDeveloper, you see two types of Resource Catalogs—design time Resource Catalogs and runtime Resource Catalogs.
Design time Resource Catalogs are available in the Resource Palette and are like favorites lists for developers. The WebCenter Services Catalog is a design time catalog that is available out-of-the-box when you install the WebCenter extension bundle. You can add task flows and data controls from this catalog to a WebCenter application. In addition to the WebCenter Services catalog, you can define connections and create catalogs to organize resources exposed by those connections. Such resources can be re-used in any application that you are developing.
See Also:
|
Runtime Resource Catalogs are available for populating pages or page templates and task flows in deployed WebCenter applications and WebCenter Portal applications. In WebCenter applications, the Resource Catalogs determine the resources available when populating pages and task flows in Oracle Composer. In addition to this, the Resource Catalogs in WebCenter Portal applications also determine the resources available when creating page templates and other Resource Catalogs in the Resource Manager.
Default Resource Catalog Configuration
When you add a Page Customizable
component to the page, a default Resource Catalog with the catalog definition file, default-catalog.xml
, is configured in the application. Depending on the type of application you created, the catalog definition file is created in one of the following folders:
In a portal application, the default-catalog.xml
file is located in the APPLICATION_ROOT
/Portal/public_html/oracle/webcenter/p
ortalapp/catalogs
directory. The Resource Catalog in this case contains the folders shown in Figure 15-2.
In a non-portal WebCenter application, the default-catalog.xml
file is located in the APPLICATION_ROOT
/Portal/src/p
ortal
directory. The Resource Catalog in this case contains the ADF Faces Components folder, which contains ADF Faces components that a user can add to the page.
If you have registered a portlet producer with your application, then that producer's portlets are displayed in a Portlets folder in the Resource Catalog. If you have not registered any producer, the Portlets folder is hidden.
You can create custom catalogs or modify the default catalog and include components relevant to your business. For more information, see Section 15.2, "Creating a Custom Resource Catalog" and Section 15.2.3, "How to Manage Content in the Resource Catalog."
Most businesses may require that users and groups have access to only those resources that they can add to a page. To address this need, you can configure multiple Resource Catalogs in your application. To configure multiple Resource Catalogs, you must first create custom catalogs with all the required resources.
This section describes how to create a custom Resource Catalog. It contains the following subsections:
Section 15.2.3, "How to Manage Content in the Resource Catalog"
Section 15.2.4, "How to Expose Data Controls Created at Design Time"
Section 15.2.5, "How to Expose Data Controls Created at Runtime"
Section 15.2.6, "How to Control Visibility of Portlets in the Resource Catalog"
Section 15.2.7, "How to Configure the Default Resource Catalog for an Application or Page"
Section 15.2.8, "What You May Need to Know When Defining a Resource Catalog"
The New Gallery dialog provides an option to create a Resource Catalog. Using this option, you can create a blank catalog and populate it with resources of your choice.
To create a catalog definition:
Open your application in Oracle JDeveloper.
Select the Portal project, and from File menu, choose New.
In the New Gallery dialog, expand Web Tier, select Portal, then Application Resource Catalog, and click OK.
In the File Name field in the Create Application Resource Catalog dialog, provide a name for the catalog, for example, users-catalog.xml
.
In the Directory field, specify the location for the new catalog definition XML file.
Catalog definition files must be saved in the Resource Catalog root directory or a subdirectory of the root. The default root directory in a portal application is APPLICATION_ROOT
/Portal/public_html/oracle/webcenter/p
ortalapp/catalogs
, and in a non-portal WebCenter application is APPLICATION_ROOT
/Portal/src/p
ortal
.
Note: In a WebCenter Portal application, to expose the new catalog in the runtime Resource Manager, you must create the catalog in theAPPLICATION_ROOT /Portal/public_html/oracle/webcenter/p ortalapp directory. |
For example, if the Resource Catalog root is:
C:\JDeveloper\mywork\RCSampleApp\Portal\public_html\oracle\webcenter\portalapp\catalogs
You could create your catalog here or create a subdirectory for it. For example:
C:\JDeveloper\mywork\RCSampleApp\Portal\public_html\oracle\webcenter\portalapp\catalogs\mycatalogs
Select the Create as Portal Resource option to expose the catalog in the Resource Manager.
Note: This option is displayed in a WebCenter Portal application if you specified the directory to beAPPLICATION_ROOT /Portal/public_html/oracle/webcenter/p ortalapp or a subdirectory of portalapp . |
Click OK.
The new catalog definition file opens in the Overview Editor.
In the right half of the Overview Editor, define catalog properties as follows:
In the Catalog Filter field, specify the name of the filter you want to apply to the catalog. This field is optional. For more information, see Section 15.4, "Filtering Items in the Resource Catalog."
In the Visible field, specify whether the Resource Catalog must be displayed. This attribute takes an EL value. The default value is #{true}
, which means that the catalog is displayed to all users at all times.
Use the Catalog Attributes section to define the following attributes on the catalog.
Title: A display name for the catalog.
Description: A short description of the catalog. This text appears below the catalog name in the Resource Manager.
Subject: Keywords to facilitate keyword searching of the Resource Catalog.
IconURI: Specify the URI for an icon to display alongside the catalog name in the Resource Manager.
Tool Tip: Use to specify the tool tip to be displayed when you move the mouse over this catalog name.
Note: Catalog attributes are defined within the<schema> element in the catalog definition XML file. In addition to the out-of-the-box attributes, you can expose custom attributes on the catalog by defining them within the <schema> element. |
Save the catalog definition file.
You can now populate your catalog with resources. See Section 15.2.3, "How to Manage Content in the Resource Catalog" for details about adding different types of resources.
Tip: If you do not want to add resources from scratch, as a starting point, you could copy the contents ofdefault-catalog.xml into your new catalog definition. |
Many resources, such as Oracle WebCenter Services and portlets, are accessed through connections defined in your application's connections.xml
file. Therefore, you must create connections before adding such resources to the Resource Catalog.
You can create connections to resources in different ways. This section describes how to create a connection from the Resource Palette. For information about additional ways to create connections, see Section 7.2, "Preparing Your WebCenter Portal Application to Consume Services" and Section 59.2, "Registering Portlet Producers with a WebCenter Portal Application."
To create a connection from the Resource Palette:
From the Resource Palette, click the New icon in the upper left corner.
Choose New Connection and then the type of connection you want to create.
The wizard for your connection type appears.
Step through the wizard filling in the necessary information about the connection.
When you click Finish, the connection should appear in the Resource Palette under Connections.
Right click your connection in the Resource Palette and choose Add to Application from the context menu.
Alternatively, you can drag and drop the connection from the Resource Palette to the Application Resources panel of the Application Navigator.
You can add or remove catalog resources as required by your business.
Tip: If you are creating a Resource Catalog from scratch, you can refer to the default catalog definition file to get an idea of how resources are included in the catalog. |
Typically, catalog definition files are available in the APPLICATION_ROOT
/Portal/public_html/oracle/webcenter/p
ortalapp/catalogs
directory. The Design view of a catalog definition file, shown in Figure 15-3, provides options to add, modify, and delete catalog content.
Figure 15-3 Catalog Definition File Design View
You can add resources to a catalog in two ways:
Use the options on the Add menu in the Resource Catalog Overview Editor.
Drag and drop resources from different areas in the IDE onto the catalog definition file.
The left half of the XML editor contains the Catalog section, which displays the hierarchical structure of components in the catalog. The right half of the page provides fields to define attributes and parameters on a selected resource.
See Also: For details about the catalog definition file and its attributes: |
This section explains how to manage catalog resources. It contains the following sections:
You can create folders to group similar resources, thereby organizing the catalog better.
To add a folder:
Open the catalog definition file in JDeveloper.
This file is typically available in the APPLICATION_ROOT
/Portal/public_html/oracle/webcenter/p
ortalapp/catalogs
directory.
From the Add menu in the Catalog section, select Folder.
A folder
element is added to the catalog. The right side of the page displays fields to define the new folder's attributes and parameters.
The Id
field is populated with the value folder
by default. You can specify a different value, but the ID must be unique within the catalog definition file.
In the Visible
field, you can specify an EL value to conditionally display this folder to specific users or groups. This attribute takes an EL value. The default value is #{true}
, which means that the resource is displayed in the catalog at all times.
Optionally, in the Folder Attributes section, you can define the following attributes by choosing them from the Add menu, shown in Figure 15-4:
Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.
Description: A description of this resource.
Subject: Keywords to facilitate keyword searching of the Resource Catalog.
ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.
IconURI: The icon to be displayed next to the resource name in the catalog.
Selecting an option on the Add menu creates a new row in the Folder Attributes table. You can use this row to specify the name, type, and value for the new attribute.
You can add the following types of links to a catalog:
Task Flow: Link to a WebCenter Services task flow (in the Resource Palette) or a custom task flow created in Oracle JDeveloper (in the Application Navigator).
Portlet: Link to any registered portlet producer. See Chapter 59, "Consuming Portlets" for detailed information about registering portlet producers and adding portlets to the page.
Content: Link to a file or directory from an existing Content Repository connection.
Other: Link to a custom component that you create by providing the XML code for that component.
To add a link:
From the Add menu in the Catalog section, select Link.
A url
element is added to the catalog. The right side of the page displays fields to define the new link's attributes and parameters.
The Id
field is populated with the value url
by default. You can specify a different value, but the ID must be unique within the catalog definition file.
From the Type list, shown in Figure 15-5, select the type of resource that you want to create. You can choose from Taskflow
, Portlet
, Content
, and Other
.
Notes:
|
If you are adding a custom resource, then specify the factory class of the component. For all other resource types, the Factory Class
value is populated as soon as you select the type.
The factory classes for the available resource types are as follows:
Task flow: oracle.webcenter.portalframework.sitestructure.rc.TaskFlowResourceFactory
Portlet: oracle.webcenter.portalframework.sitestructure.rc.PortletResourceFactory
Content: oracle.webcenter.content.model.rc.ContentUrlResourceFactory
For more information, see Section C.4, "Factory Classes Available for Adding Dynamic Resources to the Catalog."
In the URL field, specify the URL to access the resource. Table 15-1 provides the URL format to be used for each resource type.
Table 15-1 URL Format for the Different Resource Types
Resource Type | Location in the Application | URL Format |
---|---|---|
Task Flow from an ADF Library. |
Resource Palette |
taskflow://Path_to_Task_Flow/Task_Flow_Definition_File_Name#Task_Flow_ID |
Task Flow Within the Application. |
Application Navigator |
taskflow://Path_to_Task_Flow/Task_Flow_Definition_File_Name#Task_Flow_ID |
Portlet |
Portlet producer connection in the Application Resources pane or in the Resource Palette |
portlet://Producer_ID/Portlet_ID |
Content |
Content Repository connection in the Application Resources pane |
content://Content_Connection_ID/Document_ID |
Click the Browse icon next to the URL field to open the Choose Resource dialog, which enables you to add a resource of the selected type from the application or the Resource Palette.
Note: If you entered the URL for a portlet or content type resource manually, and if the connection for that resource is available only in the Resource Palette, then ensure that you first add the connection to the application. |
In the Visible
field, you can specify a true or false value, or an EL value to conditionally display this link to specific users or groups. The default value is #{true}
, which means that the resource is displayed in the catalog at all times.
Optionally, in the URL Attributes section, you can define the following attributes by choosing them from the Add menu:
Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.
Description: A description of this resource.
Subject: Keywords to facilitate keyword searching of the Resource Catalog.
ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.
IconURI: The icon to be displayed next to the resource name in the catalog.
Selecting an option on the Add menu creates a new row in the Folder Attributes table. You can use this row to specify the name, type, and value for the new attribute.
Use the URL Parameters section to define parameters on the resource. You can bind these parameters to other artifacts in the application. Click the Add icon to create a new row in the Parameters table.
You can include another Resource Catalog inside the selected catalog. When you add another catalog, only a pointer to this catalog is included in the catalog definition file. The actual catalog contents are inserted only at runtime.
To add a Resource Catalog:
From the Add menu in the Catalog section, select Resource Catalog.
A new node titled catalog
is added to the catalog. The right side of the page displays fields to define the new folder's attributes and parameters.
The Id
field is populated with the value catalog
by default. You can specify a different value, but the ID must be unique within the catalog definition file.
In the Path field, specify the MDS path to the catalog definition file, for example, \oracle\webcenter\portalapp\catalogs\custom-catalog.xml
.
You can use the Browse icon to browse application folders and select the catalog definition file.
In the Visible
field, you can specify an EL value to conditionally display this catalog to specific users or groups. This attribute takes an EL value. The default value is #{true}
, which means that this resource is displayed in the catalog at all times.
Optionally, in the Catalog Attributes section, you can define the following attributes by choosing them from the Add menu:
Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.
Description: A description of this resource.
Subject: Keywords to facilitate keyword searching of the Resource Catalog.
ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.
IconURI: The icon to be displayed next to the resource name in the catalog.
Selecting an option on the Add menu creates a new row in the Catalog Attributes table. You can use this row to specify the name, type, and value for the new attribute.
You can add a custom component to the catalog. You can add a variety of components, such as simple ADF Faces components, compound objects containing two or more components, and JSF Verbatim tags that let you add arbitrary HTML content inside them. An example for arbitrary HTML that you can add to your catalog is a YouTube video.
To add a custom component:
From the Add menu in the Catalog section, select Component.
A component
element is added to the catalog. The right side of the page displays fields to define the component's attributes and parameters.
The Id
field is populated with the value component
by default. You can specify a different value, but the ID must be unique within the catalog definition file.
In the Component Factory field, specify the name of a Java class that implements the oracle.adf.rc.component.ComponentFactory
interface and creates an instance of the component based on a set of parameters, for example, oracle.adf.rc.component.XmlComponentFactory
.
As you type the name, the field auto-completes with valid factory classes from the classpath. You can also use the Browse icon to select a class.
For more information, see Section C.4, "Factory Classes Available for Adding Dynamic Resources to the Catalog."
In the Visible
field, you can specify an EL value to conditionally display this component to specific users or groups. This attribute takes an EL value. The default value is #{true}
, which means that this resource is displayed in the catalog at all times.
Optionally, in the Component Attributes section, you can define the following attributes by choosing them from the Add menu:
Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.
Description: A description of this resource.
Subject: Keywords to facilitate keyword searching of the Resource Catalog.
ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.
IconURI: The icon to be displayed next to the resource name in the catalog.
Selecting an option on the Add menu creates a new row in the Catalog Attributes table. You can use this row to specify the name, type, and value for the new attribute.
Use the Component Parameters section to add parameters that were defined when implementing the factory class.
For example, if you are adding an XML component, click the Add icon in the Parameters section and select xml. In the new row that is displayed, specify the XML code for the component in the value field.
Note: The xml option is displayed only if you selectedoracle.adf.rc.component.XmlComponentFactory as the component factory. |
To ensure that the component works properly, you must specify the custom component ID to be #
, and provide the name space, as shown in the following example:
<cust:panelCustomizable id="#" xmlns:cust="http://xmlns.oracle.com/adf/faces/customizable"/>
The #
value ensures that a unique ID is generated dynamically for the component.
You can add a folder using a Resource Catalog adapter so that the folder is populated dynamically. A custom folder is not added as a folder with resources to the catalog; it contains only a reference to the factory class, which displays the resources dynamically.
To add a custom folder:
From the Add menu in the Catalog section, select Custom Folder.
A customFolder
element is added to the catalog. The right side of the page displays fields to define the folder's attributes and parameters.
The Id
field is populated with the value customFolder
by default. You can specify a different value, but the ID must be unique within the catalog definition file.
In the Initial Context Factory field, specify the name of a Java class that implements the javax.naming.InitialContextFactory
interface and generates the folder based on a set of parameters.
For more information, see Section C.4, "Factory Classes Available for Adding Dynamic Resources to the Catalog."
In the Visible
field, you can specify an EL value to conditionally display this folder to specific users or groups. This attribute takes an EL value. The default value is #{true}
, which means that this resource is displayed in the catalog at all times.
Optionally, in the Custom Folder Attributes section, you can define the following attributes by choosing them from the Add menu:
Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.
Description: A description of this resource.
Subject: Keywords to facilitate keyword searching of the Resource Catalog.
ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.
IconURI: The icon to be displayed next to the resource name in the catalog.
Selecting an option on the Add menu creates a new row in the Catalog Attributes table. You can use this row to specify the name, type, and value for the new attribute.
Use the Custom Folder Parameters section to add parameters that were defined while implementing the factory class. You can bind these parameters to other artifacts in the application. Click the Add icon in the Parameters section to create a new row in the Parameters table.
You may see a dropdown menu on the Add icon if the factory class exposes parameters, for example, Content Presenter-specific factory classes provide a templateView
parameter.
A custom content provider dynamically generates zero or more catalog entries at runtime. Catalog entries include folders, links, custom folders, components, and so on. When you add a Custom Folder, a folder is created in the catalog and is displayed at runtime even if it is empty. However, when you add a Custom Content element, a folder is created in the catalog, but is displayed at runtime only if it has components inside it. Except for this difference, a custom content provider is similar to a custom folder.
To add a custom content provider:
From the Add menu in the Catalog section, select Custom Content.
A customContent
element is added to the catalog. The right side of the page displays fields to define the folder's attributes and parameters.
The Id
field is populated with the value customFolder
by default. You can specify a different value, but the ID must be unique within the catalog definition file.
In the Content Provider field, specify the fully qualified name of a class that implements the interface oracle.adf.rc.spi.plugin.catalog.CustomContentProviderV2
.
You can use the Browse icon to see a list of classes that implement this interface. Also, see Section C.4, "Factory Classes Available for Adding Dynamic Resources to the Catalog."
In the Visible
field, you can specify an EL value to conditionally display this folder to specific users or groups. This attribute takes an EL value. The default value is #{true}
, which means that this resource is displayed in the catalog at all times.
Optionally, in the Component Attributes section, you can define the following attributes by choosing them from the Add menu:
Title: A label to be used for the resource in the catalog. This attribute is defined by default. You can change its value, if required.
Description: A description of this resource.
Subject: Keywords to facilitate keyword searching of the Resource Catalog.
ToolTip: The tool tip to be displayed when you move the mouse over this resource name in the catalog.
IconURI: The icon to be displayed next to the resource name in the catalog.
Selecting an option on the Add menu creates a new row in the Catalog Attributes table. You can use this row to specify the name, type, and value for the new attribute.
Use the Custom Content Parameters section to define parameters on the folder. The parameters you define here are passed to and interpreted by the CustomContentProviderV2
implementation. Click the Add icon in the Parameters section to create a new row in the Parameters table.
In addition to the resources mentioned in the previous sections, you can add the following resources by dragging them and dropping them onto a selected folder in the catalog definition file:
Portlets, from the Application Resources pane or the Resource Palette.
Content from the Oracle UCM Content Server, from the Application Resources pane or the Resource Palette.
Task flows, from the Application Resources pane or the Resource Palette.
Note: If you add an ADF task flow to the catalog and want to export the catalog to an already deployed application, then you must deploy the task flow as a shared library to the deployed application.For more information, see Section 12.3, "Adding Custom Task Flows to Your Portal." |
Another catalog definition file, from the Application Navigator.
To edit a resource, select it in the Catalog section of the catalog definition file. The resource's attributes and parameters are displayed in the right half of the page. You can edit values for these attributes and parameters and save the catalog definition file. For details about a resource's attributes and parameters, see the section about adding that resource to the catalog.
To delete a resource, select it in the Catalog section of the catalog definition file and click the Remove selected node icon, shown in Figure 15-6.
While organizing resources in the catalog, you can move a resource to a different folder in the hierarchy. You can rearrange resources in the following ways:
Drag and drop them from one folder into another.
Use the Change Parent context menu option to move a resource to a different folder.
To rearrange a resource using the Change Parent option:
Right-click the resource in the Catalog section of the catalog definition file and select Change Parent from the context menu.
In the Change Parent dialog, shown in Figure 15-7, select the folder in which to include the resource.
Click OK.
Note: The OK button is enabled only when you select a valid location for the resource. |
Oracle WebCenter Framework exposes a large number of service data controls that can be added to application pages and task flows. In addition, you may have created SQL or Web Services data controls in JDeveloper. To enable users to add these data controls to pages and task flows, you must expose the data controls in the Resource Catalog. For this, you must add a customFolder
entry in your catalog definition file, as shown in the following example and Figure 15-8:
<customFolder id="dtDataControls" factoryClass="oracle.webcenter.datacomposer.internal.adapter.datacontrol.DTDataControlContextFactory"> <attributes> <attribute value="Design Time Data Controls" attributeId="Title"/> <attribute value="Data controls created at design time" attributeId="Description"/> <attribute value="design time data controls,DT, data controls" attributeId="Subject"/> <attribute value="/adf/webcenter/folderlists_qualifier.png" attributeId="IconURI"/> </attributes> </customFolder>
To expose the customFolder
as a translatable resource in the catalog, the folder's string attributes must be stored as resource strings in a resource bundle. For this, the catalog definition file must have a resourceBundle
attribute and each translatable attribute must have an isKey
attribute. Then the attribute value is saved in a resource bundle, as shown in the following example:
The resourceBundle attribute on the catalog definition:
<catalogDefinition id="DefaultCatalog" visible="#{true}"
resourceBundle="oracle.webcenter.portalapp.catalogs.DefaultCatalogBundle"
definitionFilter="portal.catalog.DefaultCatalogFilter"
xmlns="http://xmlns.oracle.com/adf/rcs/catalog">
The isKey
attribute defined on the attributes of a translatable resource:
<customFolder id="dtDataControls" factoryClass="oracle.webcenter.datacomposer.internal.adapter.datacontrol.DTDataControlContextFactory"> <attributes> <attribute value="DATACONTROL_FOLDER.TITLE" isKey="true" attributeId="Title"/> <attribute value="DATACONTROL_FOLDER.DESCRIPTION" attributeId="Description" isKey="true"/> <attribute value="DATACONTROL_FOLDER.KEYWORDS" attributeId="Subject" isKey="true"/> <attribute value="/adf/webcenter/folderlists_qualifier.png" isKey="false" attributeId="IconURI"/> </attributes> </customFolder>
For more information about using resource bundles, see Section 21.12, "Configuring Runtime Resource String Editing."
At runtime, the catalog displays a folder titled Design Time Data Controls
irrespective of whether the application has any design-time data controls.
In a deployed application, the Resource Manager allows you to add design-time data controls individually to custom catalogs. Out-of-the-box catalogs cannot be edited at runtime. For more information, see "Adding Resources" in Oracle Fusion Middleware User's Guide for Oracle WebCenter Spaces.
Exposing Custom Data Controls in an Already Deployed Application
If you created SQL or Web Services data controls in your application, and want to expose them in an already deployed application, you must perform the following steps:
Package the application into an ADF shared library.
Deploy the application to the WebLogic Server instance. For more information, see Section 49.2.3, "Rebuilding the WebCenter Spaces Shared Library List."
When you perform this configuration, the deployed data controls are available in the Design Time Data Controls folder in the runtime Resource Registry. Users can add the data controls from the registry to any custom Resource Catalog, from where they can be consumed in pages and task flows.
Users can create data controls at runtime in the Resource Manager. If you want your Resource Catalog to dynamically display data controls created at runtime, add a customFolder
entry in your catalog definition file, as shown in the following example:
<customFolder id="rtDataControls" factoryClass="oracle.webcenter.datacomposer.internal.adapter.datacontrol.DataControlContextFactory"> <attributes> <attribute value="Runtime Data Controls" attributeId="Title"/> <attribute value="Data controls created at runtime" attributeId="Description"/> <attribute value="runtime data controls,RT,data controls" attributeId="Subject"/> <attribute value="/adf/webcenter/folderlists_qualifier.png" attributeId="IconURI"/> </attributes> </customFolder>
To expose this folder as a translatable resource, the folder's string attributes must be stored as resource strings in a resource bundle. See Section 15.2.4, "How to Expose Data Controls Created at Design Time" for an example of how to create translatable resources.
At runtime, the catalog displays a folder titled Runtime Data Controls
irrespective of whether the folder has any data controls.
Out-of-the-box, a Resource Catalog displays portlets from all the available producers irrespective of whether the portlets are secured or not. As a result, users are allowed to consume even secured portlets to which they do not have access. When a user adds such a portlet to a page, the portlet component is added, but it does not display any content. To ensure that users view and consume only those portlets that they can access, you can control the visibility of portlets in the Resource Catalog. Implement the PortletItemSecurityHelper
interface to display portlets conditionally in the Resource Catalog, based on the user's permissions.
To control portlet visibility:
Implement the PortletItemSecurityHelper
interface in your own item security helper class, for example, CustomPortletSecurityHelper.java
.
Example 15-1 shows a sample implementation of the PortletItemSecurityHelper
interface. The following assumptions are made for the purpose of this example:
Grants are defined for each portlet to control who can see it.
A permission class, PortletVisibilityPermission
, is defined to check a user's permissions on the portlet.
Example 15-1 Sample Implementation of PortletItemSecurityHelper
public class CustomPortletSecurityHelper extends PortletItemSecurityHelper { public boolean canView(String producerId, String portletId) { String permissionPath = producerId + '/' + portletId; PortletVisibilityPermission permission = new PortletVisibilityPermission (permissionPath, VIEW_ACTION); try { // throws AccessControlException if the permission is not granted JpsAuth.checkPermission(permission); canView = true; sLogger.logp(Level.FINE, SOURCE_CLASS, method, "PortletVisibilityPermission check passed. Producer={0}, Portlet={1} Action=view", new Object[]{producerId, portletId}); } catch(AccessControlException ace) { canView = false; sLogger.logp(Level.FINE, SOURCE_CLASS, method, "PortletVisibilityPermission check passed. Producer={0}, Portlet={1} Action=view", new Object[]{producerId, portletId}); } return canView; } }
Create an rc_ext.xml
file in the application's META-INF
directory, and add the following code to register the implementation with the Resource Catalog:
<extension xmlns:="http://xmlns.oracle.com/adf/rc/extension" id="your.extension.id" name="Your Extension Name" version="11.1.1.4.0"> <item-security-helper class="your.implementation.class.name"/> </extension>
At runtime, when a user clicks Add Content in Oracle Composer, the Resource Catalog displays only those portlets on which the user has permissions.
You can configure the default Resource Catalog at the application and page levels in the following ways:
Registering it in the application's adf-config.xml
file. This is an application-wide setting. For more information, see "Registering the Catalog in the adf-config.xml File".
If you have multiple catalogs, by adding the CatalogSelector
, which includes the logic to determine which catalog is shown for a specific page or locale. For more information, see Section 15.5.1, "How to Configure Multiple Resource Catalogs."
If your application page contains Oracle Composer components, then by specifying the catalog name in the Catalog
attribute on the Page Customizable
component. You can specify a static or EL value. For more information, see Section B.1.1, "Page Customizable."
Registering the Catalog in the adf-config.xml File
To register a Resource Catalog in the adf-config.xml file so that it is used as the default catalog for the application:
Open the application's adf-config.xml
file.
Change the catalog-name
attribute value in the <rcv:rcv-config>
element and specify the custom catalog name, as shown in the following example:
<rcv:rcv-config> <rcv:default-catalog catalog-name="/oracle/webcenter/portalapp/catalogs/myCustomCatalog.xml"/> </rcv:rcv-config>
The catalog-name
attribute identifies the catalog to be used as the default one.
The path you specify is relative to the Resource Catalog root directory, for example, if you saved your new catalog definition as C:\JDeveloper\mywork\RCSampleApp\Portal\Public_Html\oracle\webcenter\portalapp\catalogs\myCustomCatalog.xml
, then the catalog-name
value would be /oracle/webcenter/portalapp/catalogs/myCustomCatalog.xml
. The name uses the /
separator because it represents a part of an MDS path.
Note: For information about the Resource Catalog-specific configurations you can make inadf-config.xml , see Section B.2.2, "adf-config.xml." |
Save the adf-config.xml
file.
To correctly implement resource catalogs, you must know where the application looks for the definitions and the XML schema upon which the definitions are based. See Appendix B, "Oracle Composer Component Properties and Files" for further information.
At runtime, when you add a task flow from the Resource Catalog to your application page in Oracle Composer, the task flow is automatically enclosed in a Show Detail Frame
component. You can initialize attributes, such as the title, height, or width, associated with the enclosing Show Detail Frame
by defining those attributes in the catalog definition file that contains the task flow. To differentiate the task flow's properties from the enclosing Show Detail Frame
's properties, you must use attr.
as a prefix for Show Detail Frame
properties.
For example, if a user adds a task flow to a page with a dark background setting, the task flow continues to use the background setting of the enclosing Show Detail Frame
component. This may not be the look the user wants. To enable the user to change the Show Detail Frame
's background property, you must initialize and expose the background attribute in the Resource Catalog. At runtime, while editing the task flow's properties, a user can also change the Show Detail Frame
's background attribute.
Similarly, you can also initialize task flow parameters. You can define such parameters in the catalog definition file using an EL expression. At runtime, while editing the task flow's properties, a user can also change values for the exposed parameters. To differentiate the task flow's properties from the initialized parameters, you must use parameter.
as a prefix for such parameters.
To initialize task flow parameters and Show Detail Frame
properties:
Open the catalog definition file that contains the task flow.
Within the task flow's <resource>
element, add an <attribute>
entry for each parameter and Show Detail Frame
attribute you want to define.
The attributeId
for a parameter must contain the parameter name along with a prefix of parameter.
; the attributeId
for a Show Detail Frame
attribute must contain the attribute name along with a prefix of attr.
as shown in the following example:
<url visible="#{true}" factoryClass="oracle.webcenter.portalframework.sitestructure.rc.TaskFlowResourceFactory" id="wallMiniView" url="taskflow://oracle/webcenter/peopleconnections/wall/controller/taskflows/WallViewer.xml#WallViewer"> <attributes> <attribute value="WALL_MINIVIEW.TITLE" attributeId="Title" isKey="true"/> <attribute value="WALL_MINIVIEW.DESCRIPTION" attributeId="Description" isKey="true"/> <attribute value="#{securityContext.userName}" attributeId="parameter.userName"/> <attribute value="false" attributeId="attr.stretchContent"/> <attribute value="never" attributeId="attr.showResizer"/> </attributes> <contents/> </url>
Note: Include theisKey attribute and set it to true only if the value is coming from a resource bundle. If not included, the isKey value defaults to false . |
Save the catalog definition file.
The Resource Manager in a WebCenter Portal application enables users with administrative privileges to create and modify application resources at runtime. By exposing catalogs in the Resource Manager, you allow administrators to manage these catalogs at runtime. You can also export selected catalogs from JDeveloper so that administrators can modify or delete them at runtime
This section outlines the tasks you can perform in JDeveloper to enable runtime administration of your catalogs. It contains the following sections:
Section 15.3.2, "Enabling Further Development of Deployed Resource Catalogs"
Section 15.3.3, "Working with WebCenter Spaces Resource Catalogs"
In JDeveloper, use the Resource Manager-specific options on the context menu on a catalog definition file as follows:
Create Portal Resource: Creates an entry for the catalog in the Resource Manager. The catalog can then be selected for use during page, template, and task flow creation.
You must set certain attributes while creating an entry. Optionally, you can specify who can revise and delete the selected catalog in the Resource Manager. For more information, see Section 16.2.1, "How to Add a Resource to the Resource Manager."
Update Portal Resource: Edit the attributes that you defined while creating Resource Manager entries. For more information, see Section 16.2.2, "How to Update Portal Resource Properties."
Remove Portal Resource: Remove the entry for this catalog from the Resource Manager registry. For more information, see Section 16.2.3, "How to Remove a Resource from the Resource Manager."
Out-of-the-box Resource Catalogs cannot be modified or deleted at runtime. However, users with administrator privileges can make a copy of an out-of-the-box Resource Catalog and edit its properties or delete it.
The Edit Source option in the Resource Manager enables users to modify the content of a copied or custom Resource Catalog at runtime. However, as text editing is easier in JDeveloper than in the runtime source editor, users may choose to download a Resource Catalog, edit it in JDeveloper, and upload it back to the deployed application. At design time, this type of round-trip development includes importing the downloaded Resource Catalog, editing it in JDeveloper, and exporting it so that it can be uploaded back to the deployed application.
This section describes how to import and export Resource Catalogs in JDeveloper. For information about modifying catalog content, see Section 15.2.3, "How to Manage Content in the Resource Catalog."
To expose a Resource Catalog in an already deployed application, you must export it from JDeveloper, then upload to the application using the runtime Resource Manager. When you export a catalog in JDeveloper, an EAR file is created with the catalog definition file and the generic-site-resources.xml
file. The generic-site-resources.xml
file contains metadata that helps identify the type of resource, a Resource Catalog in this case, so that the resource is displayed under the correct category in the Resource Manager.
For generic information, see Section 16.4.4, "How to Export a Portal Resource from JDeveloper."
When you expose a Resource Catalog at runtime, users with privileges can add or delete components to suit their business requirements. However, to perform more complex tasks, such as applying catalog filters or adding custom resources that are not available in the deployed application, the runtime catalog must be downloaded, imported into JDeveloper and edited, exported from JDeveloper, and uploaded back to the runtime application.
Note: To expose custom resources, such as task flows created in JDeveloper, that are not available in the deployed application, along with exporting the catalog you must also deploy the resource as a shared library. |
When a user downloads a catalog from a deployed application, an EAR file is created containing the catalog definition XML file and the generic-site-resources.xml
file. The generic-site-resources.xml
file contains metadata specific to the Resource Catalog. This helps in identifying the type of resource, a Resource Catalog in this case. To edit the Resource Catalog in JDeveloper, you must first import the EAR file. On importing, the catalog definition file is extracted to the siteResources
folder.
If the resource was downloaded from WebCenter Spaces, it is extracted to APPLICATION_ROOT
/oracle/webcenter/siteresources/scopedMD/guid
, where guid
is the GUID of the Space from which the resource was downloaded. Otherwise, the imported resource is created in APPLICATION_ROOT
/oracle/webcenter/
portalapp
. You can open the catalog definition file and edit it as you would any other catalog at design time. The updated catalog must then be exported to the runtime application.
For generic information, see Section 16.4.3, "How to Import a Portal Resource into JDeveloper."
For information about downloading a catalog from the deployed application, see "Uploading and Downloading a Resource Catalog" in Oracle Fusion Middleware User's Guide for Oracle WebCenter Spaces.
Out-of-the-box, WebCenter Spaces provides several default Resource Catalogs for people to use. If these default catalogs are not suitable, you can build catalogs of your own within WebCenter Spaces. For details, see the chapter "Working with the Resources that Compose a Portal or Community" in the Oracle Fusion Middleware User's Guide for Oracle WebCenter Spaces.If you want to create a Resource Catalog that is beyond the editing capabilities of WebCenter Spaces, you can create the catalog in JDeveloper and then upload it to WebCenter Spaces. You do not have to develop the catalog from scratch, you can export an existing catalog from WebCenter Spaces and edit it in JDeveloper, or use one of the out-of-the-box catalogs as your starting point.
WebCenter provides a special JDeveloper workspace (DesignWebCenterSpaces.jws
) to help you develop and upload resources, such as Resource Catalogs, to WebCenter Spaces. Chapter 49, "Extending WebCenter Spaces Using JDeveloper" tells you where to find the sample workspace and explains how to use the WebCenterSpacesResources
project to build custom catalogs and other types of resources for WebCenter Spaces. For details, see Section 49, "Extending WebCenter Spaces Using JDeveloper."
If you want to arrange catalog content so that it is essentially the same for all users, but displays different subsets of the content to different users, then you can configure your Resource Catalog to filter out selected items based on specific criteria.
For example, if two users A
and B
have different privileges on a page, you can configure your application to display the entire catalog to user A
and only a subset of items in the catalog to user B
.
You can filter resources in the catalog either at the catalog level or at the individual resource level. This section explains both procedures. It contains the following sections:
You can display a resource conditionally by specifying an EL value for the Visible
attribute on the resource. For information about editing the Visible attribute, see Section 15.2.3, "How to Manage Content in the Resource Catalog."
To apply a filter on the catalog, you must implement the oracle.adf.rc.spi.plugin.catalog.CatalogDefinitionFilter
interface. Additionally, you must associate this filter with the Resource Catalog.
To implement the CatalogDefinitionFilter
:
From the File menu, choose New.
In the New Gallery dialog, expand General, select Java, and then Java Class, and click OK.
In the Create Java Class dialog, specify a name for the class, for example, CatalogFilter
.
Under the Optional Attributes section, add the oracle.adf.rc.spi.plugin.catalog.CatalogDefinitionFilter
interface.
Click OK.
Specify the logic for filtering items.
Note: When implementing the filter logic it is common to want information about the current user and current page. This information can be obtained from theFacesContext . |
Example 15-2 shows a sample CatalogDefinitionFilter
implementation. It is configured to hide the Discussions
folder (forumsFolder
) for user jdoe
from the custom catalog, users-catalog.xml
, described in Section 15.2, "Creating a Custom Resource Catalog." The entire catalog, with the ADF Faces Components
and Discussions
folders, is shown to all other users.
Example 15-2 Sample Showing CatalogDefinitionFilter Implementation
package webcenter; import oracle.adf.rc.catalog.CatalogElement; import oracle.adf.rc.spi.plugin.catalog.CatalogDefinitionFilter; import java.util.Hashtable; import javax.faces.context.ExternalContext; import javax.faces.context.FacesContext; public class CatalogFilter implements CatalogDefinitionFilter { public boolean includeInCatalog(CatalogElement element, Hashtable env) { ExternalContext ectx =FacesContext.getCurrentInstance().getExternalContext(); if ("jdoe".equals(ectx.getRemoteUser()) && "forumsFolder".equals(element.getId())) return false; else return true; } }
Open the catalog definition file.
Select the root node in the Catalog section, and set the Catalog Filter field to the name of the Java class you created, for example, webcenter.CatalogFilter
.
This adds a definitionFilter
attribute in Source view of the file.
Save the catalog definition file.
You can expose different catalogs to different users based on specific criteria, such as the page being edited, the user, or the user role. This section describes how to associate multiple Resource Catalogs with your application. It contains the following subsections:
To use multiple catalogs, you must implement the ResourceCatalogSelector
API to select the appropriate catalog for the user and the page being edited. You must include the catalog-selector
entry in your application's adf-config.xml
file to specify the name of your ResourceCatalogSelector
class. If you do not specify a catalog-selector
, the default catalog is used for all editable pages and all users see the same content. If you specify a catalog-selector
, the default catalog is used only when the specified selector returns null.
To implement multiple resource catalogs:
Create your custom catalogs by performing the steps outlined in Section 15.2, "Creating a Custom Resource Catalog."
Implement the oracle.adf.rc.model.config.ResourceCatalogSelector
interface in your own resource catalog selector class, for example, CatalogSelector.java
.
Example 15-3 shows a catalog selector implementation where a custom Resource Catalog, admin-catalog.xml
, is shown to ahunold
who has administrator privileges, and users-catalog.xml
is shown to users sking
and jdoe
. If there is a problem with rendering either of these catalogs, then the default catalog is shown to users.
Example 15-3 Sample ResourceCatalogSelector Showing Entries for Multiple Resource Catalogs
package webcenter; import javax.faces.context.FacesContext; import java.util.Map; import javax.faces.component.UIViewRoot; import javax.faces.context.FacesContext; import javax.faces.context.ExternalContext; import oracle.adf.rc.model.config.ResourceCatalogSelector; import oracle.adf.rc.model.dc.RCVContext; import oracle.adf.rc.model.config.ResourceCatalogSelector; /** * CatalogSelector is a sample implementation of the ResourceCatalogSelector * interface. * * This implementation is based on the authenticated user */ public class CatalogSelector implements ResourceCatalogSelector { public CatalogSelector() { } /** * Returns the Id of the catalog that must be used for the current * user. * * @param context a Map cont * @return id of the catalog to be used for the current user or * null if the default catalog must be used. */ public String getCatalogName(Map context) { // if no catalog is selected, return null & the composer uses the // default catalog defined in the rcv-config String retval = null; // get information about the current user. FacesContext fctx = FacesContext.getCurrentInstance(); ExternalContext ectx = fctx.getExternalContext(); String user = ectx.getRemoteUser(); if (user == null || user.length() == 0) { // user name is not available so use the default catalog retval = null; } else if (user.equals("jdoe") || user.equals("sking") ) { // return users-catalog for users jdoe and sking retval = "users-catalog"; } else if (user.equals("ahunold")) { // return admin-catalog for user ahunold retval = "admin-catalog"; } return retval; } }
In your adf-config.xml
file, enter the name of the class you created for selecting a resource catalog with the <rcv:catalog-selector>
tag as show in the following example:
<rcv:rcv-config> <rcv:default-catalog catalog-name="/oracle/webcenter/portalapp/catalogs/default-catalog.xml"/> <rcv:catalog-selector class-name="webcenter.CatalogSelector"/> </rcv:rcv-config>
The value for catalog-name
corresponds to the default catalog definition file with the MDS path.
Note: For information about the Resource Catalog-specific configurations you can make inadf-config.xml , see Section B.2.2, "adf-config.xml." |
Different catalogs are displayed to users based on the criteria you specified.
Based on the ResourceCatalogSelector
implementation in Example 15-3, Figure 15-9 and Figure 15-10 show the two catalogs that are shown to user sking
or jdoe
and to administrator ahunold
respectively.
Figure 15-9 Catalog Displayed to sking and jdoe
Figure 15-10 Resource Catalog Displayed to the ahunold
This section provides information to assist you in troubleshooting problems you may encounter while using the Resource Catalog.
For information about configuring logging, see "Configuring ADF Logging for Oracle Composer".
Problem
Resource Catalog is empty.
Solution
The default catalog is not available to MDS. Ensure that the deployment profile contains the necessary entries to copy the default catalog file. Also, ensure that in the MDS section of adf-config.xml
, a namespace entry points to the default catalog file.
Problem
A project task flow does not appear in the Resource Catalog.
Solution
The task flow must be packaged as an ADF Library (JAR file) and added to the project. You must also ensure that the task flow ID is given in the following format:
taskflow://Path_to_Task_Flow/Task_Flow_Definition_File_Name#Task_Flow_ID Ex. taskflow://oracle/webcenter/peopleconnections/wall/controller/taskflows/WallViewer.xml#WallViewer