Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/jbpm/workflow/delegation/HtmlFormatter.java


1   package org.jbpm.workflow.delegation;
2   
3   import java.text.ParseException;
4   import javax.servlet.http.*;
5   
6   /**
7    * is an interface used for the automatic generation of activity-forms in the web-interface.
8    * <b>IMPORTANT NOTE</b> : In the web-interface, the class-name is used as a key for finding 
9    * the internationalized name of this HtmlFormatter.
10   * It is used when a ParseException is thrown in {@link #parseHttpParameter} to inform
11   * the user what kind of data whas excpected.  The error-msg is constructed like
12   * this : "Wrong input for field [field-name].  [received-value] could not be
13   * parsed as [translated text for html-formatter]"
14   * @author Tom Baeyens
15   */
16  public interface HtmlFormatter extends Configurable, java.io.Serializable {
17    
18    /**
19     * generates a HTML-fragment that is used to produce the automatically generated 
20     * web-form that allows a user to perform an activity.
21     * @param value is the current {@link org.jbpm.workflow.execution.AttributeInstance} 
22     *   value for the attribute for which html has to be generated.
23     * @param parameterName is the name of the http-parameter on which the jBpm 
24     *   web-application will expect input for this attribute.  If input is 
25     *   present for that parameter-name, it is parsed using the parseHttpParameter-method
26     */
27    String objectToHtml( Object value, String parameterName, HttpServletRequest request );
28    
29    /**
30     * parses the text that is returned by the web-client to an java-object before it is 
31     * stored in an {@link org.jbpm.workflow.execution.AttributeInstance}.
32     * @param text is the String that is passed from the web-client to the server
33     *   for html-input-control that was generated with the objectToHtml-method.
34     * @return the parsed java-object that will be stored in an 
35     *   {@link org.jbpm.workflow.execution.AttributeInstance}. 
36     * @throws ParseException if the text is not what this HtmlFormatter expects.  A 
37     *   ParseException will cause the web-application to go back to the form with an 
38     *   error message as explained above. 
39     */
40    Object parseHttpParameter( String text, HttpServletRequest request ) throws ParseException;
41  }