13 Integrating Content

Oracle WebCenter enables content integration through:

This chapter discusses how to configure connections to content repositories to provide access to the content, and how to add content to pages in a custom WebCenter application. For more information about managing and including content in your WebCenter applications, see:

This chapter includes the following sections:

13.1 Introduction to Content Integration

Oracle WebCenter's content integration capabilities enable you to include in your WebCenter applications decentralized content located across multiple repositories through the Documents service task flows or JCR adapters using JCR APIs.

  • The Documents service includes the Content Presenter, Document Manager, Document List View, and Recent Documents task flows, to provide different ways of integrating content into a custom WebCenter application. For information about the Documents service and its task flows, see Chapter 14, "Integrating the Documents Service".

    The Content Presenter task flow allows you to add content from an Oracle Content Server content repository to a page in your WebCenter application, rendering the content in a selected display template. A Content Presenter task flow can be added either:

  • JCR APIs enable independent access to content, regardless of the underlying repository or the type of the content; for example, documents, relational content, and so on. The JCR 1.0 API, as defined in JSR 170, provides a set of basic capabilities for reading, writing, browsing, and searching content. The JCR data controls also enable you to connect to and read from other JCR 1.0 repositories. To add content available in Oracle Content Server, Oracle Portal, Oracle WebCenter Adapter for Microsoft SharePoint, and file systems to JSF pages, you first create connections to the repositories, then use the connections to create data controls based on the repositories.

This section provides overview information about the provisions that enable you to use these methods to integrate content into your custom WebCenter applications:

13.1.1 Overview of Content Adapters

In your custom WebCenter application, the following adapters are integrated by default.

  • Oracle Content Server: The Oracle Content Server adapter is used to integrate content from an automated information system managed by Oracle Content Server. This system enables sharing, managing, and distributing of business information through a Web site as a common access point.

  • Oracle Portal: The Oracle Portal adapter is used to integrate content from a content repository located in the Oracle Portal schema.

  • Oracle WebCenter Adapter for Microsoft SharePoint: This adapter is used to integrate content from the Microsoft SharePoint 2007 repository.

  • File System: The File System adapter is used to add content located on your operating system's file system to JSF pages.

    Note:

    The File System adapter is intended to be used in the development environment only.

The Oracle Content Server, Oracle Portal, and file system adapters are bundled with Oracle WebCenter Extension bundle.

13.1.2 Overview of Content Presenter Display Templates and the Templates Registry

A Content Presenter display template is a JSFF file (JSF page fragment) that defines how content repository items should render on a page. Several useful display templates are provided out-of-the-box to get you started (see Table 14-4 and Table 14-5). Additionally, you can develop custom display templates to handle custom content properties or to satisfy specific content rendering requirements within your organization. Template development supports the full set of Rich ADF components so you can quickly and easily create robust and attractive templates to display your content.

Content Presenter display templates can handle either one content item or multiple content items. Templates that handle multiple content items can optionally take advantage of single item templates. For example, a multiple content item template could render tabs for each item and also call on a single item template to be used below the selected tab to render the details of that item.

Each content item is associated with a specific content type defined in the Oracle Content Server repository. A content type defines the properties of the content item. As a custom display template developer, you will need to know the names of the properties defined for the associated content type so that you can define how to display the selected content item(s) on the page. One way to determine the properties for the existing content types defined in Oracle Content Server is to use the Content Presenter Configuration dialog in WebCenter Spaces.

The Content Presenter templates registry (templates-registry.xml) maintains the registry of available display templates for use with Content Presenter. The default registry contains the default display templates provided out-of-the-box. As you create custom display templates, you must add a section for each template that you develop to the templates registry file.

Custom Content Presenter display templates not only allow you to provide specialized rendering of content items, but they can also be used to standardize the display of content items that are different. For example, consider a scenario where you want to create a list of Press Releases, but there are two different kinds of Press Releases defined in your content repository, each one using different property names for the short title and long body. You can create two custom display templates with similar formatting, then create a custom multiple item Press Release listing template to choose the correct single item template for each of the two kinds of Press Releases based on their content type.

At runtime, Content Presenter checks the templates registry to identify the display templates that can render the currently selected content item(s), and presents these templates to the end user for selection in the Content Presenter Configuration dialog.

For steps and examples, see Section 13.4, "Creating Custom Templates for Displaying Content Using Content Presenter".

13.1.3 Overview of Content Data Controls

A content data control is a container for all the data objects, collections, methods, and operations used to create user interface (UI) components within your custom WebCenter application. The data controls provide you with easy-to-use methods that you can drag and drop onto JSF pages to publish content as ADF components, such as URLs, files, and folders. While methods, parameters, and default attributes to publish content are similar across all JCR data controls, the content integration module gives you the flexibility to customize attributes based on your requirements.

Each type of content data control contains methods and parameters to publish content as links, tables, files, and folders, and to add search and advanced search capabilities for your content. Parameters include two types of attributes: default and custom. The default attributes are common across File System, Oracle Portal, and Oracle Content Server data controls. The custom attributes are requirement-specific and can be added while creating content data controls.

The following sections describe the methods, parameters, and default attributes that are common across File System, Oracle Portal, and Oracle Content Server data controls:

13.1.3.1 The getItems Method

The getItems method returns the files and folders stored starting at a particular location in the repository. This method enables you to publish content in forms, tables, and hierarchical trees. Using this method, you can also create navigation lists and buttons.

Table 13-1 describes the parameters of the getItems method.

Table 13-1 Parameters of the getItems Method

Parameter Description

path

Defines the starting point for getItems.

type

Specifies what should be returned: only files, only folders, or any object.


The getItems method returns the attributes described in Table 13-2.

Table 13-2 Return Attributes of the getItems Method

Parameter Description

name

Describes the name of the returned file or folder.

path

Describes the location of the returned file or folder within the content repository.

URI

The direct access URL of a file or folder.

primaryType

Describes whether the returned object is a file or folder or some other type.


13.1.3.2 The search Method

The search method enables you to create a simple search by name pattern or keyword.

Table 13-3 describes the parameters of the search method.

Table 13-3 Parameters of the search Method

Parameter Description

path

Starting path of the search.

isRecursive

Specifies whether only the specified folder (=false) or the whole tree starting at the specified path (=true) should be searched.

The default value is false, that is, if this field is left blank, then the search is performed in the specified folder. Only if the value is true, the search is performed in the entire hierarchy.

keyword

Search keyword for full text search.

namePattern

Pattern search on name. Use the % wildcard to match any number of characters and the _ wildcard to match one character.


The search method returns the attributes described in Table 13-4.

Table 13-4 Return Attributes of the search Method

Parameter Description

name

Describes the name of the returned file or folder.

path

Describes the location of the returned file or folder within the content repository.

URI

The direct access URL of a file or folder.

primaryType

Describes whether the returned object is a file or folder or some other type.


13.1.3.3 The advancedSearch Method

The advancedSearch method enables you to perform an advanced search by creating a set of search criteria out of any available attribute.

Table 13-5 describes the parameters of the advancedSearch method.

Table 13-5 Parameters of the advancedSearch Method

Parameter Description

path

Starting path of the search.

isRecursive

Specifies whether only the specified folder (=false) or the whole tree starting at the specified path (=true) should be searched.

The default value is false, that is, if this field is left blank, then the search is performed in the specified folder. Only if the value is true, the search is performed in the entire hierarchy.

keyword

Search keyword for full text search.

namePattern

Pattern search on name. Use the % wildcard to match any number of characters and the _ wildcard to match one character.

matchAny

Specifies whether all predicates (=false) or any predicate (=true) should be matched.

predicates

A collection of SimplePredicate parameters that consist of attributes, comparators, and values.

type

Specifies what should be returned: only files, only folders, or any object.


The advancedSearch method returns the attributes described in Table 13-6.

Table 13-6 Return Attributes of the advancedSearch Method

Parameter Description

name

Describes the name of the returned file or folder.

path

Describes the location of the returned file or folder within the content repository.

URI

The direct access URL of a file or folder.

primaryType

Describes whether the returned object is a file or folder or some other type.


13.1.3.4 The getURI Method

The getURI method returns the URI attribute, which is the direct access URL of the file or folder. Its path parameter describes the path to the object. You can use this method to create links to content and to inline content in your page. The getURI method returns the URI attribute.

13.1.3.5 The getAttributes Method

The getAttributes method returns the list of attributes and their values for a given file or folder. Its path parameter describes the path to the object.

Table 13-7 describes the attributes that the getAttributes method returns.

Table 13-7 Return Attributes of the getAttributes Method

Parameter Description

name

Name of the attribute.

value

Value of the attribute.


13.2 Configuring Content Repository Connections

Content repository connections are required to access the repository content to be published on JSF pages. This section describes how to configure content repository connections based on Oracle Content Server, Oracle Portal, and file system adapters.

Content Presenter can connect to and retrieve content available in Oracle Content Server content repositories. With JCR data controls, you can connect to Oracle Content Server, Oracle Portal, and file systems.

Connections can be created under Application Resources in the Application Navigator and under IDE Connections in the Resource Palette, as described in Section 3.10, "Accessing Connection Wizards".

This section includes the following subsections:

13.2.1 How to Create a Content Repository Connection Based on the Oracle Content Server Adapter

This section describes how to configure an Oracle Content Server-based content repository connection. To successfully perform the subsequent steps, you must use Oracle Content Server release 10.1.3.4.1 or 10.1.3.5 (required for Content Presenter). For information about how to configure Oracle Content Server for Oracle WebCenter, see "Oracle Content Server Prerequisites" in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

To create an Oracle Content Server-based repository connection:

  1. In Oracle JDeveloper, open your WebCenter application.

  2. In the Application Resources panel, right-click Connections and choose New Connection, then Content Repository.

  3. In the Create Content Repository Connection dialog, specify a connection name for the connection; for example, MyOCSConnection.

    Tip:

    You can choose between creating application-specific connections in the Application Resources panel and creating common connections in the Resource Palette (IDE Connections).
  4. Select Oracle Content Server from the Repository Type box.

  5. Select Set as primary connection for Documents service, if you intend to make it the default connection for the Documents service. Selecting this option writes a configuration to the adf-config.xml file that identifies this connection as the default connection for the Documents service. If a Document Library task flow is used without any connectionName input parameter, then this connection is used. For information about the Documents service, see Chapter 14, "Integrating the Documents Service".

    Note:

    To be able to set a connection as primary connection for the Documents service, you must select the Application Resources option in Create Connection In. This is because connections created as IDE connections cannot be used directly, they must be added to applications.
  6. Under Configuration Parameters, enter values for the parameters, as shown in Table 13-8 and Figure 13-1.

    Table 13-8 Configuration Parameters for Oracle Content Server

    Configuration Parameters Values

    RIDC Socket Type

    Determines whether the client library connects on the Content Server listener port or the Web server filter. It accepts socket, socketssl, or web.

    socket: Uses an intradoc socket connection to connect to the Oracle Content Server. The client IP address must be added to the list of authorized addresses in the Oracle Content Server.

    socketssl: Uses an intradoc socket connection to connect to the Oracle Content Server that is secured using the SSL protocol. The client's certificates must be imported in the server's trust store for the connection to be allowed.

    web: Uses an HTTP(S) connection to connect to the Oracle Content Server.

    Table 13-9 includes more information on the configuration parameters required for each RIDC socket type.

    Server Host Name

    Host name of the system where the Oracle Content Server is running. For example: mycontentserver.mycompany.com.

    Content Server Listener Port

    Port of the server specified in the Server Host Name field. For example: 4444.

    URL of the Web Server Plugin

    If the RIDC socket type is web, then the URL must be in this format: http://host_name/web_root/plugin_root. For example: http://mycontentserver/cms/idcplg

    Admin Username

    The user name with administrative rights for the Oracle Content Server instance. It defaults to sysadmin.

    Admin Password

    The password for the Oracle Content Server admin user. For example: password. This is needed for web connection only.

    KeyStore File Location

    Location of key store that contains the private key used to sign the security assertions. The key store location must be an absolute path. For example: c:\keys\keystore.xyz.

    KeyStore Password

    The password required to access the keystore.

    Private Key Alias

    The client private key alias in the keystore. The key is used to sign messages to the server. The public key corresponding to this private key must be imported in the server keystore.

    Private Key Password

    The client private key password required to retrieve the key from the keystore.

    Cache Invalidation Interval

    The polling interval used by the Oracle Content Server service provider interface (SPI) to check for cache invalidations. This interval is calculated in minutes and defaults to 0. The value 0 disables cache invalidation. The minimum value is 2 minutes.

    Binary Cache Maximum Entry Size

    The maximum size of documents stored in the virtual content repository (VCR) binary cache. The value is calculated in bytes and defaults to 1024 (100kb).


    Table 13-9 Oracle Content Server Connection Parameters for Each RIDC Socket Type

    Connection Parameters RIDC Socket Type: web RIDC Socket Type: socket RIDC Socket Type: socketssl

    Server Host Name

    Not applicable

    Optional

    Defaults to local host.

    Optional

    Defaults to local host.

    Content Server Listener Port

    Not applicable

    Port specified for the incoming provider in the server.

    Defaults to 4444.

    Port specified for the sslincoming provider in the server.

    Defaults to 4444.

    URL of the Web Server Plugin

    Mandatory

    Not applicable

    Not applicable

    Admin Username

    Optional

    Defaults to sysadmin

    Optional

    Defaults to sysadmin

    Optional

    Defaults to sysadmin

    Admin Password

    Mandatory

    Not applicable

    Not applicable

    Key Store and Private Key

    Not applicable

    Not applicable

    Mandatory

    Identity Propagation

    Not supported at runtime

    Supported

    For testing purpose, connects as guest if no/invalid user name is specified.

    Supported

    For testing purpose, connects as guest if no/invalid user name is specified.

    External Application

    Mandatory

    Supported

    Password is not used.

    Supported

    Password is not used.

    User Name and Password

    Supported

    Supported

    The password is not verified during the test connection operation.

    Supported

    The password is not verified during the test connection operation.


    Figure 13-1 Content Repository Connection - Oracle Content Server

    Description of Figure 13-1 follows
    Description of "Figure 13-1 Content Repository Connection - Oracle Content Server"

  7. In the Login Timeout (ms) field, specify the time in milliseconds. This timeout determines how long the application must wait when trying to establish a session with the content repository. If the network connection or the content repository server to which you are trying to connect is slow, then consider overriding the default value specified in this field.

  8. Select the applicable authentication method. See Section 13.2.6.1, "What You Should Know About Using Identity Propagation and External Application Authentication Methods" for information. If you select the Identity Propagation authentication method, then you must configure secure socket layer (SSL) in Oracle Content Server. For information, see the section "Oracle Content Server - Security Considerations" in Oracle Fusion Middleware Administrator's Guide for Oracle WebCenter.

  9. User Name and Password fields under the Specify login credentials for the current JDeveloper session checkbox are optional for the Identity Propagation authentication method.

    Note:

    If the Specify login credentials for the current JDeveloper session checkbox is selected, then the credentials you entered are used. If the checkbox is not selected, then the connection is tested using External Application credentials (if they exist), otherwise null credentials are used.

    If you have selected External Application for authentication and also specified either public or shared credentials, then you can leave these fields blank, as the public or shared credentials can be used to login at design time. However, if you have selected External Application but have not specified public or shared credentials, then you must specify user name and password here.

  10. Click OK.

  11. In the Application Resources panel, expand the repository connection you just created. The Connection Credentials dialog displays.

    Note:

    The Connection Credentials dialog displays if you do not save the credentials, that is, you do not select the Specify login credentials for the current JDeveloper session checkbox, or if you do not specify an External Application service that uses public or shared credentials.
  12. Enter the User Name and Password for the Oracle Content Server connection and click OK. The connection displays under the Application Resources panel.

