Tags

, ,

Learn this Post to create a HumanTask in BPEL. Here we will create a process that uses a DbAdapter to a select in the database and the data returned will fill the fields that define the Worklist screen..

To create our HumanTask in BPEL created two parts to our Post, refer to the links below to check the other parts:

So you better understand some settings, here are some of them:

  • HumanTask – A HumanTask create tasks for users to interact with the business process. Each task or job has two parts: the task of metadata and the form of the task. The task form is used to display the contents of the list of work tasks assigned to a user or a group.
  • Worklist -A Worklist allows you to display items in a BPEL process assigned to the currently authenticated user. The items in the Worklist are BPEL tasks open from one or more BPEL Processes.

In order to create a HumanTask into a BPEL this BPEL process should be the asynchronous type (with rare exceptions), it is necessary to send a request and not stand still any response.

We will create an XSD with the fields that we will present in the Worklist screen..

We’ve talked too much, we will put into practice !!!

Our initial idea will create a BPEL process that will make a Select the database using DbAdapter component and the data returned fill our Worklist with these data.

As my idea is to show you in detail how to create the HumanTask skip some parts of how we create the DbAdapter.

See below I created a project called HumanTaskPELProcess and informed the Template that it should be of type Asynchronous BPEL Process

Imagem Blog UansCarvalho

Below are a few details that created a BPEL process by calling a DBAdapter

Imagem Blog UansCarvalho

Now see the open BPEL process, it have only one Assign to begin our varável and then make a Invoke for DbAdapter.

Imagem Blog UansCarvalho

Below see the XML result of this select:

Imagem Blog UansCarvalho

Now create an XSD called Payload.xsd with the content below the xsd folder of the project.

Note: This content will be the fields that want to show on the screen of my Worklist and they will be filled with the result of my Select as above.

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema elementFormDefault="qualified" 
 targetNamespace="uans.model.blog.com.br" 
 xmlns:xs="http://www.w3.org/2001/XMLSchema" 
 >
 <xs:element name="dadosEmpregado">
 <xs:complexType>
 <xs:sequence>
 <xs:element name="numeroEmpregado" type="xs:integer" minOccurs="0" maxOccurs="1"/> 
 <xs:element name="nome" type="xs:string" minOccurs="0" maxOccurs="1"/> 
 <xs:element name="profissao" type="xs:string" minOccurs="0" maxOccurs="1"/> 
 <xs:element name="numeroCoordenador" type="xs:string" minOccurs="0" maxOccurs="1"/> 
 <xs:element name="dataContratacao" type="xs:string" minOccurs="0" maxOccurs="1"/> 
 <xs:element name="salario" type="xs:integer" minOccurs="0" maxOccurs="1"/> 
 <xs:element name="numeroDepartamento" type="xs:integer" minOccurs="0" maxOccurs="1"/> 
 </xs:sequence>
 </xs:complexType>
 </xs:element> 
</xs:schema>

Imagem Blog UansCarvalho

Now go back to your BPEL process and will create a global variable that should be the content of your XSD.

Below click on the button (X)

Imagem Blog UansCarvalho

Will open the screen below, then click the button +

Imagem Blog UansCarvalho

In place Name dadosEmpregado and click Element, then within your Payload.xsd dadosEmpregado choice and click OK

Imagem Blog UansCarvalho

Then looks like this:

Imagem Blog UansCarvalho

Click OK again and now go back to your BPEL drag an Assign to stay below its Invoke_SelectEmployeeDbAdapter

Our idea is to play the result of our Select into our Global Varável we just created

Imagem Blog UansCarvalho

Rename Assign to our ResultadoSelect and double-click on it.

In the screenshot below you will open, connect the output of your Invoke with dadosEmpregado variable, see I’m calling each Select the back of the field with the fields we have in XSD

Imagem Blog UansCarvalho

Now open your BPEL process and drag a Human Task so that it is below our Assign ResultadoSelect

Imagem Blog UansCarvalho

Rename your HumanTask1 to simply HumanTask and double-click on it and will open the screen below:

Imagem Blog UansCarvalho

The right side up click on the button +

And on the screen that appears complete as follows:

  • Name: Humantask
  • Title: Human Task Bpel

Imagem Blog UansCarvalho

Click OK on the screen above:

Imagem Blog UansCarvalho

Click OK again on the screen above

Automatically opens the screen below:

Imagem Blog UansCarvalho

On the left side click Date and click the button again + and choose Add other parameter

Imagem Blog UansCarvalho

In the screenshot below and choose Element:

Imagem Blog UansCarvalho

Then click on the magnifying glass and choose the option that will be dadosEmpregado within your Payload.xsd as follows:

Imagem Blog UansCarvalho

Then click OK

Imagem Blog UansCarvalho

Click OK again and then looks like this:

Imagem Blog UansCarvalho

Now click on the left side in Assignment and double-click on Stage1.Participant1 (Here can be some other name)

Imagem Blog UansCarvalho

On the screen that will appear click the button + and click Add User

Imagem Blog UansCarvalho

Now in place was worth the name weblogic

Note: For you to understand, I am putting the weblogic User will be the user who will log in my Worklist, but this can be a User or User Group that can be logged, then it is business criteria !!!

Imagem Blog UansCarvalho

Click OK, return to your BPEL and double-click on your HumanTask

Imagem Blog UansCarvalho

Will open the screen below, then click the button this in BPEL Variable:

Imagem Blog UansCarvalho

Then select dadosEmpregado because now we know that varável Global already filled with the result of our Select.

Imagem Blog UansCarvalho

Click in OK

Imagem Blog UansCarvalho

Click OK again

Ready … Our BPEL process is now in place and now we just create our starting HumanTask our screen that is shown in our WorkList.

For this double click again on your HumanTask that is within your composite.xml

Imagem Blog UansCarvalho

In the screenshot below the upper left corner click Create Form and then in Auto-Generate Task Form…

Imagem Blog UansCarvalho

Below, give the name of HumanTaskBpelWEB to your project because it will automatically create a new separate project only with the web part that will be your Worklist.

Imagem Blog UansCarvalho

Below now we have two projects, the HumanTask BPEL will have our process to call your HumanTask and HumanTaskBpelWEB project that will have its taskDetails1.JSPX page which will contain the data from your Worklist screen.

Imagem Blog UansCarvalho

Okay, we have built our process to the call of our HumanTask in the next post I will explain step by step how you should deploy and how do we test our process.

Doubts ? Leave your comment :-)

Hugs and see you next

/:-D