Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

...

...

...

...

...

...

...

Business processes cannot always proceed in a fully automated manner. They need human interaction as a means of decision making, error handling and exception cases. For example, canceling a flight due to a strike or bankruptcy, deciding whether to accept the claim based on the requested amount etc. Human tasks provide the specification to define tasks performed by human beings.

Sample scenario

When a user requests a claim to be approved by the system, the system automatically approves claims under an amount of 1000 .This is a simple BPEL process. If the claim exceeds 1000, it will be handed over to the regional clerk who checks the claim amount along with the user information, decides whether or not to approve it, and the final decision is sent to the user. So when the claim is higher than 1000, it will be processed as a human task. The sample process is shown below.

...

There is a predefined package structure which makes the work easier. As an initial step, you should create a package structure in your local directory.

Package structure of an HT artifact

Info

This topic explains how to write the human tasks yourself and describes the various configurations you can use. You can view a completed version of the human tasks configuration in the <BPS_home>/repository/samples/humantask directory and unzipping the .zip file. See here for information on how to set up and run this sample.

Package structure of an HT artifact

There are four components in the HT package.

...

ElementDescription
<htd:humanInteractions>
Contains declarations of elements from the WS- HumanTask namespace, that is <htd:logicalPeopleGroups>, <htd:tasks>  and  <htd:notifications>.
<htd:import>

This is used to import the appropriate WSDL files. You should correctly specify the name spaces.

Example:

Code Block
languagejava
<htd:importnamespaceimport namespace="http://reminder.sample.humantask.wso2.org" location="OrderProcessReminder.wsdl" importType="http://schemas.xmlsoap.org/wsdl/">
<htd:logicalPeopleGroups>

This is used to specify logical people groups used in an inline human task or a people activity. The name attribute contains the name of the logical people group. The name must be unique among the names of all logical people groups defined within the <htd:human Interactions> element. For example:

Code Block
languagejava
<htd:logicalPeopleGroups>

        <htd:logicalPeopleGroup name="regionalClerks">
            <htd:documentation xml:lang="en-US">
                The group of clerks responsible for the region specified.
            </htd:documentation>
            <htd:parameter name="role" type="xsd:string"/>
        </htd:logicalPeopleGroup>

        <htd:logicalPeopleGroup name="regionalManager">
            <htd:documentation xml:lang="en-US">
                The manager responsible for the region specified.
            </htd:documentation>
            <htd:parameter name="role" type="xsd:string"/>
        </htd:logicalPeopleGroup>

        <htd:logicalPeopleGroup name="clerksManager">
            <htd:documentation xml:lang="en-US">
                The manager of the clerk whose user ID is passed as parameter.
            </htd:documentation>
            <htd:parameter name="role" type="xsd:string"/>
        </htd:logicalPeopleGroup>

        <htd:logicalPeopleGroup name="directorClaims">
            <htd:documentation xml:lang="en-US">
                The functional director responsible for claims processing.
            </htd:documentation>
        </htd:logicalPeopleGroup>

</htd:logicalPeopleGroups>
 
<htd:logicalPeopleGroups>
       <htd:logicalPeopleGroup name="regionalClerks">
           <htd:documentation xml:lang="en-US">
               The group of clerks responsible for the region specified.
           </htd:documentation>
           <htd:parameter name="role" type="xsd:string"/>
       </htd:logicalPeopleGroup>


	   <htd:logicalPeopleGroup>
    	.....
	   </htd:logicalPeopleGroup>
</htd:logicalPeopleGroups>
<htd:tasks>

Specifies the human tasks used in the business process.

Code Block
languagejava
<htd:tasks>
        <htd:task1>
        <htd:task2>
        <htd:task3>
<htd:tasks>
<htd:task>

This is used to provide the definition of an inline human task. The name attribute specifies the name of the task. The name must be unique among the names of all tasks defined within the <htd:tasks> element.

It also consists of the <htd:interface>, <htd:peopleAssignments> and <htd:presentationElements> elements which are used to described the task.

Code Block
languagejava
<htd:task name="OrderProcess">  
	<htd:interface />
	<htd:peopleAssignments />
	<htd:presentationElements />
</htd:task>
<htd:interface>

Specifies the port types and operations of the human task.     

Code Block
languagejava
<htd:interface 
 portType="cl:ClaimsHandlingPT"  
  operation="approve"   
 responsePortType="cl:ClaimsHandlingCallbackPT"   
  responseOperation="approvalResponse"/>  
<htd:peopleAssignments>

Used to assign people to process-related generic human roles.
 

Code Block
languagejava
<htd:peopleAssignments>
	<htd:potentialOwners>
		<htd:from logicalPeopleGroup="regionalClerks">
			<htd:argument name="role">
				regionalClerksRole
			</htd:argument>
		</htd:from>
	</htd:potentialOwners>
	<htd:businessAdministrators>
		<htd:from logicalPeopleGroup="regionalManager">
			<htd:argument name="role">
				regionalManagerRole
			</htd:argument>
		</htd:from>
	</htd:businessAdministrators>
</htd:peopleAssignments>
<htd:documentation>

Provides annotations for users.

Code Block
languagehtml/xml
<htd:documentation>   
	Example for WS-HumanTask 1.1 - WS-HumanTask Task Definition  
</htd:documentation> 

 

<htd:from>
<htd:argument> 

From element used to assign people for roles which have been specified in the business process. Argument element will pass values used in the people query.

Code Block
languagejava
<htd:from logicalPeopleGroup="regionalClerks">
 	<htd:argument name="role">
		regionalClerksRole
	</htd:argument>
</htd:from>
<htd:presentationElements>

Specifies the user interface for human tasks or how the user interacts with the human task.

Code Block
languagejava
<htd:presentationElements>   
<htd:name xml:lang="en-US">Approve Claim
</htd:name>  
<htd:name xml:lang="de-DE">Genehmigungder Schadensforderung  
</htd:name>   
<htd:presentationParameters>   
<htd:presentationParametername="firstname"  
  type="xsd:string">   
 htd:getInput("ClaimApprovalRequest")/test10:cust/test10:firstname   
</htd:presentationParameter>   
</htd:presentationParameters>
<htd:notifications>

Used to provide the definition of an inline notification.The name attribute specifies the name of the notification. The name must be unique among the names of all notifications defined within the <htd:notifications> element.

Code Block
languagejava
<htd:notifications>   
  <htd:notificationname="ClaimApprovalReminder">  
  	<htd:documentationxml:lang="en-US">

...