First Previous Next Last

Samples  

Chapter 3   Content Query and RSS Applications

This chapter describes how to use the Content Query and RSS sample applications. It has these sections

 
Top of page

About the Content Query application

The Content Query application (CQA) allows you to query published documents in the content management system. You can query by folder, category, document type, or by specific document. Searches can be designated as either inclusive or exclusive. The results of the query are captured in XML and processed as a query in the Content Management subsystem.

Content Query consists of sample components and rules that use the installed Content Query action. The pieces of the Content Query application are provided in your install directory at:

  Portal/WEB-INF/lib/cqa_components.jar

This JAR includes matching pairs of rule and component identifiers:

Rule and Component ID

Description

ContentList.xml

Executes a general document query against the Content Management Subsystem.

MyDocuments.xml

Executes a query for documents created or modified by the logged in user.

NewDocuments.xml

Executes the SetDateonWhiteboard action and executes a query for documents created or modified on the current date.

 
Top of section

Component processing

The implementing class for each sample rule and component is ContentList. You can build queries by editing one of the sample rules in the Rule Editor, or you can create your own rule. If you create your own rule you can create a component descriptor with the same identifier as the rule and use ContentList as the implementing class.

 
Top of page

Using the Content Query action

The Content Query action provides a custom user interface in the Rule Editor for specifying the folders, categories, document types, and documents to include (or exclude) in the query results. It also provides an interface for selecting the properties (content fields) that should be displayed in the query output and for specifying sort rules. The Content Query action also includes a query builder to allow you to specify selection criteria.

Procedure To edit and run a query:

  1. If you have not yet created content, you need to add some content using the Portal Administration Console (PMC) or WebDAV.

  2. Start your server and open one of the sample rules Workbench. They are located in:

      Portal/WEB_INF/lib/cqa-componets/data/rule
    

    NOTE   You can also create a new rule and add the Query action. If you are creating your own rule, skip the next step.

  3. Select the Edit query against the content management system action, then right-click and select Edit from the popup menu.

    A popup asks you to specify the URL to your project's ContentMgmtService folder.

  4. Specify the correct URL—for example:

      http://my_server/my_DirectorDB/my_namespace/ContentMgmtService/
    

    The Content Query property sheet displays:

    QueryAction

  5. On the Search tab, specify which documents you want to include (or exclude) in your query:

    To select one or more

    Click the

    Folders to be included or excluded

    Folders button

    Categories to be included or excluded

    Categories button

    Document types to be included or excluded

    Doc Types button

    Documents to be included or excluded

    Documents button

    Each property panel allows you to specify an URL to a whiteboard key for the documents:

    QueryWhiteboard

    You can either enter the value or specify a whiteboard key that holds the value you want. Use this format:

      !valueOf.keyname
    

    You can also specify a key that holds the name of another key. To get a value from another key, specify !valueOf.anotherkey.

    For more information    For more information about the !valueOf construct, see Using Whiteboard values in the Rules Guide.

  6. To build a query condition, click the Whose button.

    QueryWhose

    The Whose query builder lets you specify selection criteria for individual content management properties. To build a query condition:

    Step

    Action

    1

    If you've already added one or more conditions to the query, select a logical operator (and or or).

    2

    Select Standard Document Properties.

    3

    Select a property (such as Author).

    4

    Select an operator (such as ends with).

    5

    Select <literal>.

    NOTE   Only literal strings or whiteboard keys are supported at this time.

    6

    Enter a value that will be used for the expression. You can either enter the literal value or a whiteboard key that holds a value. Use this format:

      !valueOf.keyname
    

    You can also specify a key that holds the name of another key. To get a value from another key, specify !valueOf.anotherkey.

    For more information    For more information about the !valueOf construct, see Using Whiteboard values in the Rules Guide.

    7

    Click Add to add the condition.

    The query specifications you provide on the Search tab are ANDed together. That means that to be included in the result set for the query, a document must satisfy all of the criteria specified on the Search tab.

  7. On the Properties tab, select the document properties that you want to appear in the query output. You can select one or more properties from the list on the left and add them to the list on the right by using the arrows. You can also move the properties up or down to adjust the display order by using the arrows on the right side of the dialog.

    NOTE   You must select at least one property on the Properties tab to see data in the query output. In the ContentList sample some properties are selected by default.

  8. On the Sort tab, specify how the data will be sorted in the query output. For each property you select, you can specify the sort order (ascending or descending).

  9. Once you've finished editing the action, click Exit. To save your changes, click Yes.

  10. Save the rule.

  11. To test your query, add the appropriate sample component to a portal page and test the page.

 
Top of page

About the RSS application

Delivering content through a standard protocol and file format (called Content Syndication) is an important feature of the Content Management subsystem. The RSS sample application includes a Content Syndication reader and a Content Syndication provider that use the RSS standard. RSS is a standard lightweight XML descriptor used to format Web documents.

The sample reader allows you to deliver content to users from external providers such as partners, news headlines, and other sources of information using the RSS format. The sample provider allows you to create multiple content syndication feeds from the Content Management subsystem.

The RSS application is packaged in your installation directory at these locations:

  Portal/WEB-INF/lib/rss_components.jar
  Portal/WEB-INF/lib/contentMgmt_components.jar

Here is a summary of the contents:

Element

Description

RSSEditor

Component for selecting RSS documents. Provides a set of RSS documents available on the Web and allows you to specify an URL.

Contained in rss_components.jar

RSSViewer

Component that allows you to view RSS documents selected in the RSS editor.

Contained in rss_components.jar

RSSChannel01

RSS provider that consists of a rule and component descriptor. It implements the ContentList class to execute a document query against the Content Management System and retuns the result in RSS format.

Contained in contentMgmt_components.jar

RSSChannel02

An additional RSS provider with the same functionality as RSSChannel01. Processes documents of type html.

Contained in contentMgmt_components.jar

RSSChannel styles

For each RSSChannel component, an XSL style sheet that formats the RSS, and an XML style descriptor.

 
Top of section

Component processing

The RSS application uses these elements to provide Content Management documents in RSS format:

This diagram shows how a channel component is processed:

cqa-rss process

The implementing class for each sample rule and component is ContentList. You can build queries by editing one of the sample rules in the Rule Editor, or you can create your own rule. If you create your own rule you can create a component descriptor with the same identifier as the rule and use ContentList as the implementing class.

 
Top of page

Using the RSS application

Procedure To use the RSS Viewer:

  1. Add the RSSViewer component to a portal page. It is available under the General Components category.

  2. Click the Edit icon in the component header. This displays the Customize Channels page (which is the RSS editor).

  3. Enter the URL and an alias for an RSS feed and/or select available RSS feeds from the list.

  4. Click Finish.

    The result is displayed in the RSS Viewer. If you specified an URL and alias for a new RSS feed, the new alias appears in the selection list the next time you open the Customize Channels page.

Procedure To create RSS content:

  1. Open one of the RSSChannel rules in the Rule Editor.

  2. Use the Content Query action to select documents.

    For more information    For details see Using the Content Query action.

    Each queried document in the Content Management Subsystem must have a defined title and abstract property in order to be processed by the RSS channel components.

    NOTE   Do not edit the Properties tab in the Content Query action. The RSS components that handle the formatting depend on the listed properties.

  3. Save the rule.

  4. To test the rule, open the channel in the RSS Viewer. For example, in the Customize Channels page specify:

    First Previous Next Last

Samples  

Copyright © 2002, SilverStream Software, LLC, a wholly owned subsidiary of Novell, Inc. All rights reserved.