Content Management Guide

CHAPTER 22

Content Query Application

This chapter describes how to use the Content Query action and related artifacts to query the Content Management subsystem. It has these sections:

NOTE:   To use this application your project must include the Content Management and the Rule subsystems.

 
Top of page

About Content Query

The Content Query action (CQA) allows you to query published documents in the Content Management (CM) subsystem. 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 CM subsystem.

Content Query consists of a portlet and sample rules that use the installed Content Query action. The application artifacts are provided in your exteNd Director directory at:

  Portal/WEB-INF/lib/cqa-portlets.jar

Application contents    The CQA-Portlets JAR includes:

CQA Artifact

Description

ContentListPortlet.class

Portlet that displays the results of a query using the Content Query action.

ContentList.xml

Sample rule that executes a general document query against the CM subsystem.

For more information    See Using the Content Query action.

MyDocuments.xml

Sample rule that executes a query for documents created or modified by the logged-in user

NewDocuments.xml

Sample rule that executes the SetDateonWhiteboard action and executes a query for documents created or modified on the current date

 
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 Director Administration console (DAC) or WebDAV.

  2. Start your server and open the ContentList rule in exteNd Director.

    For more information    For more information, see Using the Rule and Macro Editors in the Rules Guide.

    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://localhost/MyDirectorProj/ContentMgmtService/
    

    The Content Query Property Inspector 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 the section on 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 CM 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>.

    TIP:   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 the chapter on 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 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.

    TIP:   You must select at least one property on the Properties tab to see data in the query output. In the ContentList rule, 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.

  10. To save your changes, click Yes.

  11. Save the rule.

  12. To test your query, add the ContentList portlet to a portal page and test the page.



Copyright © 2004 Novell, Inc. All rights reserved. Copyright © 1997, 1998, 1999, 2000, 2001, 2002, 2003 SilverStream Software, LLC. All rights reserved.  more ...