|
Samples |
This chapter describes how to use the Content Query and RSS sample applications. It has these sections
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:
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.
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.
If you have not yet created content, you need to add some content using the Portal Administration Console (PMC) or WebDAV.
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.
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.
Specify the correct URLfor example:
http://my_server/my_DirectorDB/my_namespace/ContentMgmtService/
The Content Query property sheet displays:
On the Search tab, specify which documents you want to include (or exclude) in your query:
Each property panel allows you to specify an URL to a whiteboard key for the documents:
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 about the !valueOf construct, see Using Whiteboard values in the Rules Guide.
To build a query condition, click the Whose button.
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:
You can also specify a key that holds the name of another key. To get a value from another key, specify
|
|
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.
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.
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).
Once you've finished editing the action, click Exit. To save your changes, click Yes.
To test your query, add the appropriate sample component to a portal page and test the page.
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:
The RSS application uses these elements to provide Content Management documents in RSS format:
This diagram shows how a channel component is processed:
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.
Add the RSSViewer component to a portal page. It is available under the General Components category.
Click the Edit icon in the component header. This displays the Customize Channels page (which is the RSS editor).
Enter the URL and an alias for an RSS feed and/or select available RSS feeds from the list.
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.
Use the Content Query action to select documents.
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.
To test the rule, open the channel in the RSS Viewer. For example, in the Customize Channels page specify:
|
Samples |
Copyright © 2002, SilverStream Software, LLC, a wholly owned subsidiary of Novell, Inc. All rights reserved.