Novell Home

JSP Docs for Provisioning Workflow Tool

Novell Cool Solutions: Feature

Digg This - Slashdot This

Posted: 24 May 2004
 

If you've taken a look at the Provisioning Workflow tool in Cool Tools, here's some documentation to help the developer in you better understand the JSP side of the equasion.

Table of Contents

1.0 Framework Overview
1.1 Framework
1.2 Objects associated with JSP Pages Within A PageFlow
2.0 PageFlow Java Activity Framework Classes
2.1 InitializeActivity
2.2 InitializeWFActivity
2.3 InitializeWFQueueActivity
2.4 ValidateActivity
2.4.1 Business Rule Processing
3.0 JSP JavaBeans Framework Classes
3.1 DataModel
3.2 WFDataModel
3.3 WFQueueDataModel
4.0 Error Handling
4.1 Messages Bean Class
4.2 DefaultHandler Class
1.0 Framework Overview

1.1 Framework

This exteNd 5.0 Director PageFlow framework mimics a STRUTS MVC framework. This framework is primarily used for PageFlows that use JSP pages to render its data. However, it is not limited to using JSP pages. It could just as easily be slightly modified to use Servlets or other activities available within the PageFlow Designer.

The PageFlow engine acts as the controller and the InitializeActivity and ValidateActivity perform similar tasks as the Form and Action classes found in a STRUTS framework. The InitializeActivity class is used to initialize the data model used by the JSP pages within the PageFlow. The ValidateActivity class is used for post processing of the JSP Pages and performs the business rules against the data supplied by the users.

1.2 Objects associated with JSP Pages Within A PageFlow

All PageFlows using this framework will have the following objects associated with every JSP page found in the page flow:

  1. A class that extends an InitializeActivity class or one of its extended classes (InitializeWFActivity, InitializeWFQueueActivity). This class is used to initialize the data model used by the JSP page and is required for this framework to work.


  2. A JSP page that adheres to the Portlet specifications. All JSP pages used will include the Common.jsp page that includes the required code to make the JSP page adhere to the Portlet standards. This Common.jsp page also includes the required code to include the Messages JavaBean that is used by every JSP page to handle errors, warnings and/or messages.


  3. This JSP page must have a model or java bean class associated with it. It can extend any of the following data model bean classes:


    • DataModel
    • WFDataModel
    • WFQueueDataModel

  4. A class that extends the ValidateActivity class. This class is optional and is used to validate the data supplied by the user. User can choose to perform their own business rules checking and/or use a schema document to validate the data supplied by the user. This is due to the fact that all JSP page data models are in fact DOM documents.

Example:


Click for larger view.
2.0 PageFlow Java Activity Framework Classes

2.1 InitializeActivity

Package: com.novell.bpm.javaActivities

The InitializeActivity class is used to initialize the data model for the individual JSP pages in a PageFlow. This class contains the methods to populate the model from a default document stored in the Content Management subsystem (See JavaDoc). User defined classes that extend this class must supply the following abstract classes and provide the following information to the framework:

  • public abstract String getDataModelAttributeName();

    This is the variable used to store the JSP data model. This has to be the same value as the one used in the JSP page. In this case the value will be "approverDisplay"

    Example:
    <jsp:useBean id="approverDisplay" class="com.novell.bpm.beans.ApproverDisplay" scope="session" />


  • public abstract String getDocumentPath();

    This is the path to use to fetch the default document to populate this model from the Content Management Subsystem.


  • public abstract String getLogName();

    This is the log name used to send the debug statement to. The framework uses the Director 5.0 logging feature. This allows an administrator to turn up or down the trace levels for individual logs within the portal.


  • public abstract void setDataModel(DataModel newValue);

    This method must supply the actual Java Bean class used for the data model used by the JSP page. This has to be the same one has defined in the JSP page. In this case the setDataModel must specify the ApproverDisplay class as its model Java Bean.

    Example:
    <jsp:useBean id="approverDisplay" class="com.novell.bpm.beans.ApproverDisplay" scope="session" />

2.2 InitializeWFActivity

Package: com.novell.bpm.javaActivities

The InitializeWFActivity class which extends the InitializeActivity class contains the code to automatically retrieve the work item associated with a selected queue item. Usually used for UI screens that need to add information to an existing queue work item and then forward it on to the next process. User defined classes that extend this class must supply the same abstract methods as the InitializeActivity class (see above).

2.3 InitializeWFQueueActivity

Package: com.novell.bpm.javaActivities

The InitializeWFQueueActivity class which extends the InitializeActivity class is used to automatically retrieve the queue items for a particular queue. User defined classes that extend this class must supply the same abstract methods as the InitializeActivity class (see above).

2.4 ValidateActivity

Package: com.novell.bpm.javaActivities

