Human Task Rendering
When a human task is available, a task client should display the task information and actions for the task assignees. For this, the task applications should know how to render the task information. WS-Humantask specification provides a container to provide rendering information to Task Client application. The following image from WS-Human Task specification depicts the structure of rendering elements.
Task rendering details are out of the scope of WS-Humantask and it's up to different implementations. So WSO2 input and output renderings have been introduced from WSO2 Business Process Server 3.5.0 onwards. Human Task explorer (https://localhost:9443/humantask-explorer/) web application has been shipped with BPS to work in human tasks with HT renderings.
Following is the syntax for WSO2 input-output renderings for Human Tasks.
<htd:renderings> <htd:rendering type="wso2:input" xmlns:wso2=”http://wso2.org/ht/schema/renderings/”> <wso2:input> <wso2:element id=”[id for the display element]”> <wso2:label>[Label to display for the input element]</wso2:label> <wso2:value>[xpath to get the value from the input message / presentationParameter]</wso2:value> </wso2:element>+ </wso2:input> </htd:rendering> <htd:rendering type="wso2:output" xmlns:wso2=”http://wso2.org/ht/schema/renderings/”> <wso2:output> <wso2:element id="[unique id for each element]"> <wso2:label>[Label to display for the form field]</wso2:label> <wso2:xpath>[xpath of the element in the output message to be filled with this form field]</wso2:xpath> <wso2:value type="[string | boolean | Int | double | list]">[comma separated values for list type]</wso2:value> <wso2:default>[default value for above mentioned value element]</wso2:default> </wso2:element>+ <wso2:output> </htd:rendering> </htd:renderings>
Each element of the syntax is explained below.
Element | Description |
---|---|
<renderings> | Within “renderings” element, rendering types are listed. |
<rendering> | Following attributes are required in a rendering element.
|
<wso2:input> | Used to render input information to the task instance in the user interface. Each information is represented by <wso2:element> which list input information that needs to display as label / value pairs. Format of rendering input element (<wso2:element>) as follows: <wso2:element id=”[Unique id for the display element]”> <wso2:label>[Label to display for the input element]</wso2:label> <wso2:value>[xpath to get the value from the input message / presentationParameter]</wso2:value> </wso2:element> Attributes id - Unique ID for each element Child elements <wso2:label> - Label (or text) to display with the value <wso2:value> - The value to display with the label. This value can be extracted from the input message (by providing xpath) or by presentation parameters. Example 01 : retrieving value by xpath <wso2:element id="custId"> <wso2:label>Customer Identifier</wso2:label> <wso2:value>/test10:ClaimApprovalData/test10:cust/test10:id</wso2:value> </wso2:element> Example 02 : Set value by presentation parameter defined in the presentationParameters in humantask definition <wso2:element id="fname"> <wso2:label>First Name</wso2:label> <wso2:value>$firstname$</wso2:value> </wso2:element> |
<wso2:output> | Used to render user workspace (to generate html form that need to filled by the task assignee) and to populate response message to the callback service when task instance get completed. Each form element is represented by <wso2:element>. Format of the output rendering element () as follows: <wso2:element id="[unique id for each element]"> <wso2:label>[Label to display for the form field]</wso2:label> <wso2:xpath>[xpath of the element in the output message to be filled with this form field]</wso2:xpath> <wso2:value type="[string | boolean | Int | double | list]">[comma separated values for list type and boolean type]</wso2:value> <wso2:default>[default value for above mentioned value element]</wso2:default>* </wso2:element> Attributes id - Unique ID for each form element Child elements
Example: <htd:rendering type="wso2:output"> <wso2:outputs> <wso2:element id="approve"> <wso2:label>Loan Status</wso2:label> <wso2:xpath>/test10:ClaimApprovalResponse/test10:approved</wso2:xpath> <wso2:value type="boolean">Approved, Not approved</wso2:value> <wso2:default>Disapproved</wso2:default> </wso2:element> <wso2:element id="loanTypeSelectList"> <wso2:label>Loan Type</wso2:label> <wso2:xpath>/test10:ClaimApprovalResponse/test10:loanType</wso2:xpath> <wso2:value type="list">car loan, house loan, development loan, education loan</wso2:value> <wso2:default>house loan</wso2:default> </wso2:element> <wso2:element id="loadDescription"> <wso2:label>Loan Description</wso2:label> <wso2:xpath>/test10:ClaimApprovalResponse/test10:description</wso2:xpath> <wso2:value type="string"></wso2:value> <wso2:default>car loan</wso2:default> </wso2:element> <wso2:element id="loanInterestAlteration"> <wso2:label>Loan Interest Alteration</wso2:label> <wso2:xpath>/test10:ClaimApprovalResponse/test10:interest</wso2:xpath> <wso2:value type="int"></wso2:value> <wso2:default>1000</wso2:default> </wso2:element> </wso2:outputs> </htd:rendering> |
When you use a Human task deployed with human task renderings, the Human task explorer application should be used to work with created tasks. The human tasks page in Management console will not work. Refer Claims Approval task with HT Renderings Sample for a complete sample.