13.2.2 How to Create a Content Repository Connection Based on the Oracle Portal Adapter

This section describes how to create a content repository connection based on the Oracle Portal adapter. Before creating a repository connection, see Section 13.2.6, "What You May Need to Know When Creating a Repository Connection". You can use this connection to configure a content data control that will enable you to add content from the Oracle Portal repository to JSF pages.

To create an Oracle Portal repository connection:

  1. In Oracle JDeveloper, open your WebCenter application.

  2. In the Application Resources panel, right-click Connections and choose New Connection and then Content Repository.

  3. In the Create Content Repository Connection dialog, specify a name for the connection; for example, MyOraclePortal.

    Tip:

    You can choose between creating application-specific connections in the Application Resources panel and creating common connections in the Resource Palette (IDE Connections).
  4. Select Oracle Portal from the Repository Type box, as shown in Figure 13-2.

    Figure 13-2 Content Repository Connection - Oracle Portal

    Description of Figure 13-2 follows
    Description of "Figure 13-2 Content Repository Connection - Oracle Portal"

  5. Select Set as primary connection for Documents service, if you intend to make it the default connection for the Documents service. Selecting this option writes a configuration to the adf-config.xml file that identifies this connection as the default connection for the Documents service. If a document library task flow is used without any connectionName input parameter, then this connection is used. For information about the Documents service, see Chapter 14, "Integrating the Documents Service".

    Note:

    To be able to set a connection as primary connection for the Documents service, you must select the Application Resources option in Create Connection In. This is because connections created as IDE connections cannot be used directly, they must be added to applications.
  6. Select a connection from the Database Connection list, or create a new connection to the Oracle Portal schema:

    1. In the Create Database Connection wizard, specify the connection name and type.

    2. Enter the database user name and password of the Oracle Portal schema. By default, the user is PORTAL.

    3. Under Oracle (JDBC) Settings, if you intend to specify a custom JDBC URL, then select the Enter Custom JDBC URL checkbox, and specify the database URL of the portal schema in the jdbc format:

      jdbc:oracle:thin:@dbhost:dbport:dbsid
      
    4. If you did not perform the above step, then select a driver, enter the host name, JDBC port, SID, and service name, as shown Table 13-10 and Figure 13-3.

      Table 13-10 Parameters for Creating Oracle Portal-based Content Data Control

      Parameters Description

      Driver

      There are two types of drivers: thin and oci8.

      The thin driver can be used to connect to Oracle Database release 8i or later databases with TCP/IP network protocols. This driver is included in the default Oracle JDBC library for all projects.

      The oci8 driver is used when creating a Java application that runs against an Oracle Application Server. This is a thick driver optimized for the Oracle Database. It is a mix of Java and native code. This driver handles any database protocol (TCP, IPX, BEQ, and so on). It is recommended for applications that are run from the computer on which they are stored.

      Host Name

      Name of the Oracle Database. Use an IP address or a host name that can be resolved by TCP/IP; for example, myserver. The default value is localhost.

      JDBC Port

      Value to identify the TCP/IP port.

      SID

      Unique system identifier of an Oracle database instance.

      Service Name

      The service name for an Oracle database instance.


      Figure 13-3 Create Database Connection

      Description of Figure 13-3 follows
      Description of "Figure 13-3 Create Database Connection "

    5. Click OK.

  7. In the Create Content Repository Connection dialog, in the Login Timeout (ms) field, specify the time in milliseconds. This timeout determines how long the application must wait when trying to establish a session with the content repository. If the network connection or the content repository server to which you are trying to connect is slow, then consider overriding the default value specified in this field.

  8. Select the applicable authentication method. See Section 13.2.6.1, "What You Should Know About Using Identity Propagation and External Application Authentication Methods" for information.

  9. Select the Specify login credentials for current JDeveloper session checkbox and enter the Oracle Portal single sign-on user name and password for logging in to your portal instance. The Oracle Portal single sign-on user name and password entered here are used to test the connection and are functional only at design time. Then click OK.

    Note:

    If the Specify login credentials for current JDeveloper session checkbox is selected, then the credentials you entered are used. If the checkbox is not selected, then the connection is tested using External Application credentials (if they exist), otherwise null credentials are used.

    If you have selected External Application for authentication and also specified either public or shared credentials, then you can leave these fields blank, as the public or shared credentials can be used to login at design time. If you specified both public and shared credentials for the external application, then the public credentials have higher precedence. However, if you have selected External Application but have not specified public or shared credentials, then you must specify user name and password here.

  10. In the Application Resources panel, expand the repository connection you just created. The Connection Credentials dialog displays.

    Note:

    The Connection Credentials dialog displays if you do not save the credentials, that is, you do not select the Specify login credentials for the current JDeveloper session checkbox, or if you do not specify an External Application service that uses public or shared credentials.
  11. Enter the user name and password for Oracle Portal connection and click OK. The connection displays under the Application Resources panel.

See Also:

To create a data control using this connection, perform the procedure described in Section 13.5.1, "How to Configure a Content Repository Data Control".

13.2.3 How to Create a Content Repository Connection Based on the File System Adapter

This section describes the procedure to create a content repository connection based on the file system adapter.

To create a File System repository connection:

  1. In Oracle JDeveloper, open your WebCenter application.

  2. In the Application Resources panel, right-click Connections and choose New Connection and then Content Repository.

  3. In the Create Content Repository Connection dialog, enter a name for the connection; for example, MyConnection.

    Tip:

    You can choose between creating application-specific connections in the Application Resources panel and creating common connections in the Resource Palette (IDE Connections).
  4. Select File System from the Repository Type box.

  5. Select Set as primary connection for Documents service, if you intend to make it the default connection for the Documents service. Selecting this option writes a configuration to the adf-config.xml file that identifies this connection as the default connection for the Documents service. If a document library task flow is used without any connectionName input parameter, then this connection is used. For information about the Documents service, see Chapter 14, "Integrating the Documents Service".

    Note:

    To be able to set a connection as primary connection for the Documents service, you must select the Application Resources option in Create Connection In. This is because connections created as IDE connections cannot be used directly, they must be added to applications.
  6. Under Configuration Parameters, select the Base Path row, and enter the path to the folder in which your content is placed, for example, C:\MyContent.

    Note:

    The following must be considered while creating a file system connection:
    • The base path value is used as the root ("/") for the file system-based data control in Section 13.6, "Integrating Content Using Content Data Controls: Examples".

    • When you work on a UNIX system, the File System adapter inherits the case-sensitive file name characteristic of UNIX systems. So, on UNIX systems, you must ensure that references to files follow the same case as that used in the original file names. For example, suppose the Test.html file was created on a Microsoft Windows system. When you reference this file on a Linux system, you must ensure that you use Test.html, and not test.html or TEST.html.

  7. Leave the Login Timeout (ms) field blank.

  8. Click Test Connection to check whether you have entered the connection details correctly. You should see a Success! status, as shown in Figure 13-4.

    Figure 13-4 File System Connection

    Producer success message
    Description of "Figure 13-4 File System Connection"

  9. Click OK.

  10. In the Application Resources panel, expand the repository connection you just created.

13.2.4 How to Create a Content Repository Connection Based on the Oracle WebCenter Adapter for Microsoft SharePoint

The Oracle WebCenter adapter for Microsoft SharePoint extracts and searches content within a Microsoft SharePoint 2007 repository. The adapter accesses the repository using the Microsoft SharePoint SOAP interfaces. Oracle recommends that you study Section 13.2.6.3, "What You Should Know About Oracle WebCenter Adapter for Microsoft SharePoint" before configuring and using Oracle WebCenter adapter for Microsoft SharePoint.

This section includes the following subsections:

13.2.4.1 Creating a Content Repository Connection Based on the Oracle WebCenter Adapter for Microsoft SharePoint

To create a repository connection based on Oracle WebCenter adapter for Microsoft SharePoint:

  1. In Oracle JDeveloper, open your WebCenter application.

  2. In the Application Resources panel, right-click Connections and choose New Connection, then Content Repository.

  3. In the Create Content Repository Connection dialog, specify a connection name for the connection; for example, MySPConnection.

    Tip:

    You can choose between creating application-specific connections in the Application Resources panel and creating common connections in the Resource Palette (IDE Connections).
  4. Select JCR SharePoint Adapter from the Repository Type box.

    Note:

    This option displays only if the extension for Oracle WebCenter adapter for Microsoft SharePoint is installed.
  5. Select Set as primary connection for Documents service, if you intend to make it the default connection for the Documents service. Selecting this option writes a configuration to the adf-config.xml file that identifies this connection as the default connection for the Documents service. If a Document Library task flow is used without any connectionName input parameter, then this connection is used. For information about the Documents service, see Chapter 14, "Integrating the Documents Service".

    Note:

    To be able to set a connection as primary connection for the Documents service, you must select the Application Resources option in Create Connection In. This is because connections created as IDE connections cannot be used directly, they must be added to applications.
  6. Under Configuration Parameters, enter the SharePoint URL , that is, the web address of the SharePoint site to which you want to connect. For example, http://mysharepoint.mycompany.com, as shown in Figure 13-1.

    Figure 13-5 Content Repository Connection - Oracle WebCenter Adapter for Microsoft SharePoint

    Description of Figure 13-5 follows
    Description of "Figure 13-5 Content Repository Connection - Oracle WebCenter Adapter for Microsoft SharePoint"

  7. Enter an integer value representing the number of characters for the Like limit. If no value is set, the Like limit defaults to 64 characters as the limit for search pattern strings that are passed to the Microsoft SharePoint Server. If the value is set to zero, then the full string is passed to the server. That is, the LIKE limit is disabled. This parameter is optional. Oracle recommends that it be left to its default state. For related information, see Section 13.2.6.3, "What You Should Know About Oracle WebCenter Adapter for Microsoft SharePoint."

  8. In the Login Timeout (ms) field, specify the time in milliseconds. This timeout determines how long the application must wait when trying to establish a session with the content repository. Oracle recommends that there is a fast network connection between the deployed application and the Microsoft SharePoint repository. If the network connection or the content repository server to which you are trying to connect is slow, then consider overriding the default value specified in this field.

  9. Select the External Application authentication method. For information about this authentication method, see Section 13.2.6.1, "What You Should Know About Using Identity Propagation and External Application Authentication Methods."

    Note:

    Oracle WebCenter adapter for Microsoft SharePoint does not support the Identity Propagation authentication method. Therefore, the External Application authentication method lets you use a single shared set of credentials for all users when accessing the repository. You can also configure this option to enable each user to enter their own login credentials when accessing the repository the first time by omitting both the Shared and Public credentials in the External Application configuration. The system will then reuse each unique credential on subsequent access requests.
  10. Select the Specify login credentials for the current JDeveloper session checkbox and specify User Name and Password. This step is optional, and only required if you want to override the External Application authentication credentials created in the previous step. Moreover, this override only applies to the JDeveloper design time.

  11. Click OK.

  12. Optionally, to test the connection, expand the repository connection you just created, in the Application Resources panel. The Connection Credentials dialog displays.

    Note:

    The Connection Credentials dialog displays if you do not save the credentials, that is, you do not select the Specify login credentials for the current JDeveloper session checkbox, or if you do not specify an External Application service that uses public or shared credentials.
  13. Enter the User Name and Password for this connection and click OK. The connection displays under the Application Resources panel.

    This step is optional.

13.2.4.2 Mapping Microsoft SharePoint Content and Services

The Oracle WebCenter adapter for Microsoft SharePoint is designed to map the content managed in SharePoint servers, such as sites, lists, list items, metadata, documents, as well as content services delivered by Microsoft SharePoint, such as search and security.

The adapter maps content and content services that are relevant to the JCR standard. In other words, the adapter does not map the Microsoft SharePoint graphical user interface (GUI) and the application-level functions that are not part of the JCR standard. For example, the adapter does not map the GUI application logic of the Microsoft SharePoint server (not covered by JCR), but it provides GUI-relevant metadata so that JCR or Java applications can restore some of the GUI logic such as SharePoint lists, if that is the goal of the application.

Default JCR Location of the Microsoft SharePoint Documents Libraries

For a SharePoint Services v3 Team Site the Shared Documents Library appears at path:/sp:Site/sp:RootWeb/sp:Lists/Shared Documents/sp:Files, as shown in Figure 13-6.

Figure 13-6 The Shared Documents Library Path for a SharePoint Services v3 Team Site

Description of Figure 13-6 follows
Description of "Figure 13-6 The Shared Documents Library Path for a SharePoint Services v3 Team Site"

For the Moss 2007 site created during installation, the Documents Center Document Library appears at path: /sp:Site/sp:RootWeb/sp:Webs/Docs/sp:Lists/Documents/sp:Files, as shown in Figure 13-7. This path reflects the structure in which the Documents Center is a subsite in the SharePoint main site.

Files are JCR nodes of primary type nt:file, and of mix-in type sp:File. Folders are JCR nodes of primary type nt:folder and of mix-in type sp:Folder. The sp: mix-ins are similar to nt:unstructured in their definitions.

Figure 13-7 The Documents Center Document Library Path for Moss 2007 Site

Description of Figure 13-7 follows
Description of "Figure 13-7 The Documents Center Document Library Path for Moss 2007 Site"

13.2.5 What Happens When You Create a Repository Connection

When you create a connection to a repository, the contents in the main directory of the repository display under the Content Repository connection in the Application Resources panel, as shown in Figure 13-8. You can double-click folders and files to view them.

Figure 13-8 Application Resources

Description of Figure 13-8 follows
Description of "Figure 13-8 Application Resources"

You can use repository connections to create JCR data controls that enable integration of the repository content with JSF pages. See Section 13.5, "Configuring Content Data Controls for JCR Adapters" and Section 13.6, "Integrating Content Using Content Data Controls: Examples" for information. These connections can also be consumed through the Documents service task flows. See Chapter 14, "Integrating the Documents Service" for information.

13.2.6 What You May Need to Know When Creating a Repository Connection

This section includes:

13.2.6.1 What You Should Know About Using Identity Propagation and External Application Authentication Methods

