Monthly Archives: December 2008

DCTM 6.5: Add a new custom node to browser tree

To add a new custom node to the browser tree component in Webtop 6.5, we’ll need to create a new custom component. We’ll need to provide a Java class, extending the com.documentum.web.formext.component.Component class.

Also, Webtop 6.5 parses the JSP file, looking for tags. A JSP file needs to be provided. This JSP is pointed in the new component XML file. The JSP needs to make use of tags.
We’ll can use the tag to include a HTML file. By separately including a HTML file, we’re able to let the web designer work independently and not having to know the nitty gritty of the tags.

In Webtop 6.5, there are two browser tree components XMLs: browsertree_component.xml (same as in 5.3 and 6.0) and browsertreeex_component.xml. We’ve to extend the browsertreeex_component.xml instead of browsertree_component.xml.

Refer to here for the sample code listing.

Advertisements

DCTM 6.5: Sort Comments in Custom Email Template

Background
The comments provided by workflow users are displayed in reverse chronological order in the custom emails in Webtop 5.3 SP 5.

Problem
In Webtop 6.5, the comments are not displayed in the reverse chronological order. They were displayed with no particular ordering.

Workaround
Use Java scriptlets in the custom email templates (JSP) to sort the comments and display, instead of using the and tags.

Two additional custom Java classes are required: Comment.java (POJO) and TimeStampComparator.java.

The Comment.java class will contain the note.writer, note.text and note.creation_date. Each instance of the Comment.java class represents a comment by a workflow user. The TimeStampComparator.java class sorts a list of Comment classes by the note.creation_date attribute, in descending order. The sorting algorithm is determined by using the standard Java libraries, in this case, Collections.sort method.

These two additional classes are packaged into a JAR file and deployed into the JBoss method server on the content server (\Documentum\jboss4.2.0\server\DctmServer_MethodServer\deploy\lib\deploy\lib).

The bpmutil.jar file is required and is also deployed into the JBoss method server (\Documentum\jboss4.2.0\server\DctmServer_MethodServer\deploy\lib\deploy\lib). The ParamResolutionScheme.java class is used in the custom email templates (JSP) for obtaining the note.writer, note.text and note.creation_date.

The approach/logic coded into the JSP email template is as follow:

  1. For each email rendering, get the total number of comments
  2. For each comment, get its writer, text and creation_date, and store it to a Comment.java object. Add this object into a list.
  3. Sort the completed list.
  4. Iterate through the sorted list, and for each Comment instance in the list, display it out in the HTML and tags. Use the SimpleDateFormat class to format the creation_date according to the required format.

The sample source codes can be found here.


Useful Qeries: Count number of documents in a folder

The following DQL would count the number of documents in a folder and its subfolders.

select count(*) from dm_document(all) where folder(‘/CabinetName/FolderName’, descend)