bea.com | products | dev2dev | support | askBEA |
![]() |
![]() |
|
![]() |
e-docs > WebLogic Platform > WebLogic Portal > Development Guide > Portal Content Management |
Development Guide
|
Portal Content Management
A key component of any portal is its content. WebLogic Portal provides content by using a Content Manager. A Content Manager provides content and document management capabilities for use in personalization services to target users with dynamic web content. It works with files or with content managed by third-party vendor tools. While developing portal resources, you will have to configure the Content Manager and use various content-related tags so that the user has access to the most relevant content available.
This section includes information on the following subjects:
Adding Content by Using the Bulk Loader
The easiest way to add content to a portal is to use the bulk loader scripts provided by BEA. To implement this strategy, use this procedure:
The load scripts can be found at this location:
<BEA_HOME>\weblogic700\samples\portal\<DOMAIN_NAME>\
You can run these scripts either by typing them at the command line (or Start | Run in Windows NT or 2000) or by going to the Windows Explorer, locating the script you want to run, and double-clicking it in the file list. If you run the BulkLoader from a command line, you can also use any of the switches listed in Table 8-1.
For this strategy to succeed, the CMS must be able to publish document metadata in one of the three ways the BulkLoader supports:
BulkLoader Performance Tips
The following suggestions will improve BulkLoader performance.
Clean Up the Cache
If you've made a lot of small updates to a page, before running the BulkLoader, you should clean up the cache. On the Cache Manager Administration tab on the Administration Console, select Flush Entire Cache and click Flush, as shown in Figure 8-1.
Figure 8-1 Flushing the Cache
Flushing is particularly helpful for these caches:
Restarting the ConnectionPool
If you used the E-Business Control Center to add new metadata properties, you need to restart the connectionPool. To do so:
<yourDomain>—> Deployments—> Applications—> <yourPortal>—> Service Configurations—> Documents—> DocumentConnectionPool Services—> Default
Configuring the Content Manager
If you are using a third-party Content Management System to populate a portal, you will need to configure it to work with WebLogic Portal. This section explains the configuration procedures you will need to perform.
The Content Manager is a run-time subsystem that provides access to content through tags and EJBs. When developing JSPs, the Content Management tags allow you to receive an enumeration of content objects by querying the content database directly by using a search expression syntax. The Content Manager component works alongside the other components to deliver personalized content, but does not have a GUI-based tool for edit-time customization.
The following section describes the tasks required to configure a Content Manager. It includes information on the following subjects:
Configuring the DocumentManager EJB Deployment Descriptor
The DocumentManager EJB deployment descriptor handles the EJB portion of the Content Management component configuration and must be configured to recognize the correct environmental settings. To configure the DocumentManager EJB, ensure that the following environment settings are in its deployment descriptor:
If jdbc/docPool is specified in the deployment descriptor, then:
Note: Use lower or upper depending upon the document connection pool implementation being used. For the document reference implementation, do not specify the PropertyCase.
Configuring the PropertySetManager EJB Deployment Descriptor for Content Management
The DocumentManager needs to be integrated into the PropertySetManager EJB deployment descriptor so that content property sets are exposed to the system. To configure the PropertySetManager EJB Deployment Descriptor for content management, add the following environment settings:
To integrate a ContentManager or DocumentManager with the PropertySetManager, add an EJB reference here. For example, ejb/ContentManagers/Document is mapped to the standard DocumentManager.
Alternately, you can set the JNDIName attribute of the DocumentManager MBean to the JNDI Home name of the DocumentManager. The ${APPNAME} construct can be used in the value; it will be replaced by the current J2EE application name. The com.bea.p13n.content.PropertySetRepositoryImpl will automatically pick up those DocumentManagers and the J2EE EJB reference is not required.
Configuring DocumentManager MBeans
The DocumentManager implementation uses DocumentManager MBeans to maintain its configuration. A deployed DocumentManager finds which DocumentManager MBean to use from the DocumentManagerMBeanName EJB deployment descriptor setting. You will need to configure the DocumentManager MBeans in the application so that their values correspond to the Name attributes in the DocumentManagerMBeanName EJB deployment descriptor.
To configure a DocumentManager MBean, you can modify the application's META-INF/application-config.xml file to add or change the following XML, as shown in Listing 8-1.
Listing 8-1 Modifying the <DocumentManager> Element in an Application's META-INF/application-config.xml File
<DocumentManager
Name="default"
DocumentConnectionPoolName="default"
PropertyCase="none"
MetadataCaching="true"
MetadataCacheName="documentMetadataCache"
UserIdInCacheKey="false"
ContentCaching="true"
ContentCacheName="documentContentCache"
MaxCachedContentSize="32768"
>
</DocumentManager>
Do not try to change these attributes from within the application-config.xml file. Instead, use the WebLogic Server Administration Console, as described in Using the WebLogic Server Administration Console to Modify DocumentManager MBeans.
Using the WebLogic Server Administration Console to Modify DocumentManager MBeans
To modify DocumentManager MBeans by using the WebLogic Server Administration Console, use this procedure.
http://<hostname>:<port>/console
Figure 8-3 WebLogic Server Administration Console
MyDomain
Where:
Figure 8-4 shows an example of the nodes you would select to drill down to the Default MBean for the DocumentManager for an application called portalApp.
Figure 8-4 Drilling Down to an MBean
When you select the MBean node, the DocumentManager Services screen for that MBean appears in the right pane, as shown in Figure 8-5. Note the MBean name on the tab.
Figure 8-5 DocumentManager Service Screen
Disabling an MBean
You can enable or disable an MBean from the WebLogic Server Administration Console. To do so, use this procedure.
Note: This procedure assumes that you are connected to WebLogic Server and have the Administartion console open, as you did in Using the WebLogic Server Administration Console to Modify DocumentManager MBeans.
Figure 8-6 Selecting the Add or remove service configurations Node
Figure 8-8 Service Configuration Screen with MBean Deselected
Restoring a Disabled MBean
To restore the MBean disabled in the preceding procedure, click its acssociated checkbox to select it. Again, once you've restored all necessary MBeans, click Submit.
Setting Up Document Connection Pools
The DocumentManager implementation uses connection pools to a specialized JDBC driver to handle searches on content. A deployed DocumentManager finds the document connection pool to use via either the DocumentConnectionPoolName attribute of its DocumentManager MBean or the DocumentConnectionPoolName EJB deployment descriptor setting. That value must correspond to a DocumentConnectionPool MBean.
To configure a DocumentConnectionPool MBean, modify the application's META-INF/application-config.xml file by adding or changing the XML shown in Listing 8-2:
Listing 8-2 Modifying an Application's META-INF/application-config.xml File to Configure a DocumentConnectionPool MBean
<DocumentConnectionPool
Name="default"DriverName="com.bea.p13n.content.document. jdbc.Driver"URL="jdbc:beasys:docmgmt:com.bea.p13n.content
document.ref.RefDocumentProvider"
Properties="jdbc.dataSource=weblogic.jdbc.pool.commercePool;
schemaXML=D:/bea/user_projects/myNEWdomain/dmsBase/
doc-schemas;docBase=D:/bea/user_projects/myNEWdomain/dmsBase"
InitialCapacity="20"
MaxCapacity="20"
CapacityIncrement="0"
/>
Editing a DocumentConnectionPool MBean in the WebLogic Console
As with the DocumentManager MBeans, you must modify the DocumentConnectionPool MBean by using the WebLogic Server Administration Console. See the procedure in Using the WebLogic Server Administration Console to Modify DocumentManager MBeans for instructions. Note that, for the DocumentConnectionPool MBeans, you need to select the Document Connection Pool Service node and make the changes on the Document Connection Pool Service screen, shown in Figure 8-9.
Figure 8-9 Document Connection Service Pool Screen
The attributes of the DocumentConnectionPool MBean that you can change are listed in Table 8-3.
Table 8-4 Describes the valid reference implementation properties you can set for the DocumentConnectionPool MBean.
You can edit a DocumentConnectionPool MBean to change attribute and property values as needed by using the WebLogic Server Administration Console, as shown in Figure 8-9. Configuring the Web Application You need to configure the Web application to have access to the J2EE resources (such as EJBs, servlets, and JSP tag libraries) required to access the content management services. This means you will need to configure EJB references to ejb/ContentManager and ejb/DocumentManager. Additionally, you need to have the com.bea.p13n.content.servlets.ShowDocServlet mapped into your Web Application. BEA suggests that you to map it to the /ShowDoc/* URL in your Web Application, as shown in Listing 8-3. Listing 8-3 Mapping the ShowDocServlet This will allow the ShowDoc/ URI under your Web Application's context root (for example, /wlcs/ShowDoc) to be sent to the ShowDocServlet. The contentHome <init-param> will cause that ShowDocServlet to always use the ejb/DocumentManager EJB reference; you can take this out to allow ShowDocServlet to obey any contentHome request parameters. To access the Content Management tag libraries, you will need to:
<servlet>
<servlet-name>ShowDocServlet</servlet-name>
<servlet-class> com.bea.p13n.content.servlets.ShowDocServlet
</servlet-class> <!-- Make showdoc always use the local ejb-ref DocumentManager -->
<init-param>
<param-name>contentHome</param-name>
<param-value>java:comp/env/ejb/DocumentManager</param-value>
</init-param></servlet>
...
<servlet-mapping>
<servlet-name>ShowDocServlet</servlet-name>
<url-pattern>/ShowDoc/*</url-pattern>
</servlet-mapping>
Using Content-Selector Tags and Associated JSP Tags
A content selector is one of several mechanisms that WebLogic Portal provides for retrieving documents from a content management system. You can use content selector JSP tags and a set of other JSP tags to retrieve and display the content targeted by the content selector.
This section describes how to use content-selector tags and their associated JSP tags to manage content. It includes information on the following topics:
For information on how WebLogic Portal's content-related JSP tags map to WebLogic Portal's content management service provider interface (SPI), see the "Personalization JSP Tags" section of the JavaServer Page Guide at http://download.oracle.com/docs/cd/E13218_01/wlp/docs70/jsp/p13njsp.htm
.Using the <pz:contentSelector> Tag
The <pz:contentSelector> selector tag allows you to do the following:
Identify the Content Selector Definition
The content selector definition created in the E-Business Control Center determines the conditions that activate a content selector and the query that the active content selector runs.
To refer to this definition, use the rule attribute:
<pz:contentSelector rule= { definition-name | scriptlet } >
You can use a scriptlet to determine the value of the rule attribute based on additional criteria. For example, you use a content selector in a heading JSP (heading.inc), which is included in other JSPs. You can create different content selectors for each page that includes heading.inc.
A scriptlet is used in heading.inc to provide a value based on the page that currently displays the included JSP file. Listing 8-4 shows an example.
Listing 8-4 Using a Scriptlet in heading.inc
String banner = (String)pageContext.getAttribute("bannerPh");
banner = (banner == null) ? "cs_top_generic" : banner;
%>
<!-- ------------------------------------------------------------- -->
<table width="100%" border="0" cellspacing="0" cellpadding="0"
height="108">
<tr><td rowspan="2" width="147" height="108">
<pz:contentSelector rule="<%= banner %>" ... />
</td>
Identify the JNDI Home for the Content Management System
The content selector tag must use the contentHome attribute to specify the JNDI home of the content management system. If you use the reference content management system or a third-party integration, you can use a scriptlet to refer to the default content home. Because the scriptlet uses the ContentHelper class, you must first use the following tag to import the class into the JSP:
<%@ page import="com.bea.p13n.content.ContentHelper"%>
Then, when you use the content selector tag, specify the contentHome as described in Listing 8-5.
Listing 8-5 Specifying contentHome in a Content-Selector Tag
<pz:contentSelector
contentHome="<%=ContentHelper.DEF_DOCUMENT_MANAGER_HOME %>"
... />
If you create your own content management system, you must specify the JNDI home for your system instead of using the ContentHelper scriptlet. In addition, if your content management system provides a JNDI home, you can specify that one instead of using the ContentHelper scriptlet.
Define the Array That Contains Query Results
You can use the attributes described in Table 8-5 to configure the array that contains the results of the content-selector query.
Create and Configure the Cache to Improve Performance To extend accessibility of retrieved content and to improve performance, you can optionally use content selector attributes to create and configure a cache that contains the array contents. Without the cache, you can access the content selector array only from the current JSP page, and only for the customer request that created it. In addition, each time a customer requests a JSP that contains the content selector tag, the content selector must run the query, potentially slowing the overall performance of WebLogic Portal. To cache the contents of the array, use the attributes listed in Table 8-6.
Associated Tags That Support Content Selectors The JSP tags listed in Table 8-7 support content selector functions.
Using Content Selector Tags and Associated Tags The combination of content selector definitions, tag attributes, and associated JSP tags creates a powerful set of tools for matching documents to customers in specific contexts. The following tasks are the most common uses of content selectors and associated tags:
For information on how WebLogic Portal's content-related JSP tags map to WebLogic Portal's content management service provider interface (SPI), see the "Personalization JSP Tags" section of the JavaServer Page Guide at http://download.oracle.com/docs/cd/E13218_01/wlp/docs70/jsp/p13njsp.htm
.Retrieving and Displaying Text-Type Documents
To retrieve and display text-type documents, use this procedure:
Note: This procedure assumes that the content selector query created in the E-Business Control Center includes a filter to retrieve only text documents.
Listing 8-6 Code to Import Classes and Tag Libraries
<%@ page import="com.bea.p13n.content.ContentHelper"%>
<%@ taglib uri="es.tld" prefix="es" %>
<%@ taglib uri="pz.tld" prefix="pz" %>
<%@ taglib uri="um.tld" prefix="um" %>
Listing 8-7 Content Selector Tag Example 1
<pz:contentSelector rule="SpringSailing"
contentHome="<%=ContentHelper.DEF_DOCUMENT_MANAGER_HOME %>"
id="textDocs"/>
<es:forEachInArray array="<%=textDocs%>" id="aTextDoc" type="com.bea.p13n.content.Content">
<p><cm:printDoc id="aTextDoc"/></p>
</es:forEachInArray>
Note: To verify the content type before you display it, you can surround the <% "<P>" + aTextDoc + "</P>" %> scriptlet with another scriptlet. Listing 8-8 shows an example:
Listing 8-8 Verifying the Content Type
<% if (aTextDoc.getMimeType().contains("text") != -1)
{
%>
<p><cm:printDoc id="aTextDoc"/></p>
<%
}
%>
Retrieving and Displaying Image-Type Documents
To retrieve and display image-type documents, use this procedure:
Listing 8-9 Code to Import Classes and Tag Libraries if They are not Already in the JSP
<%@ page import="com.bea.p13n.content.ContentHelper"%>
<%@ taglib uri="pz.tld" prefix="pz" %>
<%@ taglib uri="um.tld" prefix="um" %>
<%@ taglib uri="cm.tld" prefix="cm" %>
Listing 8-10 Content Selector Tag Example 2
<pz:contentSelector rule="SpringSailing"
contentHome="<%=ContentHelper.DEF_DOCUMENT_MANAGER_HOME %>"
id="ImageDocs"/>
<es:forEachInArray array="<%=ImageDocs%>" id="anImageDoc" type="com.bea.p13n.content.Content">
<img src="ShowDoc/<cm:printProperty
id="anImageDoc" name="identifier" encode="url"/>"
</es:forEachInArray>
Note: The above tags assume that the content selector query that was created in E-Business Control Center includes a filter to retrieve only image documents. To verify the content type before you display it, you can surround the <img> tag with a scriptlet. Listing 8-11 shows an example:
Listing 8-11 Surrounding an <img> Tag with a Scriptlet
<% if (anImageDoc .getMimeType().contains("image"))
{
%>
<img src="ShowDoc/<cm:printProperty
id="anImageDoc" name="identifier" encode="url"/>">
}
%>
Retrieving and Displaying a List of Documents
To retrieve and display a list of documents, use this procedure:
Listing 8-12 Code to Import Classes and Tag Libraries if They are not Already in the JSP
<%@ page import="com.bea.p13n.content.ContentHelper"%> <%@ taglib uri="es.tld" prefix="es" %>
<%@ taglib uri="pz.tld" prefix="pz" %>
<%@ taglib uri="um.tld" prefix="um" %>
Listing 8-13 Content Selector Tags Example 3
<pz:contentSelector rule="SpringSailing"
contentHome="<%=ContentHelper.DEF_DOCUMENT_MANAGER_HOME %>"
id="docs"/>
<ul>
<es:forEachInArray array="<%=docs%>" id="aDoc"
type="com.bea.p13n.content.Content">
<li>The document title is: <cm:printProperty id="aDoc"
name="Title" encode="html" />
</es:forEachInArray>
</ul>
To access a content selector cache on a Different JSP, use this procedure:
Listing 8-14 Content Selector Tag Attributes
<pz:contentSelector rule="SpringSailing"
contentHome="<%=ContentHelper.DEF_DOCUMENT_MANAGER_HOME %>"
id="docs"
useCache="true" cacheId="SpringSailingDocs" cacheTimeout="120000"
cacheScope="application" />
These attributes create a cache that WebLogic Portal maintains for 2 minutes (120000 milliseconds) and that can be accessed using the name SpringSailingDocs by any user from any page in the Web application. For more information about possible values for cacheScope, see Create and Configure the Cache to Improve Performance.
Listing 8-15 Adding an Identical Tag
<pz:contentSelector rule="SpringSailing"
contentHome="<%=ContentHelper.DEF_DOCUMENT_MANAGER_HOME %>"
id="docs"
useCache="true" cacheId="SpringSailingDocs" cacheTimeout="120000"
cacheScope="application" />
Integrating External Content Management Systems
For customers who have larger amounts of content and want more control over the publishing and tagging of content, BEA partners with third-party vendors to add flexibility to WebLogic Portal. Third-party content management systems provide robust, content-creation management solutions while the Content Manager personalizes and serves the content to the end user.
Integration Strategies
BEA recommends three strategies for integrating a third-party content management system with the WebLogic Portal:
Adding Content by Implementing a DocumentProvider Interface
The DocumentProvider object is the entry point into an SPI implementation. It consists of methods that access the underlying content management system. When developing a DocumentProvider, you do not need to be concerned about transactional state or thread safety. Since a DocumentProvider does not need to perform write actions, a transaction is not required to access a DocumentProvider.
Implementing a DocumentProvider interface involves writing implementations of Java interfaces contained in the com.beasys.p13n.content.document.spi package. These interfaces are:
The following sections describe how these interfaces are implemented to integrate a CMS with WebLogic Portal.
For more information on these interfaces, see the Javadoc
for com.beasys.p13n.content.document.spi.The following steps present a high-level description of how to implement a DocumentProvider interface.
Step 1. Ensure that the CMS Meets the Minimum Use Requirements
To successfully integrate a Content Management System into WebLogic Portal, the CMS must support the capabilities listed in Table 8-8.
If all of these requirements cannot be met in some fashion, it will not be possible to fully integrate the CMS with WebLogic Portal. Additionally, since WebLogic Portal does not provide document creation and editing functionality, the CMS must have some way for users to create and edit documents. Step 2. Write the SPI Implementation Next, you need to code the SPI by implementing the interfaces described in Table 8-9 and the additional default and helper classes listed in DefaultDocumentProvider. These interfaces provide two-way communication between your Web application and the CMS by taking BEA objects and converting them to objects recognizable by the CMS.
For information on how WebLogic Portal's content-related JSP tags map to the WebLogic Portal SPI, see the "Personalization JSP Tags" section of the JavaServer Page Guide at http://download.oracle.com/docs/cd/E13218_01/wlp/docs70/jsp/p13njsp.htm
Additional DocumentProvider Classes to Implement
In addition to the interfaces listed in Table 3-1, you can use some of the abstract classes in the com.bea.p13n.content.document.ref package as base classes to implement some SPI functionality. These classes include:
Other classes that can help in developing a DocumentProvider implementation include:
Note: Consult the WebLogic Portal Javadoc
for further details about each class.Implementing Search and Schema Methods
In general, integating a third-party CMS requires that you implement both search methods and schema methods.
Search methods return metadata about a document; that is, the data that determines the appearance of the data returned. You will need to determine how the search criteria passed into the search object corresponds to the search methods allowed by the CMS and then define this mapping in order for the search to work.
Schema methods return the "bytes"; that is, something that represents the data to be consumed by the Web application. Assuming that the necessary data exists in the polled CMS, these methods will return:
Step 3. Place Code Into the Application
Once the SPI implementation is written, WebLogic Portal needs to be configured to use it. To do this, you can either:
OR
Modify the Existing DocumentConnectionPool
The first method is to simply modify an existing DocumentConnectionPool in the application's META-INF/application-config.xml. The DocumentManager implementation uses connection pools to a specialized JDBC driver to handle searches. A deployed DocumentManager finds the document connection pool to use via either the DocumentConnectionPoolName attribute of its DocumentManager MBean or the DocumentConnectionPoolName EJB deployment descriptor setting.
Configure a New DocumentConnectionPool and DocumentManager
The second way to configure WebLogic Portal is to set up a new DocumentConnectionPool in the application's META-INF/application-config.xml file and to deploy a new DocumentManager EJB in the application.
First, create a new connection pool by following the procedure outlined in the Using the WebLogic Server Administration Console to Modify DocumentManager MBeans Be sure to give the DocumentConnectionPool a unique name in the application (for example, "myConnectionPool").
Next, put together the new EJB by using the following procedure:
Listing 8-16 Creating a New <session>
<!-- The Newsletter DocumentManager -->
<session>
<ejb-name>NewsletterDocumentManager</ejb-name>
<home>com.bea.p13n.content.document.DocumentManagerHome</home>
<remote>com.bea.p13n.content.document.DocumentManager</remote>
<ejb-class>com.bea.p13n.content.document.internal.
SPIFastDocumentManagerImpl</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<!--
This controls which DocumentManager MBean this instance
will look for in the application-config.xml.
-->
<env-entry>
<env-entry-name>DocumentManagerMBeanName</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>newsletter</env-entry-value>
</env-entry>
</session>
Listing 8-17 Adding <assembly-descriptor> and <container-transaction> Entries
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>NewsletterDocumentManager</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
.
.
.
</assembly-descriptor>
Listing 8-18 Creating a New <weblogic-enterprise-bean> Entry
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>NewsletterDocumentManager</ejb-name>
<entity-descriptor>
<persistence>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS
</type-identifier>
<type-version>7.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml
</type-storage>
</persistence-type>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS
</type-identifier>
<type-version>6.0</type-version>
</persistence-use>
</persistence>
</entity-descriptor>
<jndi-name>${APPNAME}.BEA_portal_examples.
NewsletterDocumentManage</jndi-name>
</weblogic-enterprise-bean>
<jndi-name>${APPNAME}.BEA_portal_examples.
NewsletterDocumentManager</jndi-name>
Step 4. Make the .jar Accessible to the Application
Next, you need to make the .jar file you created accessible to the application accessing the CMS. You can do this by using one of these methods:
Step 5. Restart the Server
Because, by this point, you have made a number of configuration changes and changes to classpaths, we recommend that you restart the server.
Step 6. Apply the Portal
Finally, to complete the integration, you need to create the portal into which the CMS data will appear. For instructions on creating a portal or portlet, please refer to Step 3: Add a Portlet.
Publishing to Reference Implementation
This strategy involves directly publishing to the WebLogic Portal reference implementation database tables and XML schema files.
To implement this strategy:
Constructing Content Queries
This section, which provides guidelines for constructing queries to a content management system, includes information on the following topics.
Structuring Queries
WebLogic Portal queries are similar in syntax to the SQL string syntax that supports basic Boolean-type comparison expressions, including nested parenthetical queries. In general, the query includes a metadata property name, a comparison operator, and a literal value. For example:
attribute_name comparison_operator literal_value
Note: For more information about the query syntax, see the Javadoc
API documentation for com.bea.p13n.content.expression.ExpressionHelper.The following constraints apply to queries constructed using this syntax:
Note: The reference implementation document management system ignores property scopes.
Notes: The query syntax can contain only ASCII and extended ASCII characters (0-255).
Use ExpressionHelper.toStringLiteral to convert an arbitrary string to a fully quoted and escaped string literal which can be put in a query.
The following examples illustrate full expressions:
Example 1:
((color=`red' && size <=1024) || (keywords contains `red' && creationDate < now))
Example 2:
creationDate > toDate (`MM/dd/yyyy HH:mm:ss', `2/22/2000 14:51:00') && expireDate <= now && mimetype like `text/*'
Using Comparison Operators to Construct Queries
To support advanced searching, the system allows construction of nested Boolean queries incorporating comparison operators. Table 8-10 summarizes the comparison operators available for each metadata type.
Notes: The search parameters and expression objects support negation of expressions using a bit flag (!).
The reference implementation content management system has only single-value Text and Number properties. All implicit properties are single-value Text.
Constructing Queries Using Java
To construct queries using Java syntax instead of using the query language supplied with the Content Management component, see the Javadoc
API documentation for com.bea.p13n.content.expression.ExpressionHelper.The ContentManager session bean is the primary interface to the functionality of the Content Management component. Using a ContentManager instance, content is returned based on a com.bea.p13n.content.expression.Search object with an embedded com.bea.p13n.expression.Expression, which represents the expression tree.
In the expression tree, the following caveats apply for it to be valid for the ContentManager:
com.bea.p13n.expression.operator.logical.LogicalAnd, com.bea.p13n.expression.operator.logical.LogicalOr, com.bea.p13n.expression.operator.logical.LogicalMulitAnd, or com.bea.p13n.expression.operator.logical.LogicalMultiOr.
com.bea.p13n.expression.operator.comparative.Equals, com.bea.p13n.expression.operator.comparative.GreaterOrEquals, com.bea.p13n.expression.operator.comparative.GreaterThan, com.bea.p13n.expression.operator.comparative.LessOrEquals, com.bea.p13n.expression.operator.comparative.LessThan, com.bea.p13n.expression.operator.comparative.NotEquals, com.bea.p13n.expression.operator.string.StringLike, com.bea.p13n.expression.operator.collection.CollectionContains, or com.bea.p13n.expression.operator.collection.CollectionsContainsAll
Using the Document Servlet
The Content Management component includes a servlet capable of outputting the contents of a Document object. This servlet is useful when streaming the contents of an image that resides in a content management system or to stream a document's contents that are stored in a content management system when an HTML link is selected. Table 8-11 shows the Request/URL parameters that the servlet supports.
The servlet supports only Documents, not other subclasses of Content. It sets the Content-Type to the Document's mimeType and, the Content-Length to the Document's size, and correctly sets the Content-Disposition, which should present the correct filename when the file is saved from a browser. Example 1: Usage in a JSP This example searches for news items that are to be shown in the evening, and displays them in a bulleted list. Example 2: Usage in a JSP This example searches for image files that match keywords that contain bird and displays the image in a bulleted list.
<cm:select sortBy="creationDate ASC, title ASC"
query=" type = `News' && timeOfDay = `Evening' && mimeType like `text/*' "id="newsList"/>
<ul>
<es:forEachInArray array="<%=newsList%>" id="newsItem" type="com.bea.p13n.content.Content">
<li><a href="ShowDoc/<cm:printProperty id="newsItem"
name="identifier" encode="url"/>"><cm:printProperty
id="newsItem" name="title" encode="html"/></a> </es:forEachInArray>
</ul>
<cm:select max="5" sortBy="name" id="list"
query=" KeyWords like `*birds*' && mimeType like `image/*' "
contentHome="java:comp/env/ejb/MyDocumentManager"/>
<ul>
<es:forEachInArray array="<%=list%>" id="img" type="com.bea.p13n.content.Content">
<li><img src="/ShowDoc/<cm:printProperty id="img"
name="identifier"
encode="url"/>?contentHome=<es:convertSpecialChars
string="java:comp/env/ejb/MyDocumentManager"/>"><es:forEachInArray>
</ul>
![]() |
![]() |
![]() |
![]() |
||
![]() |
![]() |
![]() |
![]() |
![]() |
|
![]() |