Case Study: Activiti & JSF

Reference: <Activiti in Action>

1. Process

<startEvent id="startEvent" name="Start"
activiti:formKey="taskForm_newOrder.jsf" />

Note that activiti:formKey is an activiti extension attribute to BPMN 2.0.


2. Start Link in JSF Page

<h:column>
    <f:facet name="header">Action</f:facet>
    //How does formKey turn into a complete URL? Inspect the StartFormData. FormService applied to get URL.
    <h:outputLink value="#{formService.getStartFormData(v_process.id).formKey}">
        Start
        <f:param name="processDefinitionKey" value="#{v_process.key}" />
    </h:outputLink>
</h:column>
3. Page Look

Case Study: Activiti & JSF_第1张图片

4. taskForm_newOrder.xhtml

<h:form>
<table>
  <tr>
    <td>ISBN:</td>
    <td><h:inputText value="#{bookOrder.isbn}" /></td>
  </tr>
  <tr>
    <td></td>
    <td>
      <h:commandButton value="Submit" action="#{businessProcess.startProcessByKey(processDefinitionKey)}" />
    </td>
  </tr>
</table>
</h:form>
Note the direct businessProcess.startProcessByKey(processDefinitionKey). We could do the similar thing in Struts 2 Action.

Q: How to persist the isbn field in this case? In struts 2, we may collect the form data in action via field/model, and submit it by activiti's FormService.


Quoted from <Activiti in Action>: It's not hard to implement your own form rendering logic. You can utilize your UI technology of choice and Activiti can help with the form key attribute to do basic page navigation for the user forms.

你可能感兴趣的:(Case Study: Activiti & JSF)