AnsweredAssumed Answered

how to implement servicetask in activiti in servlet for web applications

Question asked by rakesh.world86 on May 22, 2015
Latest reply on May 25, 2015 by martin.grofcik
Hi,
I am trying to implement servicetask in xml in activiti in servlet in web applications.

xml is below:

in which a tag servicetask where activiti:class is written  , but i am unable to understand which class and path name i have to written .

as you see , i have written in activiti:class="testservlet.com.sample.ReverseStringsFieldInjected" but this is giving error in Red Underline.

because my servlet project name is testservlet, i am unable to understand …

Pls help me . I am stuck in this from two days.. , and pls give me any example to understand clearly…

<blockcode>
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://activiti.org/bpmn20" id="definitions">
  <process id="ApplyForLicense" name="Apply for license" isExecutable="true">
    <startEvent id="request" activiti:initiator="employeeName">
      <extensionElements>
        <activiti:formProperty id="licenseHolderName" name="licenseHolderName" type="string" required="true"></activiti:formProperty>
      </extensionElements>
    </startEvent>
    <sequenceFlow id="flow1" sourceRef="request" targetRef="handleRequest"></sequenceFlow>
    <userTask id="handleRequest" name="Handle license request" activiti:candidateGroups="${groupName}">
      <documentation>${licenseHolderName} has applied for license.</documentation>
      <extensionElements>
        <activiti:formProperty id="licenseApproved" name="Do you approve this license" type="string" required="true"></activiti:formProperty>
        <activiti:formProperty id="Comments" name="Comments" type="string"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow2" sourceRef="handleRequest" targetRef="requestApprovedDecision"></sequenceFlow>
    <exclusiveGateway id="requestApprovedDecision" name="Request approved?"></exclusiveGateway>
    <sequenceFlow id="flow3" sourceRef="requestApprovedDecision" targetRef="sendApprovalMail">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${licenseApproved == 'true'}]]></conditionExpression>
    </sequenceFlow>
   
    <serviceTask id="sendApprovalMail" name="Send confirmation e-mail"  activiti:class="testservlet.com.sample.ReverseStringsFieldInjected">
     <extensionElements>
       <activiti:field name="setname" stringValue="kaka" />
     </extensionElements>
   </serviceTask>
   
    <sequenceFlow id="flow4" sourceRef="sendApprovalMail" targetRef="theEnd1"></sequenceFlow>
    <endEvent id="theEnd1"></endEvent>
    <sequenceFlow id="flow5" sourceRef="requestApprovedDecision" targetRef="adjustLicenseRequestTask">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${licenseApproved == 'false'}]]></conditionExpression>
    </sequenceFlow>
    <userTask id="adjustLicenseRequestTask" name="Reject License Approval">
      <documentation>Your manager has disapproved your license request . Reason: ${Comments}</documentation>
    </userTask>
    <endEvent id="theEnd2"></endEvent>
    <sequenceFlow id="flow6" sourceRef="adjustLicenseRequestTask" targetRef="theEnd2"></sequenceFlow>
  </process>
</definitions>
</blockcode>

Outcomes