The Create Content Repository Connection dialog provides the following options for authentication methods:

  • Identity Propagation: If you select this option, no credentials are passed to the repository. The repository connector instead uses the current user's identity as determined from the Java security context. This must only be used when the application and the repository use the same identity store to authenticate users.

    To apply this authentication method, it is best to configure security for your application using the Configure ADF Security wizard since repositories may support only authenticated users or provide only limited access to the public or guest user. See Section 13.5.4, "Securing a Content Repository Data Control".

  • External Application: The External Application method can be used in all other cases where the current user identity should not be propagated directly to the repository. For more information, see Section 37.2, "Working with External Applications".

    The External Application service allows different types of credentials to be associated with a connection:

    • Public credentials are used whenever an application is not secured, or the user has not yet logged in.

    • Shared credentials are used for any authenticated user.

    • If shared credentials are not specified, then mapped credentials can be used to obtain a result similar to identity propagation when the application and content repository do not use the same user store. In that case the external application service provides runtime screens through which users can provide their credentials for accessing the content repository. Those credentials are securely stored and used for any future connection that this user tries to establish.

    If you intend to configure the External Application service, then click New to launch the Register External Application wizard and do the following:

    1. Specify name of the external application.

    2. In the Login URL field, enter the URL of the external application; for example, http://content-server.mycompany.com/idc/

      Note:

      This URL is optional and is required only to provide click through login to the content repository's own user interface. See the External Application service documentation for more information on how to configure click through login.
    3. Then, under Authentication Details, select Basic from the list. Leave the fields under Login Details blank.

      This option is selected when click through login is not required. If click through login is enabled, then you must select another option based on the authentication method used in the repository.

    4. Accept the default values and click Next.

    5. Enter shared credentials that can be used at design time and runtime. Do not specify shared credentials, if users must specify their own credentials.

    6. Enter public credentials that can be used at design time and runtime. Specify public credentials only if you intend public users to view documents or contents.

      Click Finish.

13.2.6.2 What You Should Know About Oracle Portal

The following should be considered while using the Oracle Portal adapter:

  • To use Oracle Portal-based content data control capabilities, you can install Oracle Portal release 10.1.4.1, 10.1.4.2, or 11. If you use the Oracle Portal release 10.1.4.1, then you must update it with the required patches. Consult Oracle Application Server Release Notes for Microsoft Windows (for the required platform) for release 11.1.1.0.0 to know the exact patch number.

  • Only file, image, imagemap, and text item types and custom types based on these item types are supported.

  • The portal:container page type and its extensions are supported.

  • Content is always exposed in the default language of the page group. For example, if there are three page groups with different default languages, then the content displays only for those default languages and not for any translations that exist.

13.2.6.3 What You Should Know About Oracle WebCenter Adapter for Microsoft SharePoint