The ValidateActivity class is used to validate and session persist the data supplied by the user for each JSP page in a PageFlow. It is used to populate the Messages data model (used in every JSP page) with all errors found. If no errors are found then all post processing logic will be found in this class. User defined classes that extend this class must supply the following abstract methods and provide the following information:

    public abstract String getDataModelAttributeName();

    This is the variable used to store the JSP data model. This has to be the same value as the one used in the JSP page. In this case the value will be "approverDisplay"

    Example:
    <jsp:useBean id="approverDisplay" class="com.novell.bpm.beans.ApproverDisplay" scope="session" />

  • public abstract String getLogName();

    This is the log name used to send the debug statement to. The framework uses the Director 5.0 logging feature. This allows an administrator to turn up or down the trace levels for individual logs within the portal.
  • 2.4.1 Business Rule Processing

    User can choose to perform their own business rules checking and/or use a schema document to validate the data supplied by the user. This is due to the fact that all JSP page data models are in fact DOM documents. A data model validation can be performed by calling the validateDocument(String validatingSchemaDocumentURL) method (see JavaDoc).

    Example of retrieving the schema document from the Content Management System:

    validateDocument
    (http://localhost/ExpressPortal/ContentMgmtService/resources/Order/ProcurementRequest.xsd);

3.0 JSP JavaBeans Framework Classes

3.1 DataModel

Package: com.novell.bpm.beans

This class is the super class for all DataModel classes. It contains the required methods to manipulate the data model associated with a JSP page. Methods such as getDocument(), getDocumentString(), setDocument(). setFieldValue(), debug() and others (see JavaDoc). User defined classes that extend this class must provide the following abstract class:

  • public abstract String getLogName();

    This is the log name used to send the debug statement to. The framework uses the Director 5.0 logging feature. This allows an administrator to turn up or down the trace levels for individual logs within the portal.

3.2 WFDataModel

Package: com.novell.bpm.beans

This class extends the DataModel class and provides the required methods to fetch and manipulate a specific work item from the Workflow subsystem. Methods such as getWorkitem(), forwardWorkitem(), startWorkflow and others can be found in this class (See JavaDoc). User defined classes that extend this class must provide the following abstract classes and provide the following information:

  • public abstract String getWFProcessName();

    The work flow process name to use. For the Order Processing sample project this will be set to "OrderProcess".


  • public abstract String getWFDocumentName();

    The document name associated with the Work Flow work item. For the Order Processing sample project this is set to "OrderProcess".


  • public abstract String getWFOperationName();

    The work flow work item property name used by the Work Flow engine to forward the item to the appropriate activity in the workflow. In the case of the Order Processing project this is set to "Operation".


  • public abstract String getWFWorkitemParmName();

    The Request object parameter name used to pass the current work item being worked on between the JSP page and the Java classes (Bean or Java Activity).

3.3 WFQueueDataModel

Package: com.novell.bpm.beans

This class extends the DataModel class and provides the required methods to fetch queue items from the Workflow subsystem. Methods such as getQueue(), resetResults() and others can be found in this class(See JavaDoc).

User defined classes that extend this class must provide the following abstract classes and provide the following information:

  • public abstract String getResultsNodeName();

    The Node name used within the model DOM Document that holds the list of queue item found for a specific queue request.


  • public abstract String[] getWorkitemElements();

    A string array of elements names to attach to the queue result DOM Document. If set to null then no elements will be added.


  • public abstract String getWorkitemElementsTagName();

    The tag name where the element values can be retrieved, from the work item document associated with the queue items found.


  • public abstract String getWorkitemDocumentName();

    The document name associated with the Work Flow work item. For the Order Processing sample project this is set to "OrderProcess".
4.0 Error Handling

4.1 Messages Bean Class

Package: com.novell.bpm.beans

This class provides the data model to handle ERRORS, WARNING and/or just plain MESSAGES for all JSP pages. You must call the respective addError(message code), addWarning(warning, code) and/or addMessage(message, code) to populate this DOM data model document. The DOM Document has the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<Messages errors="true" messages="true" warnings="true">
   <Message>
      <code>-1</code>
      <text>Message number 1</text>
   </Message>
   <Message>
      <code>-1</code>
      <text>Message number 2</text>
   </Message>
   <Error>
      <code>-1</code>
      <text>Error number 1</text>
   </Error>
   <Error>
      <code>-1</code>
      <text>Error number 2</text>
   </Error>
   <Warning>
      <code>-1</code>
      <text>Warning number 1</text>
   </Warning>
   <Warning>
      <code>-1</code>
      <text>Warning number 2</text>
   </Warning>
</Messages>

You can call the isErrors(), isMessages() and/or isWarnings() methods to check if any of the three types of messages, errors and/or warnings exists.

You can display these various messages, errors and/or warnings by using the following example code in your JSP pages:

<tr><td colspan="2">Status</td></tr>
<tr><td>Code</td><td>Message</td></tr>
<x:forEach select="$msg/Messages/Message">
 <tr>
  <td><x:out select="Code"/></td>
  <td><x:out select="Text"/></td>
 </tr>
</x:forEach>
<x:forEach select="$msg/Messages/Warning">
 <tr>
  <td><x:out select="Code"/></td>
  <td><x:out select="Text"/></td>
 </tr>
</x:forEach>
<x:forEach select="$msg/Messages/Error">
 <tr>
  <td><x:out select="Code"/></td>
  <td><x:out select="Text"/></td>
 </tr>
</x:forEach>

4.2 DefaultHandler Class

Package: com.novell.bpm.javaActivities

The DefaultHandler class is used by the SAX parser to validate the DOM Document against a user supplied Schema Document. This class will capture all exceptions thrown by the SAX parser (fatal errors, errors and warnings) and send the corresponding message to the MESSAGES data model used by all JSP pages using this framework. This validation is performed within the Validation Activity class associated with the JSP page. A data model validation can be performed by calling the validateDocument(String validatingSchemaDocumentURL) method (see 2.4.1 Business Rule Processing).


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell