Simple collaboration in Assemble Flow
Assemble Flow provides a new activity "webUI" for collaborating multiple persons in a common pattern.
WebUI activity
The activity works as a unit of human-system interaction in flow. It covers one common interaction pattern that system notify the assignee, then he can GET the resource from link in notification message, POST comments at last.
From perspective of flow, if any webUI activity executed, flow instance will be suspended to waiting for external requests after sending notification. The webUI activity provides endpoint over URL in the following convention:
{flowURI}/{flowID}/{activityName}
Attribute
title and
assignTo are used for notification, input variable could be rendered in web page by Groovy template which specified by attribute
view. Currently, only 1 input is allowed and posted data will be output variable of the activity.
Only GET and POST method is allowed on this URL. The assignee could GET web page many times and state of flow instance will not change, once he or she
POST data back to the URL, webUI activity will be completed and flow continues to run.
<webUI name="NCName" title="notification-message-title"? assignTo="email-address"? view="view-uri"? >
control*
input?
</webUI>
| Attribute |
| name | activity name (required) |
| title | notification message title (optional) |
| assignTo | assignee id (optional, usually an email address) |
| view | view URI for rendering activity data and user input (optional) |
Notification
Default notification is email. Attribute
title and
assignTo will be email subject and recipient. There's only a link in the message body. As same as
sendMail activity, a Groovy template is used for rendering hypertext content, who locates at
/app/views/notification/webUIEmail.gt
In the future, webUI activity could be integrated with Lotus Connections and todo node can be used as notification. In this kind of scenario, Todo node will be created when webUI activity executes, and people could open flow provided web page by click the todo node in his or her todo list. Once the webUI activity is completed, the todo node will be set "complete" by flow instance.
In order to implement such integration like that, flow designer just specifies a created activity node of Lotus Connections as one input of webUI activity named
activity in flow context.
NOTICE: Notification is not mandatory. When attribute
assignTo and
title are not specified, webUI activity will partially work like a reply activity and provided web page will be response content.
Activity View & Data
A view works for rendering input variable like view of
replyGET or
replyPOST activity.
<!-- view for webUI: /app/views/orderDemo/approveOrder.gt -->
<%def order = request.json.output[] // extract input variable %>
<form name="approveOrder" action="./" method="POST">
<!-- form display -->
<table>
<tr><th>Property</th><th>Value</th></tr>
<tr>
<td>published</td>
<td>${order.published}</td>
</tr>
<tr>
<td>comments</td>
<td>${order.comments}</td>
</tr>
</table>
<!-- form submit -->
<table>
<tr>
<td><label>approve</label><input name='approve' type='radio' value="yes"/></td>
<td><label>reject</label><input name='approve' type='radio' value="no"/></td>
</tr>
<tr>
<td>comments</td>
<td><input name='comments' type='text'/></td>
</tr>
</table>
<input type="submit" value="submit"><input type="reset" value="reset"/>
</form>
Input data can be accessed in JSON format without any view if you use a parameter named
data appending to the endpoint URL:
{flowURI}/{flowID}/{activityName}?data
NOTICE: conventional view without specify
view attribute explicitly in flow file is also supported. When GET request happens on endpoint provided by webUI activity, flow engine tries to find Groovy template file over following convention if no
view attribute value:
/app/views/{flowURI}/{activityName}.gt
If there's no such template, returns error message with status code 404.
Error Handling
- Accessing webUI endpoint but got status code 404: There's no input variable in webUI activity, or no view for rendering. (flow instance is also available)
- Accessing webUI endpoint but got statue code 405: Only GET and POST are allowed. (flow instance is also available)
- Accessing webUI endpoint but got statue code 500 with exception page:
- fail to send notification.
- exception in rendering input variable into web page.
- internal flow errors.
WebUI in tooling
Using flow tooling to create WebUI.
- Drag WebUI activity to the canvas
- Click "Create UI" to create UI for this WebUI activity
- Select Incoming/Outgoing data to edit it.
- Click "Save" to save the WebUI editing.
-- zhuke/liwenb - 22 Feb 2008