Consider the following while configuring and using Oracle WebCenter Adapter for Microsoft SharePoint:

  • The adapter does not support connecting to a Microsoft SharePoint repository configured to allow anonymous access.

  • There should be a fast network connection between the application server instance on which the adapter is running and the Microsoft SharePoint repository.

  • Microsoft SharePoint versions: The following Microsoft SharePoint versions are supported:

    • Microsoft Office SharePoint Server (MOSS) 2007 SP2

    • Microsoft Windows SharePoint Services (WSS) version 3 SP2

  • Versioning Settings: The only supported Microsoft SharePoint 2007 Document Library versioning settings are:

    • Require Check Out : No

    • Content Approval : No

    • Document Version History : No versioning

    If any other Versioning Settings are configured, the adapter will not function correctly. For example, upload operations will fail if RequireCheck Out is set to yes, and new versions or documents will have restricted visibility, if document version history or content approval are enabled.

  • Session-Based Memory Cache: For performance reasons, Oracle WebCenter adapter for Microsoft SharePoint maintains a session-based memory cache. A custom WebCenter application, which uses this adapter, must configure an Http Session time-out in the application's web.xml file to ensure that any unused sessions are closed, and the adapter memory cache is released.

  • Mapping: The mapping takes into account only those content artifacts and services, which are relevant and defined in the JCR API. Additionally, the adapter maps the content and services to the extent supported by the native SharePoint web services, as the adapter does not rely on custom additional server-side components. Consequently:

    • Full text search only returns items that are indexed by the SharePoint server.

    • Set of searchable columns is limited.

    • A fixed set of node types is supported in searches.

    • Some searches require additional network round trip as the adapter does not receive the full information necessary to map results to JCR from the web services.

    The adapter exposes content from a Microsoft SharePoint server in a hierarchical way which is similar to the way by which the content is exposed by the native web interface. The items of the hierarchy have a primary type of either nt:folder, nt:file, or a specialization of these. Additional SharePoint specific characteristics are in some instances added by means of mixins, that is, sp:Folder, sp:File, and so on. The SharePoint specific name space, which is identified by the sp prefix in these examples, is used for items controlled by the SharePoint server. Items controlled by the user - webs, documents, list items and the like - are in the default name space. The adapter allows write access to SharePoint document libraries. That is, it allows folders and files to be created within document libraries in correspondence with creating folders or uploading files to the native SharePoint web interface. Examples which demonstrate this hierarchical mapping are described in the next point.

  • Site Structure: The structure mapping of a SharePoint site is as follows:

    • /sp:Site: The root element of the site.

    • /sp:Site/sp:RootWeb: The root web element.

    • /sp:Site/sp:RootWeb/sp:Lists: The path to the root of all lists in the site.

    • /sp:Site/sp:RootWeb/sp:Lists/Shared Documents/sp:Files: The path to the start of the file and folder hierarchy within a document library. In this example, the Shared Documents library is shown. All site document libraries are mapped under /sp:Site/sp:RootWeb/sp:Lists, each mapped by their own document library name.

    • /sp:Site/sp:RootWeb/sp:Lists/Shared Documents/sp:Files/myFiles: An example of a folder within the sites Shared Documents document library.

    • /sp:Site/sp:RootWeb/sp:Webs/mySubSite: A site's subsites are all mapped under /sp:Site/sp:RootWeb/sp:Webs. This example shows the path to a subsite named mySubSite. The subsite may itself contain Document Libraries.

    • The adapter does not support the write access to a SharePoint Document Library with settings that require one or more mandatory SharePoint columns.

  • Search and indexing:

    • JCR and native Microsoft SharePoint search: The Oracle WebCenter adapter for Microsoft SharePoint uses the native SharePoint search web service to evaluate JCR queries. Features present in JCR 1.0 but not available in the SharePoint search service are usually ignored.

    • Indexed items: The native search finds only those items that are indexed by the Microsoft SharePoint server. Other items that may match the query criteria are ignored. By default, SharePoint Services 2007 is configured for search and full-text indexing of a limited set of document types. For more information, and information on how to enable search and indexing in more complex deployments, see Microsoft documentation.

    • LIKE limit: The SharePoint native query language uses a LIKE keyword that the adapter uses to constrain queries by URLs (document paths) that match a pattern. The native LIKE operator supports a pattern match on strings up to 64 characters. Therefore, the Oracle WebCenter adapter for Microsoft SharePoint applies a client-side filtering on result sets to ensure that the correct constraint on URL is applied. The adapter's LIKE limit parameter controls this feature, and if this limit is not set, it defaults to applying a 64 character limit. The parameter can be set to 0 to disable client-side filtering. The parameter can also be set to some other positive value to apply a different character limit. However, this limit can only be increased if the SharePoint instance supports LIKE tests on URLs greater than 64 characters.

    • Creation and Modification timestamps: When displaying the contents of a SharePoint Document Library, the adapter reports the Creation and Modification timestamps as the times that the document was created on or last updated in the library. In the case of some document types, for example Microsoft Office documents, the native SharePoint search evaluates against the document metadata stored within each document. This can be different from the times when the document was uploaded or updated in the Document Library, and therefore, it appears to give misleading search results.

    • Combining search keywords: The adapter does not support combining search keywords in an OR expression.

    • Search by Last Modifier: The adapter does not support search by Last Modifier.

    • Supported JCR search operators and properties: The adapter supports the following:

      • Relational operators for comparison: =, >=, >, <=, <, LIKE, <>, IS NULL, IS NOT NULL. Predicates, descendants, and self operators (//) are supported on the last location step.

      • Properties for comparison: Size, Author, Modified, URL, Title, IsDocument, ContentClass, SiteName, Description, FileName, jcr:data, jcr:mimeType, jcr:created, jcr:lastModified.

13.2.7 How to Edit a Common Repository Connection

Common repository connections (IDE connections) are created and edited under the Resource Palette.

To edit a common repository connection:

  1. Under the Resource Palette, right-click the repository connection you intend to edit and choose Properties, as shown in Figure 13-9. The Edit Repository Connection dialog displays, as shown in Figure 13-10.

    Figure 13-9 Resource Palette - Properties

    Description of Figure 13-9 follows
    Description of "Figure 13-9 Resource Palette - Properties"

    Figure 13-10 Edit Content Repository Connection

    Description of Figure 13-10 follows
    Description of "Figure 13-10 Edit Content Repository Connection"

  2. Change the appropriate parameters.

  3. Test the connection and click OK.

13.2.8 How to Edit a WebCenter Application-Specific Content Repository Connection

Application-specific content repository connections exist under the Application Resources panel.

To edit a WebCenter application-specific content repository connection:

  1. In the Application Resources panel, right-click the connection you intend to edit, and choose Properties, as shown in Figure 13-11. The Edit Content Repository Connection dialog displays, as shown in Figure 13-12.

    Figure 13-11 Application Resources - Properties

    Description of Figure 13-11 follows
    Description of "Figure 13-11 Application Resources - Properties"

    Figure 13-12 Edit Content Repository Connection

    Description of Figure 13-12 follows
    Description of "Figure 13-12 Edit Content Repository Connection"

  2. Change the appropriate parameters. Depending on the repository type, see the earlier sections that describe how to create repository connections. For example, for Oracle Content Server, see Section 13.2.1, "How to Create a Content Repository Connection Based on the Oracle Content Server Adapter".

  3. Test the connection and click OK.

13.2.9 How to Use an Existing Repository Connection for a New WebCenter Application

You can use an existing repository connection for any WebCenter application, if you created it as a common repository under the Resource Palette.

To use an existing repository connection:

  1. In Oracle JDeveloper, open the WebCenter application for which you intend to use an existing repository connection.

  2. Go to the Resource Palette and select the repository connection that you intend to use for a new application, for example MyConnection_2, and drop it under the Application Resources panel of the new application, as shown in Figure 13-13.

    Tip:

    Alternatively, right-click the connection and choose Add to Application. The connection is displayed under the Application Resources panel.

    Figure 13-13 Dragging an Existing Common Repository Connection (IDE Connection) to an Application

    Description of Figure 13-13 follows
    Description of "Figure 13-13 Dragging an Existing Common Repository Connection (IDE Connection) to an Application"

You can now configure a data control for your new application from this repository connection, as described in Section 13.5.1, "How to Configure a Content Repository Data Control".

13.3 Adding Content to a JSF Page

You can display the folders and files from a connected content repository on a JSF page in a WebCenter application in several different ways, as shown in Table 13-11:

Table 13-11 Adding Content to a JSF Page

Content Type Content Display Selections

Content repository root folder

ADF Go Link, Documents service task flow (Document Manager, Document List View, or Recent Documents)

Subfolders

ADF Go Link, Documents service task flow (Document Manager, Document List View, Content Presenter)

Documents of various types (XML, PDF, JAVA, TXT, DOC, XLS, HTM)

ADF Go Link, ADF Inline Frame, Content Presenter task flow

Images (PNG, JPG, GIF)

ADF Go Link, ADF Image, ADF Inline Frame, Content Presenter task flow


For more information about adding content in one of the Documents service task flows (Document Manager, Document List View, Recent Documents, or Content Presenter), see Section 14.2.3, "Adding Documents Service Task Flows at Design Time."

When you add content in a Content Presenter task flow, you can select a template to display the content. The selected template may be one of the built-in templates provided with WebCenter, or a custom template that has been developed for your organization. To develop custom display templates, see Section 13.4, "Creating Custom Templates for Displaying Content Using Content Presenter."

13.4 Creating Custom Templates for Displaying Content Using Content Presenter

When you add content to a page using the Content Presenter task flow, you can select a template to display the content. For more information about display templates, refer to Section 13.1.2, "Overview of Content Presenter Display Templates and the Templates Registry".

If the out-of-the-box display templates (see Table 14-4 and Table 14-5) do not meet your needs, you can define custom templates for the content that you want to display in your custom WebCenter application, or for selection by end users at runtime.

This section contains the following information:

13.4.1 How To Define Custom Display Templates

Depending on your needs, the approach you take to defining custom display templates will vary. Typically, you define display templates for specific single items of content, then define a multiple content item display template that includes calls to the single item display templates.

Note:

Template definitions can include calls to other display templates in any of the following ways:
  • A single content item display template can call another single content item display template.

  • A multiple content item display template can call a single content item display template (as shown in the examples below).

  • A multiple content item display template can call another multiple content item display template.

After defining custom display templates, you must register them specifically for Content Presenter in the templates-registry.xml file.

This section includes about defining and registering custom display templates:

13.4.1.1 EL Expressions for Content Item Nodes

This section provides descriptions of the EL expressions that you can use in your custom display template definitions to retrieve and display specific information about a content item node. Use the EL expressions described in the following tables as you define your custom display templates using the tags described in Section 13.4.1.2, "Defining Single Content Item Display Templates" and Section 13.4.1.3, "Defining Multiple Content Item Display Templates":

Note:

As you build your EL expressions, JDeveloper auto-suggests valid completions as you type.

Table 13-12 EL Expressions for a Content Item Node

EL Expression Description

#{node.createdBy}

Returns the user name of the node's creator.

#{node.createdDate}

Returns the node's creation date.

#{node.hasParentNode}

Returns true if the current node has a valid parent node ID, or a node that has no parent.

#{node.icon}

Returns the icon service defined in the current web application.

#{node.id}

Returns the node's identifier.

#{node.isFolder}

Returns true if this node is associated with a folder or container.

#{node.isInherited}

Returns true if this node is inherited by another object class definition.

#{node.modifiedBy}

Returns the user name of the node's last modifier.

#{node.modifiedDate}

Returns the node's last modification date.

#{node.name}

Returns the node's name.

#{node.parentId}

Returns the parent node's identifier.

#{node.path}

Returns the node's path.

#{node.primaryProperty}

Returns the node's primary property, if available.

#{node.propertyMap}

Creates and returns a map of wrapped property objects, keyed by property name. Properties can be accessed as #{node.propertyMap['myProp']} or #{node.propertyMap.myProp}.

#{node.url}

Returns an instance of the node property URL service for the primary property of this node (if any). By default, resolves to #{node.url.renderUrl}. This is a shortcut for #{node.primaryProperty.url}.


Use the EL expression described in Table 13-13 and Table 13-14 to perform actions on content item node properties and property values. To determine the names of the properties defined for a given content type, refer to Step 4 of Section 13.4.1.2, "Defining Single Content Item Display Templates."

Table 13-13 EL Expressions for Content Item Node Properties

EL Expression Description

#{node.propertyMap['myProp']'myProp'].asTextHtml}

Returns this property as text or HTML if the type is text or HTML. If isHTML or isPlainText is true, the text or HTML is returned as a string.

#{node.propertyMap['myProp'].hasValue}

Returns true if a value is associated with this property.

#{node.propertyMap['myProp'].icon}

Returns the icon service defined in the current web application.

#{node.propertyMap['myProp'].indexedName}

Returns the indexed name of a multi-valued property. For example, if a multi-valued node property named color contains blue, red, orange, the indexed name of the red value is color[1]. The following EL expression references the color orange in this list: #{node.propertyMap['color[2]'].value.stringValue}

#{node.propertyMap['myProp'].isAudio}

Returns true if the property's mime type is 'audio/'.

#{node.propertyMap['myProp'].isBinary}

Returns true if the current property is of type Property.BINARY.

#{node.propertyMap['myProp'].isBoolean}

Returns true if the current property is of type Property.BOOLEAN.

#{node.propertyMap['myProp'].isCalendar}

Returns true if the current property is of type Property.CALENDAR.

#{node.propertyMap['myProp'].isDouble}

Returns true if the current property is of type Property.DOUBLE.

#{node.propertyMap['myProp'].isExcel}

Returns true if the property's mime type is 'application/vnd.ms-excel', 'application/excel', 'application/x-excel', or 'application/x-msexcel'.

#{node.propertyMap['myProp'].isGIF}

Returns true if the property's mime type is 'image/gif'.

#{node.propertyMap['myProp'].isHTML}

Returns true if the property's mime type is 'text/html'.

#{node.propertyMap['myProp'].isImage}

Returns true if the property's mime type is 'image/'.

#{node.propertyMap['myProp'].isJPEG}

Returns true if the property's mime type is 'image/jpeg'.

#{node.propertyMap['myProp'].isLink}

Returns true if the current property is of type Property.LINK.

#{node.propertyMap['myProp'].isLong}

Returns true if the current property is of type Property.LONG.

#{node.propertyMap['myProp'].isMSWord}

Returns true if the property's mime type is 'application/vnd.ms-word' or 'application/msword'.

#{node.propertyMap['myProp'].isMultiValued}

Returns true if this property is multi-valued.

#{node.propertyMap['myProp'].isNested}

Returns true if the current property is of type Property.NESTED.

#{node.propertyMap['myProp'].isPDF}

Returns true if the property's mime type is 'application/pdf'.

#{node.propertyMap['myProp'].isPlainText}

Returns true if the property's mime type is 'text/plain'.

#{node.propertyMap['myProp'].isPNG}

Returns true if the property's mime type is 'image/png'.

#{node.propertyMap['myProp'].isPowerPoint}

Returns true if the property's mime type is 'application/vnd.ms-powerpoint', 'application/mspowerpoint', or 'application/x-mspowerpoint'.

#{node.propertyMap['myProp'].isPrimaryProperty}

Returns true if this property is the primary property.

#{node.propertyMap['myProp'].isRequired}

Returns true if this property is required/mandatory.

#{node.propertyMap['myProp'].isRetricted}

Returns true if this property is restricted.

#{node.propertyMap['myProp'].isRichText}

Returns true if the property's mime type is 'text/richtext'.

#{node.propertyMap['myProp'].isString}

Returns true if the current property is of type Property.STRING.

#{node.propertyMap['myProp'].isTextBased}

Returns true if this property is text-based (isHTML, isPlainText, isString, isCalendar, isBoolean, isDouble, isLong).

#{node.propertyMap['myProp'].isVideo}

Returns true if the property's mime type is 'video/'.

#{node.propertyMap['myProp'].isXML}

Returns true if the property's mime type is 'text/xml'.

#{node.propertyMap['myProp'].isZip}

Returns true if the property's mime type is 'application/zip'.

#{node.propertyMap['myRefNode'].linkAsNode}

Returns the myRefNode property as a node. where myRefNode is a link property type. Properties can be referenced in EL expressions.

Example: #{node.propertyMap['myRefNode'].linkAsNode.primaryProperty.url.renderUrl}

#{node.propertyMap['myProp'].name}

Returns the property's name.

#{node.propertyMap['myProp'].nestedProperty}

Retrieves nested properties for this single-valued property, and returns a list of properties.

#{node.propertyMap['myProp'].type}

Returns the data type of this property value. For example: String, Integer, Long, and so on.

#{node.propertyMap['myProp'].url}

Returns a URL service for this property.

#{node.propertyMap['myProp'].value}

Returns the value service for this property.


Table 13-14 EL Expressions for Content Item Node Property Values

EL Expression Description

#{node.propertyMap['myProp'].value.binaryValue}

Returns custom attributes for a binary property type or attachment. Attributes available on binaryValue are:

  • contentType – Returns the mime type of the binary content (for example, text or html).

  • name – Returns the filename of the binary content (for example, index.html).

  • size – Returns the size of the binary content, or -1 if the size is unavailable.

#{node.propertyMap['myProp'].value.booleanValue}

Returns the value of this property as java.lang.Boolean.

#{node.propertyMap['myProp'].value.calendarValue}

Returns the value of this property as java.util.Calendar.

#{node.propertyMap['myProp'].value.doubleValue}

Returns the value of this property as java.lang.Double.

#{node.propertyMap['myProp'].value.longValue}

Returns the value of this property as java.lang.Long.

#{node.propertyMap['myProp'].value.orderedPosition}

Returns the "index" of the property when the property is multi-valued.

Example: #{node.propertyMap['address[0]'].value.orderedPosition},

#{node.propertyMap['myProp'].value.stringValue}

Returns the value of this property as java.lang.String.

Example: #{node.propertyMap['firstName'].value.stringValue}


Table 13-15 EL Expressions for Content Item Node or Property Icons

EL Expression Description

#{node.icon.largeIcon}

#{node.propertyMap['myDoc'].icon.largeIcon}

Returns a URL to an image resource for a large icon.

Example: <af:image source="#{node.propertyMap['projectFolder'].largeIcon}"/>

#{node.icon.smallIcon}

#{node.propertyMap['myDoc'].icon.smallIcon}

Returns a URL to an image resource for a small icon.

Example: <af:image source="#{node.icon.smallIcon}" />


Table 13-16 EL Expressions for Content Item Node URLs

EL Expression Description

#{node.url.downloadUrl}

Creates a URL to the binary content. Forces a download, and the underlying operating system renders the content based on the content type.

Example: <af:goLink destination="#{node.url.downloadUrl}" targetFrame="_blank"/>

#{node.url.renderUrl}

Creates a URL to the binary content. Allows the browser to render the content based on the content type.

By default, #{node.url} resolves to #{node.url.renderUrl}.

Example: <af:goLink destination="#{node.url.renderUrl}" targetFrame="_blank"/>


13.4.1.2 Defining Single Content Item Display Templates

Examples of single content items for which you may want to create custom display templates are:

  • Individual items to display with a specific look and feel on a page.

  • Different views of a specific type of item (such as short and detailed view of an article).

  • Different versions of a similar item (such as Press Releases that may be formatted differently for different groups, using a different set of properties).

The definition of a single content item display template uses the JSP tags listed in Table 13-17.

Table 13-17 Content Display Template Tags for Single Content Items

JSP Tag Description Example

contentTemplateDef

Required. Defines a single content item template.

Attributes:

var - Specifies the content node that will be rendered by this display template. In the template definition code, you can use the EL expressions described in Section 13.4.1.1, "EL Expressions for Content Item Nodes" to retrieve required information about the node.

<dt:contentTemplateDef var="node">
  <af:outputText value="#{node.name}" />
</dt:contentTemplateDef>

renderProperty

Optional. Retrieves and renders the string value(s) of the specified node property inline.

Attributes:

id - Identifies this component. This value must be unique within the closest parent component that is a naming container.

name - Specifies the name of the property to get. If this is a system property (cm_createdBy, cm_createdDate, cm_modifiedDate, and cm_path) then the value on the node will be used. If not specified, then the primaryProperty will be used if defined.

node - Specifies the node to use. This value can either be a bound attribute to a managed bean, or a request attribute variable.

blockSize - Specifies the size of the blocks in bytes, to read the bytes of a binary property. Default is 2048 bytes.

startIndex - Specifies the index (from 0) in the document's bytes at which to start printing. Defaults to 0.

endIndex - Specifies the index (from 0) in the document's bytes at which to stop printing. Defaults to value of blockSize.

rendered - Specifies whether or not this component should be rendered (during Render Response Phase), or processed on any subsequent form submit. The default value is true.

<!--
  Handling of text-based primary
  properties (HTML, text, etc.).
-->
<dt:contentTemplateDef var="node">
    <cmf:renderProperty id="rp1" 
     name="#{node.primaryProperty.name}" 
     node="#{node}"/>
</dt:contentTemplateDef>

contentTemplate

Optional. Nested under contentTemplateDef.

Calls another single item template.

Attributes:

node - Required. Specifies the content repository node that should be displayed.

nodesHint - Optional. When the display template is called in an iterating component, allows the pre-inclusion of all possible templates. This attribute is not needed when contentTemplate is used inside a contentTemplateDef tag.

view - Optional. Specifies the target view name in templates-registry.xml.

id - Optional. Specifies the JSF component ID.

rendered - Optional. Specifies whether the component should be rendered.

<dt:contentTemplateDef var="node">
  <af:outputText value="#{node.name}" >
  <dt:contentTemplate node="#{node}" 
     view="templates.pressrelease.item" 
     />
  </af:outputText>
</dt:contentTemplateDef>

To define a display template for a single content item:

  1. In JDeveloper, create a JSFF file:

    1. From the File menu, choose New.

    2. In the New Gallery dialog, expand Web Tier, select JSF, then JSF Page Fragment.

    3. Click OK.

    4. In the Create New JSP Page Fragment dialog, enter a name for the display template file, and save the file in the appropriate directory:

    • If you are developing a display template for a WebCenter Spaces application, the JSFF file must be in the following directory under your project's ViewController/Web Content directory:

      /oracle/webcenter/content/templates/custom

      (On the file system, this path is: yourprojectdir/ViewController/public_html/oracle/webcenter/content/templates/custom).

    • If you are developing a display template for a custom WebCenter application, or to be added to WebCenter Spaces through a shared library (as described in the white paper "Extending WebCenter Spaces" available on the Oracle Technology Network), save your JSFF file in any directory structure under your project's ViewController/Web Content directory.

  2. Select View, then Component Palette to open the Component Palette.

  3. From the dropdown list at the top of the Component Palette (Figure 13-14):

    • Select WebCenter Content Display Templates for a list of display template tags.

    • Select WebCenter Content Management Faces for the renderProperty tag.

    Figure 13-14 Content Display Template Tags in Component Palette

    list of display template tags
  4. In Source view, drag and drop the required display template tags from the Component Palette onto the page to define your template. Refer to Table 13-17 for information about each tag and required parameter values.

    As described in Section 13.1.2, "Overview of Content Presenter Display Templates and the Templates Registry", a display template defines how a content repository item should render on a page. Each content item is associated with a specific content type defined in the Oracle Content Server repository. A content type defines the properties of the content item, and is identified in the templates registry file when you register the template (see Table 13-19).

    As a custom display template developer, you will need to know the names of the properties defined for the associated content type so that you can define how to display the selected content item(s) on the page. One way to determine the properties for the existing content types defined in Oracle Content Server is to use the Content Presenter Configuration dialog in WebCenter Spaces. Refer to the section "Displaying Content Using the Content Presenter Task Flow" in Oracle Fusion Middleware User's Guide for Oracle WebCenter to open the Content Presenter Configuration dialog:

    1. On the Content page of the Content Presenter Configuration dialog, select Results of a Query to a view a list of content types.

    2. Select the Content Type for the content item that you wish to display.

    3. From the Add Fields list, select Filters to add the Additional Query Filters section to the Content page, then click Add to list all the properties that are defined for the selected content type (Figure 13-15).

      Figure 13-15 Identifying Content Type Properties

      Identifying Content Type Properties

Note:

When referencing the content type properties, you must include the leading letter d or x as shown to reference the internal Oracle Content Server property name. The prefix d identifies a system property, and the prefix x identifies a user property.

Example 13-1 and Example 13-2 show sample single content item display template definitions.

Example 13-1 Sample display template definition for the structure of Press Releases generated by the Marketing Department (mkt-dept-press-release-list-item.jsff)

This template handles a Press Release that uses a property named dDocName to describe the heading of the Press Release document, and xDestinationUrl to describe the location of the document.

<?xml version = '1.0'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" 
          version="2.1" 
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich" 
          xmlns:dt="http://xmlns.oracle.com/webcenter/content/templates">
   <dt:contentTemplateDef var="node">
      <af:goImageLink text="#{node.propertyMap['dDocName'].value}" 
                      id="gil1" 
                      icon="#{node.icon.smallIcon}" 
                      destination="#{node.propertyMap['xDestinationUrl'].value}"
                      targetFrame="_blank">
      </af:goImageLink>
   </dt:contentTemplateDef>
</jsp:root>

Example 13-2 Sample display template definition for the structure of Press Releases generated by the Product Management department (prod-mgmt-press-release-list-item.jsff)

This template handles a Press Release that uses a property named dDocTitle to describe the heading of the Press Release document, and xLinkUrl to describe the location of the document.

<?xml version = '1.0'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" 
          version="2.1" 
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich" 
          xmlns:dt="http://xmlns.oracle.com/webcenter/content/templates">
   <dt:contentTemplateDef var="node">
      <af:goImageLink text="#{node.propertyMap['dDocTitle'].value}" 
                      id="gil1" 
                      icon="#{node.icon.smallIcon}" 
                      destination="#{node.propertyMap['xLinkUrl'].value}"
                      targetFrame="_blank">
      </af:goImageLink>
   </dt:contentTemplateDef>
</jsp:root>

13.4.1.3 Defining Multiple Content Item Display Templates

Examples of multiple content items for which you may want to create custom display templates are:

  • A group of similar items that you want to display on a page, such as a list of books or an employee directory of pictures.

  • Query results, such as all documents modified in the last week.

The definition of a multiple content item display template uses the JSP tags listed in Table 13-18.

Table 13-18 Content Display Template Tags for Multiple Content Items

JSP Tag Description Example

contentListTemplateDef

Required. Defines the multiple content item template.

Attributes:

var - Specifies the content node that will be rendered by this display template. In the template definition code, you can use the EL expressions described in Section 13.4.1.1, "EL Expressions for Content Item Nodes" to retrieve required information about the node.

<dt:contentListTemplateDef var="nodes">
  <af:iterator value="#{nodes}" var="node">
    <af:outputText value="#{node.name}" />
  </af:iterator>
</dt:contentListTemplateDef>

contentListTemplate

Optional. Nested under contentListTemplateDef.

Calls another multiple item template.

Attributes:

nodes - Required. Provides the list of VCR nodes that should be displayed

category - Required. Specifies the target template category in templates-registry.xml.

view - Required. Specifies the target view name in templates-registry.xml.

id - Optional. Specifies the JSF component ID.

rendered - Optional. Specifies whether the component should be rendered.

<dt:contentListTemplateDef var="nodes">
<!--
  Reuse the default bulleted list view, but
  indent it with a <blockquote>
-->
  <f:verbatim>
    <blockquote>
  </f:verbatim>
  <dt:contentListTemplate nodes="#{nodes}" 
     category="oracle.webcenter.content.
         templates.default.category" 
     view="oracle.webcenter.content.
         templates.default.list.bulleted"/>
  <f:verbatim>
    </blockquote>
  </f:verbatim>
</dt:contentListTemplateDef>

contentTemplate

Optional. Nested under contentListTemplateDef.

Calls a single item template.

Attributes:

node - Required. Specifies the content repository node that should be displayed.

nodesHint - Optional. When the display template is called in an iterating component, allows the pre-inclusion of all possible templates. This attribute is usually required when contentTemplate is used inside a contentListTemplateDef tag.

view - Optional. Specifies the target view name in templates-registry.xml.

id - Optional. Specifies the JSF component ID.

rendered - Optional. Specifies whether the component should be rendered.

<dt:contentListTemplateDef var="nodes">
  <af:iterator rows="0" var="node" 
     varStatus="iterator" value="#{nodes}">
  <dt:contentTemplate node="#{node}" 
     view="templates.pressrelease.listitem" 
     nodesHint="#{nodes}"/>
  </af:iterator>
</dt:contentListTemplateDef>

To define a display template for multiple content items:

  1. In JDeveloper, create a JSFF file and open the Component Palette, as described in Step 1 through Step 3 in Section 13.4.1.2, "Defining Single Content Item Display Templates".

  2. In Source view, drag and drop the required display template tags from the Component Palette onto the page. Refer to Table 13-18 for information about each tag and required parameter values.

Example 13-3 shows a sample multiple content item display template definition.

Example 13-3 Sample display template definition for the display of multiple Press Releases (press-release-list-view.jsff)

This template definition iterates over the data items selected for display, and processes them according to the referenced view (view="mycorp.content.templates.pressrelease.listitem"), which is registered in templates-registry.xml.

<?xml version = '1.0'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" 
          xmlns:af="http://xmlns.oracle.com/adf/faces/rich" 
          xmlns:dt="http://xmlns.oracle.com/webcenter/content/templates"
   <dt:contentListTemplateDef var="nodes">
      <af:panelGroupLayout layout="scroll" id="nodeListPanel" valign="middle">
        <af:iterator rows="0" var="node" varStatus="iterator" value="#{nodes}">
           <dt:contentTemplate node="#{node}" 
               view="mycorp.content.templates.pressrelease.listitem" 
               nodesHint="#{nodes}"/>
        </af:iterator>
      </af:panelGroupLayout>
   </dt:contentListTemplateDef>
</jsp:root>

13.4.1.4 Registering Templates in the Templates Registry

All display templates must be registered in the Content Presenter templates registry file, templates-registry.xml.

  • For custom WebCenter application, the templates registry file is located in YourAppDir/mds/oracle/webcenter/content/templates/registry/.

  • For WebCenter Spaces applications, you must export the templates registry file from MDS to your file system before you can edit it, and then import the modified registry back into MDS.

The templates-registry.xml file includes two display template sections:

  • The <content-templates> section contains the display template definitions for single content items. See Table 13-19.

  • The <content-list-templates> section contains the display template definitions for multiple content items. See Table 13-20.

Table 13-19 Templates Registry Tags for Single Content Item Display Templates

JSP Tag Description

content-templates

Defines the section for display templates for single content items.

content-repository

Nested under content-templates tag.

Attributes:

name - Specifies the name of specific content repository where content resides, or * to browse all connected content respositories.

content-type

Nested under content-repository tag.

Defines the single content item templates that will display on the Template page in the Content Presenter Configuration dialog, dependent on the selected content item(s).

Attributes:

defaultView - Identifies the view to display if user does not select any template.

name - Specifies the name of the content type defined in Oracle Content Server with which this template can be used (the display template defines how to handle the properties of the content type). Use * to allow the template to be used for any content type. This value is shown in the Content Presenter Configuration dialog in the Content Type list when the selection of content items is based on Results of a Query. Refer to the section"Displaying Content Using the Content Presenter Task Flow" in Oracle Fusion Middleware User's Guide for Oracle WebCenter for the steps to use Results of a Query to select content items to display in a Content Presenter task flow.

view

Nested under content-type tag.

Defines one or more sets of names, descriptions, and JSFF files for single content item templates that display on the Template page in the Content Presenter Configuration dialog.

Attributes:

id - Specifies the identifier that is called from a JSFF template definition file to be used when the name is selected by an end user in the Content Presenter Configuration dialog. This value must be unique among all others in this templates registry file.

name

Nested under view tag.

Specifies the text string for an item in the Template View list in the Content Presenter Configuration dialog.

description

Nested under view tag.

Specifies the description in the Template View list in the Content Presenter Configuration dialog when the end user selects the name (and hint text when the cursor is positioned on the item).

template-def

Nested under view tag.

Specifies the JSFF file that defines the template to display the content item, and processes the content according to the referenced view.


Table 13-20 Templates Registry Tags for Multiple Content Item Display Templates

JSP Tag Description

content-list-templates

Defines the section for display templates for multiple content items.

content-repository

Nested under content-list-templates tag.

Attributes:

name - Specifies the name of specific content repository where content resides, or * to browse all connected content respositories.

category

Nested under content-repository tag.

Defines name/description pairs for the multiple content item templates that display on the Template page in the Content Presenter Configuration dialog.

Attributes:

defaultView - Identifies the view to display if the end user does not select any template.

id - Specifies a unique identifier to distinguish this category from all others in this templates registry file (for example, com.my.company.unique.category).

name

Nested under category tag.

Specifies the text string for an item in the Template Category list in the Content Presenter Configuration dialog.

description

Nested under category tag.

Specifies the description in the Template Category list in the Content Presenter Configuration dialog when the end user selects the name. This description also provides the hint text when the cursor is positioned on the item.

view

Nested under category tag.

Defines one or more sets of names, descriptions, and JSFF files for multiple content item templates associated with the selected category that display on the Template page in the Content Presenter Configuration dialog.

Attributes:

id - Specifies the identifier that is called from a JSFF template definition file to be used when the name is selected by an end user in the Content Presenter Configuration dialog. Different <content-type> elements can have views with the same id value if the <content-type> elements have unique name attributes. When a view of a non-unique id is requested, the content type will be used to determine which view (therefore which JSFF file) will be used. See Example 13-5 to see how the same view id maps to two different content types and JSFF template definition files.

name

Nested under view tag.

Specifies the text string for an item in the Template View list in the Content Presenter Configuration dialog.

description

Nested under view tag.

Specifies the description beneath the Template View list when the end user selects the name (and hint text when the cursor is positioned on the item).

template-def

Nested under view tag.

Specifies the JSFF file that defines the template to display the content item, and processes the content according to the referenced view.


To register your custom display templates in templates-registry.xml:

  1. Open templates-registry.xml in an editor.

    • If you are creating a display template for a WebCenter Spaces application, export the latest registry file using the exportMetadata command. For example:

      exportMetadata('webcenter','WLS_Spaces','/myapps/dir/mds','/oracle/**/templates-registry.xml')
      
    • For custom WebCenter applications, you can easily add the registry file to your project by adding a Content Presenter task flow onto a page of the project. This action forces the registry file to be added to your project, and you can then delete the page or the Content Presenter task flow.

  2. (Recommended) Save a backup copy of the registry file prior to making edits to it.

  3. Edit the registry file to add your content display templates:

    • In the <content-templates> section, register the display template(s) that are defined for a single content item. Refer to Table 13-19 for information about tags and attributes.

    • In the <content-list-templates> section, register the display template(s) for displaying multiple content items, which may call the single item definitions. Refer to Table 13-20 for information about tags and attributes.

If your application integrates the Documents service (see Chapter 14, "Integrating the Documents Service"), the information you specify here is reflected in the Content Presenter Configuration dialog at runtime, as described in Table 13-19 and Table 13-20.

Note:

Content Presenter defines its own resource bundle for the out-of-the-box display templates. For custom display templates, you can specify a resource bundle at the top of the registry file to use your own bundleKey attributes to achieve localization of your custom display template names and descriptions. You can also remove the bundleKey attribute from any custom display template registry entry to reduce the amount of logging.

Example 13-4 and Example 13-5 show a sample registry file definition. Example 13-5 shows a scenario where you want to create a list of Press Releases, but there are two different kinds of Press Releases defined in your content repository, each one using different property names for the short title and long body. You can create two custom display templates with similar formatting, then create a custom multiple item Press Release listing template to choose the correct single item template for each of the two kinds of Press Releases based on their content type.

Example 13-4 High-level structure of the templates registry file

<display-templates xmlns="http://xmlns.oracle.com/webcenter/content/templates/registry">
  <content-templates>
    ...single content item definitions
  </content-templates>
  <content-list-templates>
    ...multiple content item definitions
  </content-list-templates>
</display-templates>

Example 13-5 Detailed structure of the templates registry file

<display-templates
  xmlns="http://xmlns.oracle.com/webcenter/content/templates/registry">
   <!- register templates for single content items ->
   <content-templates> 
      <content-repository name="mkt15">
         <content-type 
               defaultView="mycorp.content.templates.pressrelease.listitem"
               name="IDC:MktgPressRelease">
            <view id="mycorp.content.templates.pressrelease.listitem">
               <name>
                   Marketing Press Releases
               </name>
               <description>
                   This is a view of Marketing Department Press Releases
               </description>
               <template-def>
                   /oracle/webcenter/content/templates/custom/
                      mkt-dept-press-release-list-item.jsff
               </template-def>
            </view>
         </content-type>

         <content-type 
               defaultView="mycorp.content.templates.pressrelease.listitem"
               name="IDC:ProdMgmtPressRelease">
            <view id="mycorp.content.templates.pressrelease.listitem">
               <name>
                   Product Management Press Releases
               </name>
               <description>
                   This is a view of Product Management Press Releases
               </description>
               <template-def>
                   /oracle/webcenter/content/templates/custom/
                      prod-mgmt-press-release-list-item.jsff
               </template-def>
            </view>
         </content-type>
      </content-repository>
   </content-templates> 
 
   <!- register templates for multiple content items ->
   <content-list-templates>
      <category defaultView="mycorp.content.templates.pressrelease.listing" 
                id="mycorp.content.category">
         <name>
           MyCorp Templates
         </name>
         <description>
           MyCorp custom templates that display multiple content items.
         </description>

         <view id="mycorp.content.templates.pressrelease.listing">
            <name>
               Company Press Release List
            </name>
            <description>
               List view for MyCorp's Press Releases.
            </description>
            <template-def>
                /oracle/webcenter/content/templates/custom/
                   press-release-list-view.jsff
            </template-def>
         </view>

         <view id=" mycorp.content.templates.pressrelease.table">
            <name>
               Company Press Release Table
            </name>
            <description>
               Items display in a sortable table which includes the document name, 
               date created, and date modfied. 
            </description>
            <template-def>
                /oracle/webcenter/content/templates/custom/
                   press-release-tabular-view.jsff
            </template-def>
         </view>

      </category>
   </content-list-templates>

13.4.1.5 Importing Custom Display Templates for WebCenter Spaces Applications

If you are creating display templates for a WebCenter Spaces application, import the JSFF files you have created and the revised templates registry file into MDS using the importMetadata command. For example:

importMetadata('webcenter','WLS_Spaces','/myapps/dir/ViewController/public_html','/oracle/webcenter/content/templates/custom/*.jsff')
importMetadata('webcenter','WLS_Spaces','/path_to_app_dir/mds','/oracle/**/templates-registry.xml')

Note:

For detailed syntax and examples, see "importMetadata" in Oracle Fusion Middleware WebLogic Scripting Tool Command Reference.

This process assumes that the template development environment is running within the same environment as the running WebCenter Spaces environment. The importMetadata and exportMetadata tasks are designed to import and export to the local WebCenter Spaces file system, even if the commands are executed from a remote WebLogic Scripting Tool (WLST) client. If remote template development is desired, it is the responsibility of a WebCenter Spaces administrator to import and export templates and the registry to the WebCenter Spaces file system and manually transition the templates to and from template developers.

13.4.1.6 Testing Custom Display Templates

Prior to integrating with a running production application, test your new display templates and changes to the templates registry file in a local custom application and a staged WebCenter Spaces application. See Section 14.2.3, "Adding Documents Service Task Flows at Design Time" and Section 14.2.4.1, "Content Presenter Task Flow Parameters and Out-of-the-Box Display Templates".

13.4.2 Performance Considerations for Custom Display Templates

When content nodes are retrieved for display in a Content Presenter display template, most content item node property values are retrieved immediately along with the node, but some are loaded later only if needed. Other than the performance difference, the selective loading of node property values is transparent to the user or developer.

As a custom display template developer, you can optimize performance of your template if you are aware when different property values are loaded. For example, a typical list display template will render faster if you refer only to properties that are immediately loaded when the node is first retrieved and avoid properties that are loaded later when needed.

A secondary consideration is dependent on how the node is retrieved: through search versus fetched by parent ID. A property that may be loaded immediately on node retrieval for searches (such as "Results of a Query") may be loaded later for other retrieval methods (such as "Contents Under a Folder"). Table 13-21 shows whether or not node properties are loaded immediately upon node retrieval, by retrieval mechanism.

For information about the node properties listed in Table 13-21, see Idoc Script Reference Guide, available at http://download.oracle.com/docs/cd/E10316_01/owc.htm.

Table 13-21 Loading of Node Properties By Node Retrieval Mechanism

OCS Global Profile Properties Loaded When Node Is First Retrieved?
GET BY PARENT ID ("Contents Under a Folder") SEARCH ("Results of a Query") GET BY UUID ("Single Content Item" and "List of Items")

VaultFileSize

N

Y

Y

dCheckoutUser

Y

N

Y

dCreateDate

Y

Y

Y

dDocAccount

Y

Y

Y

dDocAuthor

Y

Y

Y

dDocName

Y

Y

Y

dDocTitle

Y

Y

Y

dDocType

Y

Y

Y

dFormat

Y

Y

Y

dID

Y

Y

Y

dInDate

Y

Y

Y

dIsCheckedOut

Y

N

Y

dOutDate

Y

Y

Y

dReleaseDate

Y

N

Y

dReleaseState

Y

N

Y

dRevClassID

Y

N

Y

dRevLabel

Y

Y

Y

dRevRank

Y

N

Y

dRevisionID

Y

Y

Y

dSecurityGroup

Y

Y

Y

dStatus

Y

N

Y

dWebExtension

Y

Y

Y

dWorkflowState

N

N

Y

idcPrimaryFile

Y

Y

Y

idcRenditions

N

N

Y

xCollectionID

Y

Y

Y

xComments

Y

Y

Y

xForceFolderSecurity

Y

Y

Y

xHidden

Y

Y

Y

xInihibitUpdate

Y

Y

Y

xReadOnly

Y

Y

Y


13.4.3 What Happens at Runtime

After you have defined and registered custom display templates, you can add a Content Presenter task flow to a page in your application, specifying the content and display template in the Content Presenter task flow parameters (see Section 14.2.3, "Adding Documents Service Task Flows at Design Time" and Section 14.2.4.1, "Content Presenter Task Flow Parameters and Out-of-the-Box Display Templates").

If you integrate the Documents Service in your application (see Chapter 14, "Integrating the Documents Service"), end users of your application can select content and your custom display templates in the Content Presenter Configuration dialog to include content on editable pages of the application, as described in "Displaying Content Using the Content Presenter Task Flow" in Oracle Fusion Middleware User's Guide for Oracle WebCenter. To understand how Content Presenter identifies which display templates to expose in the Content Presenter Configuration dialog, see Section 13.4.3.1, "Identifying Display Templates for Selected Content Items."

13.4.3.1 Identifying Display Templates for Selected Content Items

At runtime, after a user selects content in the Content Presenter Configuration dialog, Content Presenter checks the templates registry to identify the display templates that are suitable for the selected content item(s), then exposes the list of valid templates on the Template page in the Content Presenter Configuration dialog for the user to select.

For single content item templates, Content Presenter generates a list of valid templates using the following precedence order:

  1. Check the templates registry for template definitions matching the content item's content repository and content type.

  2. Add template definitions matching the default content repository (*) and specified content type.

  3. Add template definitions matching inherited content types.

  4. Add template definitions matching the default content repository (*) and default content type (*).

For multiple content item templates, Content Presenter generates a list of valid templates using the following precedence order:

  1. Check the templates registry for template definitions associated with the selected template category.

  2. Add template definitions associated with the default category (*).

For example, if the user selects multiple content items (such as the children of a folder, or the results of a search), the Content Presenter Configuration dialog shows a list of categories and the list of templates associated with that category and the default category, based on the repository of the content items.

Note:

When a user selects a template in the Content Presenter Configuration dialog, that template is used to display the selected content item(s) in the running application. If that template is later deleted from the templates registry for any reason, Content Presenter will automatically select a "closest match" template to display the content item(s) using the precedence order above.

As an illustration of the flexibility of Content Presenter, Example 13-5 shows a templates registry file with two template definitions with the same view id (mycorp.content.templates.pressrelease.listitem). One view specifies a template definition file defined for Marketing Press Releases (mkt-dept-press-release-list-item.jsff), the other view specifies a template definition file defined for Product Management Press Releases (prod-mgmt-press-release-list-item.jsff). To determine which template definition file to use, Content Presenter checks the name attribute of the parent <content-type> tag, mapping this value to the content type of the current content item. If it matches, Content Presenter displays that template for selection in the Content Presenter Configuration dialog; if it does not match, Content Presenter moves on to the second view with the same view id. Again, if the name attribute of that view's parent <content-type> tag matches the content type of the current content item, Content Presenter displays that template for selection in the Content Presenter Configuration dialog. If no match is found, then the checks continue as defined by the precedence order to build a list of valid templates.w

13.5 Configuring Content Data Controls for JCR Adapters

This section describes how to create a content data control based on a content repository connection:

13.5.1 How to Configure a Content Repository Data Control

The procedure to create content repository data controls is the same irrespective of the types of the connections that you use to create data controls. If you have not created a connection to your content repository, then see Section 13.2, "Configuring Content Repository Connections". In this section, a content data control is created using an Oracle Content Server-based connection.

To create a content data control using an existing content repository connection:

  1. In the Application Navigator, select the Model project, in which the project entries for the new data control should be created.

    You must do this to ensure that the data control definition is separate from the data control usage. When you select the Model project, data control definition files are created in its sub folder, Application Sources and not in the ViewController project in which the user interface is created.

  2. In the Application Resources panel, expand the Connections folder in which you created the repository connection.

  3. Drag the repository connection that you intend to use for the new data control and drop it into the Data Controls panel.

    Alternatively, from the File menu, choose New. In the New Gallery, expand Business Tier, select Content Repository and then Content Repository Data Control, and click OK.

    The Create Content Repository Data Control dialog displays with the name of the connection selected in the Connection Name list.

    Note:

    If you created your repository connection under the Resource Palette, then right-click the connection under the Resource Palette and choose Create Data Control. From the Resource Palette, you can also drag and drop the required connection onto the Data Controls panel.

    To add a new connection, click the Create new content repository connection icon to display the Create Content Repository Connection dialog. For more information, see Section 13.2, "Configuring Content Repository Connections".

  4. In the Data Control Name field, enter a name for your data control, for example MyDataControl.

  5. To add custom attributes, click Add. Then, enter a name for the attribute as it should appear in the Data Controls panel, select its type, and enter the JCR path.

    In Oracle Content Server, a metadata attribute named dPropertyName is mapped in the adapter as shown here:

    jcr:content/idc:metadata/idc:dPropertyName
    

    For example, if the property name is dWorkflowState, then it is mapped as jcr:content/idc:metadata/idc:dWorkflowState.

    In Oracle Portal, a metadata attribute is mapped in the adapter as shown here:

    portal:name of the attribute in Oracle Portal
    

    Note:

    To retrieve the JCR paths of item attributes, run the getAttributes method on the required items. Then reenter the wizard to include those paths by right-clicking the respective data control in the Data Controls panel and choosing Edit Definition.
  6. Click OK.

    Note:

    The data controls include the predefined node types of JCR. These basic node types represent folders (nt:folder) and files (nt:file). These are derived from nt:hierarchyNode, which is a child of the nt:base supertype. Additional node types can be derived from the basic types to customize the experience to a particular repository.

13.5.2 What Happens When You Configure a Content Repository Data Control

When the data control is successfully configured, it shows under the Data Controls panel. Expand it in the Data Controls panel to see the hierarchical list of methods, parameters, and operations for the new data control, as shown in Figure 13-16. For detailed information on using the Data Control panel, see Chapter titled "Using Oracle ADF Model in A Fusion Web Application" of Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

Figure 13-16 Data Controls Panel - Oracle Content Server

Producer success message
Description of "Figure 13-16 Data Controls Panel - Oracle Content Server"

Table 13-22 describes the icons and object hierarchy of a data control.

Table 13-22 The Data Controls Panel Icons and Object Hierarchy

Icon Name Description Used to Create...

Data control icon.

Data Control

Represents a data control. You cannot use the data control itself to create UI components, but you can use any of the child objects listed under it. Depending on how your business services were defined, there may be multiple data controls.

Serves as a container for the other objects, and is not used to create anything

Method icon

Method

Represents an operation in the data control or one of its exposed structures that may accept parameters, perform some business logic and optionally return single value, a structure or a collection of those

Command components

For methods that accept parameters: command components and parameterized forms

Method return icon.

Method Return

Represents an object that is returned by a custom method. The returned object can be a single value or a collection.

A method return appears as a child under the method that returns it. The objects that appear as children under a method return can be attributes of the collection, other methods that perform actions related to the parent collection, and operations that can be performed on the parent collection.

For single values: text fields and selection lists

For collections: forms, tables, trees, and range navigation components

When a single-value method return is dropped, the method is not invoked automatically by the framework. A user either has to also create an invoke action as an executable, or drop the corresponding method as a button to invoke the method.

Attribute icon.

Attribute

Represents a discrete data element in an object (for example, an attribute in a row). Attributes appear as children under the collections or method returns to which they belong.

Only the attributes that were included in the view object are shown under a collection. If a view object joins one or more entity objects, that view object's collection will contain selected attributes from all of the underlying entity objects.

Label, text field, date and selection list components

Data control operation icon.

Operation

Represents a built-in data control operation that performs actions on the parent object. Data control operations are located in an Operations folder under collections or method returns, and also under the root data control node. The operations that are children of a particular collection or method return operate on those objects only, while operations under the data control node operate on all the objects in the data control.

If an operation requires one or more parameters, they are listed in a Parameters folder under the operation.

UI components such as buttons or links

Parameter icon.

Parameter

Represents a parameter value that is declared by the method or operation under which it appears. Parameters appear in the Parameters folder under a method or operation.

Label, text, and selection list components


The following files (Figure 13-17) are created under the Model project:

  • DataControls.dcx: Oracle JDeveloper creates this file the first time a data control is created. This file lists all the Oracle ADF data controls created under the current project. This file is required to initialize the data control.

  • datacontrolname.xml: This file includes attributes, accessors, and operations of a data control.

  • advancedSearch_return.xml: This file includes the return type definition for the advancedSearch method.

  • getAttributes_return.xml: This file includes the return type definition for the getAttributes method.

  • getItems_return.xml: This file includes the return type definition for the getItems method.

  • getURI_return.xml: This file includes the return type definition for the getURI method.

  • search_return.xml: This file includes the return type definition for the search method.

  • Return.xml: This file defines the standard operations on collections.

Figure 13-17 Projects Panel - Model Project

Description of Figure 13-17 follows
Description of "Figure 13-17 Projects Panel - Model Project"

13.5.3 How to Edit a Content Repository Data Control

This section describes a generic procedure to edit content data controls that you configured as described in Section 13.5, "Configuring Content Data Controls for JCR Adapters".

To edit a content data control:

  1. In Oracle JDeveloper, go to the application that contains your content data control.

  2. Under Data Controls panel, right-click the data control you intend to edit, and choose Edit Definition, as shown in Figure 13-18. The Edit Content Repository Data Control dialog displays, as shown in Figure 13-19.

    Figure 13-18 Edit Data Controls

    Description of Figure 13-18 follows
    Description of "Figure 13-18 Edit Data Controls"

    Figure 13-19 Edit Content Repository Data Control Dialog

    Description of Figure 13-19 follows
    Description of "Figure 13-19 Edit Content Repository Data Control Dialog"

  3. To select a different connection, use the Connection Name list.

  4. To add a connection, click the Create new content repository connection icon to display the Create Content Repository Connection dialog. Depending on the type of connection that you intend to create, see relevant sections in Section 13.2, "Configuring Content Repository Connections" for information about its configuration parameters.

  5. To edit an existing connection, click the Edit selected content repository connection icon to display the Edit Content Repository Connection dialog. Depending on the type of connection that you intend to modify, see relevant sections in Section 13.2, "Configuring Content Repository Connections" for information about its configuration parameters.

  6. To add or remove custom attributes, use the Add new attribute icon and the Remove selected attribute icon respectively in the Custom Attributes box.

  7. Click OK to apply the changes.

13.5.4 Securing a Content Repository Data Control

You can enable security for your content repository connections. For information, see Chapter 37, "Securing Your WebCenter Application".

13.6 Integrating Content Using Content Data Controls: Examples

In this section, you will use getURI, getItems, search, and advancedSearch methods of your data control. The basic procedure to use any data control method is to drag and drop it onto the JSPX page. When a method is dropped, its ADF Faces tag is added to the source of the JSPX page, and the tag is displayed in the Structure window. For example, dropping the URI attribute of getURI as a Go Link adds an af:goLink to the JSPX page. The destination of the af:goLink is set to the EL expression #{bindings.URI.inputValue}. This EL expression ties the destination value of the af:goLink to the binding container's URI value.

In the page definition file, methodIterator is added to the executables element, and methodAction is added to the bindings element. The methodIterator and methodAction elements define which data control and method is to be used. The NamedData attribute of the methodAction defines what input parameter values should be provided to this method call. The path and type parameters are common across all data control methods. However, NamedData for search and advancedSearch includes additional parameters that are unique to those methods. For example, in the advancedSearch method, the NamedData can also be used to define the search predicates, whether the search is recursive, and so on.

The page definition includes the AttrNames element, which defines the attributes of the items available in the bindings container to ADF. These items are based on default attributes and custom attributes that were defined when creating the data control.

For detailed information on using the Data Control panel and working with page definition files, see the chapter "Using Oracle ADF Model in A Fusion Web Application" of Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

The examples in this section use the following data control methods:

  • getURI to add textual and clickable image links to the repository folder.

  • getItems to publish the repository content in an ADF table and tree.

  • search and advancedSearch to display those items of the repository that match the search criteria.

This section includes the following subsections:

13.6.1 How to Publish Content As Links

This section describes how to create hyperlinks to files stored in a file system and convert them into textual and image links. You use the ADF Go Link and the getURI method to create textual links and the Image of ADF Faces to create image links.

This section includes the following procedures:

Before you begin:

  1. Configure a repository connection as described in Section 13.2, "Configuring Content Repository Connections".

  2. Configure a data control as described in Section 13.5, "Configuring Content Data Controls for JCR Adapters".

  3. Create a JSPX page as described in Section 3.3, "Creating WebCenter Application-Enabled Pages."

13.6.1.1 Publishing Content As a Textual Link

In this section, you will use the Oracle ADF Go Link option of the getURI method to publish your content as a textual link. You will also create a link to show a specific item of a repository.

To publish content as a textual link:

  1. In the Application Navigator, double-click a .jspx page to open it in the visual editor.

  2. In the Data Controls panel, under the repository connection, expand the getURI (String) method and expand Return. You should see the URI attribute, as shown in Figure 13-20.

    Figure 13-20 The URI Attribute of the getURI Method

    Producer success message
    Description of "Figure 13-20 The URI Attribute of the getURI Method"

  3. To create a textual link, select the URI attribute and drop it on to the page, or in the Structure window under af:form. From the Create menu, choose Links and then ADF Go Link, as shown in Figure 13-21.

    If this is the first time you have dropped a node onto the page, then the Edit Action Binding dialog displays.

    Figure 13-21 Oracle JDeveloper Context Menu for the getURI method

    JDeveloper Context Menu
    Description of "Figure 13-21 Oracle JDeveloper Context Menu for the getURI method"

  4. In the Value field of the path parameter, enter the path of the file for which you intend to create the link, as shown in Figure 13-22. You must enter a leading slash (/), for example /PlasmaNews.html. To modify or delete this path later, click the arrow icon next to the node in design mode and choose Go to Binding from the context menu.

    Figure 13-22 Edit Action Binding

    Producer success message
    Description of "Figure 13-22 Edit Action Binding "

    Note:

    To grant edit, personalize, customize, and view permissions at the attribute level, see Section 13.5.4, "Securing a Content Repository Data Control".
  5. Click OK.

  6. Right-click the page and select Run. In your browser, you should see the URL for the file path entered in the Edit Action Binding dialog without any formatting.

  7. By default, the link displays the text goLink1. In the Structure window, select af:goLink - goLink1 and view the properties in the Property Inspector.

  8. In the Text field, enter a name for the link, for example, Plasma News, as shown in Figure 13-23.

    Figure 13-23 Go Link Properties

    GoLink Properties
    Description of "Figure 13-23 Go Link Properties"

  9. Right-click your page and choose Run. The page appears in your browser window with the new link, as shown in Figure 13-24.

    Figure 13-24 ADF Go Link in a Browser

    Help Link
    Description of "Figure 13-24 ADF Go Link in a Browser"

  10. Click the link to check that the correct file is displayed.

In Section 13.6.1.2, "Creating a Clickable Image to Link to a Document", you will extend this textual link into an image link.

To add a link to another item, in the same JSF page:

  1. In the Application Navigator, right-click the .jspx page in which you created the ADF Go Link, and choose Go to Page Definition. The Page Data Binding Definition displays in the design view, as shown in Figure 13-25.

    Figure 13-25 Page Data Binding Definition

    Description of Figure 13-25 follows
    Description of "Figure 13-25 Page Data Binding Definition"

  2. Go to the source view of the page definition.

  3. In the executables element, add another methodIterator and change the methodIterator id and value of Binds, as shown in Bold in the following example:

    <executables>
      <variableIterator id="variables"/>
      <methodIterator Binds="getURI.result" DataControl="MyDataControl"
         RangeSize="25" BeanClass="model.MyDataControl.getURI_return"
         id="getURIIterator"/>
      <methodIterator Binds="getURI1.result" DataControl="MyDataControl"
        RangeSize="25" BeanClass="model.MyDataControl.getURI_return"
        id="getURIIterator1"/>
      </executables>
    
  4. In the Bindings element, add another methodAction and change the methodAction id, ReturnName, and NDValue, as shown in Bold in the following example:

    <methodAction id="getURI" 
      RequiresUpdateModel=true Action="invokeMethod" MethodName="getURI"
      IsViewObjectMethod="false" DataControl="MyDataControl"
      InstanceName="MyDataControl" 
      ReturnName="MyDataControl.methodResults.getURI_MyDataControl_getURI_result">
      <NamedData NDName="path" NDValue="/PlasmaNews.html"
        NDType="java.lang.String"/>
    </methodAction>
    <methodAction id="getURI1" 
      RequiresUpdateModel="true" Action="invokeMethod" MethodName="getURI"
      IsViewObjectMethod="false" DataControl="MyDataControl"
      InstanceName="MyDataControl" 
      ReturnName="MyDataControl.methodResults.getURI_MyDataControl_getURI1_result">
      <NamedData NDName="path" NDValue="/FusionOrderDemoLogo.jpg"
        NDType="java.lang.String"/>
    </methodAction>
    
  5. In the Bindings element, add another attributeValues tag to specify the new Id, as shown in bold in the following example:

    <attributeValues 
          IterBinding="getURIIterator" 
          id="URI">
       <AttrNames>
          <Item Value="URI"/>
       </AttrNames>
    </attributeValues>
    <attributeValues 
            IterBinding="getURIIterator1" 
            id="URI1">
      <AttrNames>
            <Item Value="URI"/>
      </AttrNames>
    </attributeValues>
      
    
  6. In the Data Controls panel, under the repository connection, expand the getURI (String) method and expand Return. You should see the URI attribute.

  7. To create a textual link, select the URI attribute and drop it on to the page, or in the Structure window under af:form. From the Create menu, choose Links and then ADF Go Link, as shown in Figure 13-26.

    Figure 13-26 Oracle JDeveloper Context Menu for the getURI method

    JDeveloper Context Menu
    Description of "Figure 13-26 Oracle JDeveloper Context Menu for the getURI method"

  8. In the Structure window, double-click the new goLink; for example, af:goLink2 to display the Go Link Properties window.

  9. In the Text field, enter a display name for your new link; for example, FOD Logo.

  10. In the Destination field, click the down arrow to display the Expression Builder dialog. Then, expand ADF Bindings, bindings, and URI1.

  11. Double-click inputValue variable to create the #{bindings.URI1.inputValue} expression, and click OK. This expression is based on new elements that you added in executables and bindings.

  12. Run your page. The new link should display content from the new path (NDValue) that you specified in step 4. Figure 13-27 shows the new link, FOD Logo, in addition to the Plasma News link that was added in the first part of Section 13.6.1.1, "Publishing Content As a Textual Link".

    Figure 13-27 New Textual Link

    Description of Figure 13-27 follows
    Description of "Figure 13-27 New Textual Link"

    You can add as many links as required by following these steps.

13.6.1.2 Creating a Clickable Image to Link to a Document

In this section, you will use the Image option of ADF Faces to publish a document as a clickable image, that is, clicking the image object will display your document.

To publish content as a clickable image object:

  1. In the Application Navigator, open the .jspx page, in which you created the ADF Go Link, by double-clicking it.

  2. To convert the textual link that you created in the first part of Section 13.6.1.1, "Publishing Content As a Textual Link", in the Structure window, right-click af:goLink, choose Insert Inside af:goLink, and then ADF Faces, as shown in Figure 13-28. The Insert ADF Faces Item dialog displays.

    Figure 13-28 Insert Inside af:goLink - ADF Faces

    Description of Figure 13-28 follows
    Description of "Figure 13-28 Insert Inside af:goLink - ADF Faces"

  3. From the Select an ADF Faces item to create list, select Image, as shown in Figure 13-29.

    Figure 13-29 Insert ADF Faces Item

    Description of Figure 13-29 follows
    Description of "Figure 13-29 Insert ADF Faces Item"

  4. Click OK. The Insert Image dialog displays.

  5. Browse to the image file you intend to display as the image link; for example, plasma.jpg.

  6. Click Finish.

  7. Right-click your page and choose Run. Figure 13-30 shows a sample output.

    Figure 13-30 ADF Object Image Link in a Browser

    Description of Figure 13-30 follows
    Description of "Figure 13-30 ADF Object Image Link in a Browser"

13.6.2 What Happens at Runtime

In the preceding examples, you created hyperlinks to files that are stored in a file system using ADF Go Link and converted them into textual and image links using the getURI method and the Image component of ADF Faces.

At runtime, the ADF framework uses the information from the page definition file to invoke the data control methods required by the JSPX page. For information about the page lifecycle, see the chapter "Understanding the Fusion Page Lifecycle" of Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework.

At runtime, the getURI data control method is invoked to convert the given path into a valid HTTP URI for the content repository for which the data control is configured. The returned URL is syntactically correct for the target repository, but is not guaranteed to find a resource, that is, the getURI method does not validate that the path corresponds to an existing JCR node. When the page is rendered and the clickable image or link is clicked, the application's get handler converts the HTTP URL into a JCR path and attempts to retrieve the content for the JCR path. The get handler also supplies mimeType information in the response Content-Type header, if such information is available from the repository. This is because in JCR, jcr:mimeType is an optional property of the nt:resource node type.

13.6.3 How to Publish Content in a Table

In this section, the getItems data control method is used to publish file and folder information in a table. This section describes the following procedures:

Before you begin:

  1. Configure a repository connection as described in Section 13.2, "Configuring Content Repository Connections".

  2. Configure a data control as described in Section 13.5, "Configuring Content Data Controls for JCR Adapters".

  3. Create a JSPX page as described in Section 3.3, "Creating WebCenter Application-Enabled Pages."

13.6.3.1 Displaying Files and Folders in Read-Only Format

Here you will create a read-only ADF table using the getItems method.

To display folder content in a read-only table:

  1. To open the page in the visual editor, double-click it in the Application Navigator.

  2. In the Data Controls panel, under your data control, expand the getItems method and the Return node, as shown in Figure 13-31.

    Figure 13-31 The Return node of the getItems method

    Producer success message
    Description of "Figure 13-31 The Return node of the getItems method"

  3. To create a table that lists every file and folder available through this data control, drop the Return node on to the page or under af:form in the Structure window. From the Create menu, choose Table and then ADF Read-only Table , as shown in Figure 13-32.

    Figure 13-32 The Create Context Menu for getItems Method

    Producer success message
    Description of "Figure 13-32 The Create Context Menu for getItems Method"

  4. In the Edit Table Columns dialog, as shown in Figure 13-33, Select the row for the getItems.name Value Binding and enter an appropriate value for the Display Label; for example, Name.

    Repeat this step for the path, URI, primaryType, and lastModified attributes. Enter new display labels such as name, Location, URL, and so on, then click OK.

    Figure 13-33 Edit Table Columns

    Producer success message
    Description of "Figure 13-33 Edit Table Columns"

  5. If this is the first time you have dropped a node onto the page, the Edit Action Binding dialog displays.

    In the Edit Action Binding dialog, enter the path of the content directory as the path parameter, as shown in Figure 13-34. You must enter a leading slash (/). To modify or delete this path later, click the arrow icon next to the node in design mode and choose Go to Binding from the context menu.

    Leave the type parameter blank. This implies that the table displays both files and folders.

    Figure 13-34 Edit Action Binding

    Producer success message
    Description of "Figure 13-34 Edit Action Binding "

  6. Click OK. You should now see a table on the JSPX page that looks like Figure 13-35.

    Figure 13-35 Read-Only Table for Publishing Folder Content

    Read-Only Table
    Description of "Figure 13-35 Read-Only Table for Publishing Folder Content"

    Note:

    You can turn the page caching on or off. To do so, open the page definition and expand executables, and select getItemsIterator in the Structure window. Then, in the Property Inspector, set CacheResults to true or false, as required.
  7. Run the page. You should see a list of all files and folders available in your content directory. Figure 13-36 shows a read-only table displaying both files and folders at runtime.

    Figure 13-36 Files and Folders Displayed in a Read-Only Table

    Folder Content in Read Only Table
    Description of "Figure 13-36 Files and Folders Displayed in a Read-Only Table"

    By default, the table displays file or folder attributes as read-only text (af:outputText). The next section describes how to display the Name attribute (name) as a Go Link (af:goLink).

13.6.3.2 Displaying the Name Attribute As a Go Link

In this section, you will convert the Name attribute of the table that you created in Section 13.6.3.1, "Displaying Files and Folders in Read-Only Format" into a link using an ADF Go Link component. You will also configure the table to show only the Name column.

To display the Name attribute as a Go Link:

  1. In the Structure window (Figure 13-37), expand the first column of the table (af:column - Name) to show the default display format af:outputText - #{row.name}.

    Figure 13-37 Default Formatting for the Name Column

    Default Formatting for Name Column
    Description of "Figure 13-37 Default Formatting for the Name Column"

  2. In the source view for the page, change the name column to use a go link. The link displays the name but links to the URI of the entry:

    Replace the af:outputText in bold

    <af:column sortProperty="name" sortable="false"
          headerText="#{bindings.Return.hints.name.label}" id="c2">
       <af:outputText value="#{row.name}" id="ot1"/>
    </af:column>
    

    with an af:goLink as shown in bold:

    af:column sortProperty="name" sortable="false" 
         headerText="#{bindings.Return.hints.name.label}" 
         id="c4"> 
      <af:goLink text="#{row.name}" id="goLink2" 
         destination="#{row.bindings.URI.inputValue}"/> 
    </af:column> 
    
  3. In the Structure window, right-click af:column - URL and select Delete.

  4. Right-click the page in the Application Navigator and choose Run. You should see a list of hyperlinked file and folder names like the one shown in Figure 13-38. This figure shows the name attribute as a link. Clicking a link in the URI column opens the respective file or folder and shows its contents.

    Figure 13-38 Folder Content Displayed as Hyperlinks

    Folder Content Displayed as Hyperlinks
    Description of "Figure 13-38 Folder Content Displayed as Hyperlinks"

  5. Click a file name. The file you pick should appear in a browser window.

  6. Click the name of a folder, the contents of the folder display, as shown in Figure 13-39.

    Figure 13-39 Folder Contents

    Description of Figure 13-39 follows
    Description of "Figure 13-39 Folder Contents"

To configure the table to show only the Name column:

  1. In the Structure window, under the af:table - t1 node, delete all but the Name column.

  2. Double-click the af:table - t1 node to display the Property Inspector.

  3. Under the Common tab, in the Id field, enter a name, for example myFiles, as shown in Figure 13-40, and click OK.

    Figure 13-40 Table Properties - Common Tab

    Table Properties
    Description of "Figure 13-40 Table Properties - Common Tab"

  4. Run the page to view the output. Figure 13-41 shows only one column of the table since other rows were removed from the Structure window at design time. This table shows both files and folders, because you left the type parameter blank when creating the table.

    Figure 13-41 Files and Folders Displayed in a Single-Column Table

    Description of Figure 13-41 follows
    Description of "Figure 13-41 Files and Folders Displayed in a Single-Column Table"

In the next section, the Name column will be configured to show only files.

13.6.3.3 Configuring a Table to Show Only Files

The type attribute is used to configure a table to show only files and not folders.

To configure the table to show files:

  1. Right-click your .jspx page and choose Go to Page Definition.

    Note:

    The RangeSize binding setting, which is used to control the number of items displayed on a page, is set to 10 by default in the page definition file. You can change it, as required, in the Property Inspector.
  2. In the Overview tab, double-click getItems under Bindings. The Edit Action Binding dialog displays.

  3. The type options are nt:file and nt:folder. To specify the display of only files, enter nt:file under the Value column, as shown in Figure 13-42, and click OK.

  4. Figure 13-42 Display Files Only

    Description of Figure 13-42 follows
    Description of "Figure 13-42 Display Files Only"

  5. Now run the page. Figure 13-43 shows only files in the single-column table because the column type is nt:file.

    Figure 13-43 Files Displayed in a Single-Column Table

    Folder Content Displayed as Hypertext Links
    Description of "Figure 13-43 Files Displayed in a Single-Column Table"

13.6.4 What Happens at Runtime

The getItems method of the JCR data control retrieves the child items of a JCR folder (type nt:folder). This method is called with a path to a folder and optionally a type to which the returned child nodes are restricted.

The path parameter must be the path of a folder. An exception to this rule is that the root of the repository does not have to be a folder. Hence, the getItems method can retrieve the child items for a path that corresponds to a folder, or that is the root of the repository. Otherwise the getItems method does not attempt to retrieve the child items and therefore the result set is never populated.

At runtime, the JCR data control calls the Session.getItem method. This method returns a JCR node. The data control then calls the node.getNodes to retrieve child nodes. The child nodes are filtered according to the specified type; for example, the nt:file type. The data control passes on these child nodes to ADF. The data control ensures that the JCR node object is adapted to ADF so that JCR properties are available as data control item attributes that can be consumed through the bindings container.

In the example, each row in the collection returned by the data control is stored as a row in the af:table table. However, a column is only displayed for each af:column defined in the af:table, and not for every possible ADF item attributes returned by the data control. In the first part of the example, the drag and drop action creates an af:column for every ADF attribute available for each ADF item returned by the data control.

If the af:table is modified to include only the af:column for the name, then at runtime it only requests the name of the ADF item. That is, the data control runs a method to fetch the name of the JCR node. At design time, when the name column is converted to an af:goLink, the destination of Go Link destination is set to the URI value of the item, as shown in the following syntax:

<af:goLink text="#{row.name}" destination="#{row.URI}"/>

At runtime, for each ADF item in the table, the data control runs methods to return both the JCR name of the item and its HTTP URL.

13.6.5 How to Publish Folder Content in a Tree

In this section, you will use the getItems method to publish content in a hierarchal tree format. This section describes the following procedures:

Before you begin:

  1. Configure a repository connection as described in Section 13.2, "Configuring Content Repository Connections".

  2. Configure a data control as described in Section 13.5, "Configuring Content Data Controls for JCR Adapters".

  3. Create a JSPX page as described in Section 3.3, "Creating WebCenter Application-Enabled Pages."

13.6.5.1 Displaying Files and Folders in Read-Only Format

In this section, you will display your content in the tree format.

To display your content in the tree format:

  1. In the Application Navigator, double-click your page to open it in the design view.

  2. In the Data Controls panel, under your data control, expand the getItems method as shown in Figure 13-44.

    Figure 13-44 Parameters of the getItems Method

    Producer success message
    Description of "Figure 13-44 Parameters of the getItems Method"

  3. To display your content as an ADF Tree, select the Return node and drag it onto the page. From the Create menu, choose Tree and then ADF Tree, as shown in Figure 13-45.

    If this is the first time you have dropped a node onto the page, the Edit Action Binding dialog displays.

    Figure 13-45 Oracle JDeveloper Create Menu for getItems

    Producer success message
    Description of "Figure 13-45 Oracle JDeveloper Create Menu for getItems"

  4. To create a tree that displays everything under the base path, enter the slash (/) for the path parameter, as shown in Figure 13-46. To modify or delete this path later, click the arrow icon next to the node in the design mode and choose Go to Binding from the context menu.

    Leave the type parameter blank to show both files and folders.

    Figure 13-46 The Edit Action Binding Dialog

    Description of Figure 13-46 follows
    Description of "Figure 13-46 The Edit Action Binding Dialog"

  5. Click OK. The Edit Tree Binding dialog displays.

  6. To show item names, paths, and types at runtime, under Available Attributes, select URI and primary type, and move them to the Display Attributes list.

  7. In the Tree Level Rules box, click the Add Rule icon and select Items to create a rule, as shown in Figure 13-47, which enables the tree to find its child items.

    Figure 13-47 Edit Tree Binding

    Producer success message
    Description of "Figure 13-47 Edit Tree Binding"

  8. Click OK. A tree displays in the JSPX page that looks like Figure 13-48.

    Figure 13-48 Tree for Navigating Folder Content

    Tree for Navigating Content
    Description of "Figure 13-48 Tree for Navigating Folder Content"

  9. Run your page to display the results.

    When the page appears in your browser window, you should see a list of files and folders available through your data control. Figure 13-49 displays a tree of files and folders in the read-only format based on ADF tree dropped on the JSF page. Expand a branch to see the content in this subdirectory.

    Note:

    By default, the range size is 10. To change the number of items displayed in the tree, edit the RangeSize property for the data control in the page definition file (namePageDef.xml).

    Figure 13-49 Folder Content Displayed in a Tree

    Folder Content Displayed as a Tree
    Description of "Figure 13-49 Folder Content Displayed in a Tree"

By default, the tree displays file and folder names as read-only text. The next section describes how to create hyperlinks to file names. In the following section, folder names will remain read-only text because they are required for navigation through the tree.

13.6.5.2 Displaying File Names As Hyperlinks

To create hyperlinks to file names and to keep folder names read-only, you need the af:switcher component with two facets: one for folders and one for files.

To use the Switcher component for folders and files:

  1. In the Structure window, navigate to nodeStamp and delete af:outputText-#{node}.

  2. Right-click nodeStamp and choose Insert inside nodeStamp and then ADF Faces.

  3. In the Insert ADF Faces Item dialog, from the Select an ADF Faces item to create list, select Switcher, and click OK.

    A Switcher is added under nodeStamp in the Structure window, as shown in Figure 13-50.

    Figure 13-50 Output Text Converted to a Switcher Component

    Switch Component
    Description of "Figure 13-50 Output Text Converted to a Switcher Component"

  4. Double-click af:switcher to display the Property Inspector, if it is not displayed.

  5. Under the Common tab, in the FacetName field, enter the expression #{node.primaryType}.

  6. In the Structure window, insert two facets for the switcher. Right-click af:switcher, choose Insert Inside af:switcher and then Facet. The Insert Facet dialog displays.

  7. Name the first facet nt:folder and click OK. Folder names require no additional formatting, so you can display the node names as plain text. Name the second facet nt:file. The facets look like Figure 13-51.

    Figure 13-51 Switcher Component with Two Facets

    Switcher Components
    Description of "Figure 13-51 Switcher Component with Two Facets"

  8. Right-click f:facet - nt:folder, choose Insert Inside f:facet - nt:folder, and then choose ADF Faces.

  9. In the Insert ADF Faces Item dialog, select Output Text and click OK.

  10. Double-click af:outputText - outputText1 to display the Property Inspector, if it is not displayed already. Under the Common tab, in the Value field, enter the expression #{node.name}.

  11. Right-click f:facet - nt:file, choose Insert Inside f:facet - nt:file, and then choose ADF Faces.

  12. In the Insert ADF Item dialog, select Go Link from the Select the item to be created box, and click OK.

  13. In the Structure window, double-click af:goLink - goLink to display the Property Inspector, if it is not already displayed.

  14. Under the Common tab, in the Text field, enter the #{node.name} expression.

  15. In the Destination field, enter the expression #{node.URI}.

  16. From the TargetFrame list, select _blank.

  17. Run the page. Figure 13-52 displays files names as hyperlinks, because the nt:file facet of the switcher under af:tree was converted to a link (node.URI). Clicking a link displays the respective item.

    Figure 13-52 Tree with File Names as Hyperlinks

    Description of Figure 13-52 follows
    Description of "Figure 13-52 Tree with File Names as Hyperlinks"

13.6.6 What Happens at Runtime

The JCR data control getItems method is designed to retrieve the child items of a JCR folder (type nt:folder). The method is invoked with a path to a folder and optionally a type to which the returned child nodes are restricted. The path parameter must be the path of a folder for the getItems method to retrieve the child items. An exception to this rule is that the root of the repository does not have to be a folder. Hence, the getItems method can retrieve the child items for a path that corresponds to a folder, or that is the root of the repository. Otherwise the getItems method does not attempt to retrieve the child items and therefore the result set is never populated. If the path is valid, then the data control invokes JCR Session.getItem() on this path which returns a JCR node, and then it invokes node.getNodes() to retrieve all child nodes. The child nodes are filtered according to the type supplied; for example, to return only the nt:file type child node. This is the result that is provided by the data control to ADF. The data control ensures that the JCR node object is adapted to ADF such that JCR properties are available as data control item attributes that can be consumed by way of the bindings container.

The af:tree renders each node in the collection returned by the data control as a node in its tree. In the first part of the example, it displays the name, type, and URI for each node. Each of these values is retrieved through the data control. When the switcher is added to the af:tree the node's primaryType value is used to differentiate how a node is rendered. If the node is of primary type nt:folder, then only its name is shown in the tree node. However if the node is of type nt:file, then the node renders go:Link, the destination of which is the node's URI. The data control getItems method is invoked again to retrieve the child nodes of any folder node in the tree.

13.6.7 How to Add Search Capabilities to Content Repositories

With the help of two examples, this section describes how to add simple and advanced search capabilities for the integrated content. The simple search enables users to search for the content based on name or content fragments in specific locations. The advanced search enables users to search by attribute values of the content.

This section contains the following:

Before you begin:

  1. Configure a repository connection as described in Section 13.2, "Configuring Content Repository Connections".

  2. Configure a data control as described in Section 13.5, "Configuring Content Data Controls for JCR Adapters".

  3. Create a JSPX page as described in Section 3.3, "Creating WebCenter Application-Enabled Pages."

13.6.7.1 Adding Simple Search Capabilities

In this section, you will enable simple search capabilities in your page. This will let you perform wildcard (%) search.

To enable the search function:

  1. In the Application Navigator, double-click your .jspx page to open it.

  2. In the Data Controls panel, select the search node.

  3. To enable users to perform a search by clicking a button, drag and drop the search node on your .jspx page. From the Create menu, choose Parameters and then ADF Parameter Form. The Edit Form Fields dialog displays.

  4. Click OK. The ADF parameter form is added to the page, as shown in Figure 13-53

    Figure 13-53 ADF Parameter Form in the Design View

    Description of Figure 13-53 follows
    Description of "Figure 13-53 ADF Parameter Form in the Design View"

  5. To enable the display of search results in a read-only table, drag and drop the Return node onto the page. From the Create menu, choose Table and then ADF Read-Only Table. The Edit Table Columns dialog displays.

  6. Click OK. A table similar to Figure 13-54 displays.

    Figure 13-54 Table with Four Columns - search

    Description of Figure 13-54 follows
    Description of "Figure 13-54 Table with Four Columns - search"

  7. Run this page and specify / for search_path and %jpg% for namePattern. All .jpg files stored in the root of your repository display, as shown in Figure 13-55.

    Figure 13-55 Search Results for .jpg Files

    Description of Figure 13-55 follows
    Description of "Figure 13-55 Search Results for .jpg Files"

13.6.7.2 Adding Advanced Search Capabilities

In this section, you will add advanced search capabilities to your page that will enable you to perform search based on the last modified dates of items located in your file system repository.

To enable the advanced search function:

  1. In the Application Navigator, open your .jspx page in which you intend to create the advanced search function. The page must be automatically exposed in new managed bean, where name=advancedSearch, class=AdvancedSearch, package=view.

    In this example the page is called advancedSearch.jspx.

  2. Double-click the .jspx page to open it.

  3. In the Component Palette, select ADF Faces.

  4. From the list of ADF Faces components, drag Panel Form Layout onto the page.

  5. From the Component Palette, drag Input Date into the Panel Form Layout.

  6. In the Property Inspector, under the Common tab, set the label to Modified after.

  7. Under view, double-click AdvancedSearch.java to open it.

  8. Add the following import declarations. These declarations are required for the getPredicates method, which will be added in the next step.

    import java.util.ArrayList;
    import java.util.Calendar;
    import java.util.Date;
    import java.util.List;
    import oracle.vcr.datacontrol.search.Predicate;
    import oracle.vcr.datacontrol.search.Operator;
    
  9. Add the following method to enable the advanced search based on last modified dates of the items stored in the repository:

    public List<Predicate> getPredicates() {
            ArrayList<Predicate> predicates = new ArrayList<Predicate>();
            if (id1.getValue() != null && !id1.getValue().equals(""))
    {
                Calendar cal = Calendar.getInstance();
                cal.setTime((Date)id1.getValue());
                predicates.add(new Predicate("jcr:content/jcr:lastModified"
                                             , Operator.GREATER_THAN
                                             , cal));
            }
            // ... other predicates
            if (predicates.size()>0)
                return predicates;
            return null;
        }
    
  10. From the Data Controls panel, drag the advancedSearch node onto the .jspx page. From the Create menu, choose Methods and then ADF Button. The Edit Action Binding dialog displays.

  11. For Path, specify the path to the directory in which the search will be performed; for example, /. For isRecursive specify true, and matchAny specify false.

  12. Select the arrow next to the Value field for predicates and then select Show El Expression Builder. The Variables dialog displays.

  13. Expand ADF Managed Beans, backingBeanScope, advancedSearch and select predicates. This adds the expression ${backingBeanScope.advancedSearch.predicates}, as shown in Figure 13-56, and click OK.

    Figure 13-56 Variables Dialog - predicates

    Description of Figure 13-56 follows
    Description of "Figure 13-56 Variables Dialog - predicates"

  14. Click OK in the Edit Action Binding dialog.

  15. In the Data Controls panel, expand the advancedSearch node. Then drag Return and drop it onto the page, after the advancedSearch ADF button. From the Create menu, choose Table and then ADF Read-only Table.

  16. In the Edit Table Columns dialog, edit labels of the columns, if needed. Then click OK. The Design view looks like Figure 13-57.

    Figure 13-57 Advanced Search - Design View

    Description of Figure 13-57 follows
    Description of "Figure 13-57 Advanced Search - Design View"

  17. In the Property Inspector, under the Behavior tab, set the ContentDelivery property to Immediate.

  18. To view the page in a browser, under the Application Navigator, right-click the .jspx and choose Run. The advancedSearch page displays in the browser.

  19. Enter a last modified date and click the advancedSearch button. The files modified after that date are displayed, as shown in Figure 13-58.

    Figure 13-58 Advanced Search Results

    Description of Figure 13-58 follows
    Description of "Figure 13-58 Advanced Search Results"

13.6.8 What Happens at Runtime

Clicking the search button at runtime invokes the search method and the values provided through the UI are used as the parameters for the search. At runtime, you can perform the wild (%) card search. For example, to search for files that have .jpg extension, enter / in the search_path field, enter %jpg in the namePattern field and then click Search. All files with the .jpg extension will display in the read-only table.

At runtime the JCR data control uses the given parameters to construct an XPath query for the given parameters. For the simple search example, the query is:

Non-recursive:
XPath query /jcr:root/element(*, nt:file)[jcr:like(ojcr:local-name(), '%jpg%')]

Recursive:
XPath query /jcr:root//element(*, nt:file)[jcr:like(ojcr:local-name(), '%jpg%')]

In the advanced search example, first a backing bean is added to the JSPX page, because the backing bean is required to construct the predicate parameter value of the advancedSearch method. Then the Panel Form Layout UI component is dropped onto the JSPX page. In this component, the InputDate component is dropped, which is used at runtime to supply the date-based search criterion. The advancedSearch method predicates parameter allows for a combination of predicates to be supplied to the search method. Each can specify the value of an item's properties that must apply for the search. In this example, only a modification date is tested in the predicates, but potentially multiple tests could be included, for example a modification date and a mimeType.

The backing bean's getPredicates method is hardcoded to construct the predicates method from the date provided by the page at runtime. At design time, the return value of the predicates method is bound into the predicates advancedSearch method parameter. At runtime this invokes the getPredicates method before invoking the advancedSearch method to construct the correct predicate value.

At runtime the JCR data control uses the given parameters to construct an XPath query for the given parameters. For this example the query is:

/jcr:root//element(*, nt:hierarchyNode)[jcr:content/@jcr:lastModified >
xs:dateTime('2009-02-15T00:00:00.000+05:30')]

13.6.9 What You May Need to Know When Using Search Capabilities

Consider the following points while adding search capabilities:

  • How certain operations work depends on the implementation of the adapter and the underlying repository. While read and query operations are similar, full text search works differently. Another example is, the file system and Oracle Portal adapters do not support search based on the primaryType attribute. The only supported way to search based on type is through the element (*, type) construct.

  • If you use the Oracle Portal adapter, then the behavior of search functionality varies depending on whether Oracle Text is enabled or not. If Oracle Text is disabled, then the search is performed in the Oracle Portal content metadata. With Oracle Text turned on, all indexed content is searched, which includes the contents of files. This also applies to Oracle Content Server. That is, Oracle Content Server-based adapter performs full text index operation on its documents using Oracle Text.

  • The Oracle Portal adapter does not support translations and only returns content in the base language of a page group. Searching across multiple page groups with different base languages is not supported.