cancel
Showing results for 
Search instead for 
Did you mean: 

Task variables, Boundary timer event, task listener, Activiti-ldap

shiva_arunachal
Champ in-the-making
Champ in-the-making
I and have a few queries regarding Activiti.
I have listed them below.

1.   Task variable Vs process variable.
I get the variables related to a task in process variable and not in local task variables. Is there any problem in my usage or is this expected?
2.   Boundary timer event not getting triggered.
I have set processEngineConfiguration's jobExecutorActivate property to true which seems to be the most common reason for this. Any suggestion from your experience?
3.   Usage of task listener.
Can you suggest some use cases/best practice for using task listener?
4.   Instantiating a BP from an application and closing it from activiti-explorer
Does it have any side-effects. I had an instance where it was reflecting in Runtime tables that task are created but they did not reflect in activiti-explorer window even after reloads.
5.   Activiti-ldap
I have tried a web application secured by spring-security and Apache DS embedded  LDAP. Is it necessary or it can be replaced by LDAPConfigurator?

Any help is greatly appreciated.

regards
Shiva
5 REPLIES 5

jbarrez
Star Contributor
Star Contributor
1. Not sure I'm following here. I would need code to understand what you are doing.

2. Again, without config/code/xml it's hard to say why it's not working. If the job executor is running, timer will work.

3. Um … doing stuff when something with a task happens … Use cases is whatever you want… adding a variable, sending a message to a JMS queue,….

4. No. If they are using the same database tables, this works.

5. Is this your own web app or Explorer? Explorer can use the LdapConfiguration to hook into the Apache DS.

shiva_arunachal
Champ in-the-making
Champ in-the-making
Hi,
I made a boundary timer event for testing. It was not getting triggered properly.
<blockcode>
<boundaryEvent id="timerBoundaryEvent" name="Boundary timer" attachedToRef="usertask1"  cancelActivity="true">
      <timerEventDefinition>
        <timeDate>PT10S</timeDate>
      </timerEventDefinition>
    </boundaryEvent>
</blockcode>

I found the eclipse plugin/activiti-explorer edit model option is not working properly. don't know why. the attribute attachedToRef="usertask1"  was not getting created. i had to  manually add it in xml after seeing the error message.

The cancelActivity="true" is set. still the user task is not getting cancelled. please assist.

The entire xml is as below.

<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" xmlnsSmiley Surprisedmgdc="http://www.omg.org/spec/DD/20100524/DC" xmlnsSmiley Surprisedmgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/processdef">
  <process id="MyProcess_pend_task123" name="MyProcess_pend_task123" isExecutable="true">
    <startEvent id="startevent1" name="Start">
      <extensionElements>
        <activiti:formProperty id="count" name="count" type="long" variable="count" required="true"></activiti:formProperty>
      </extensionElements>
    </startEvent>
    <intermediateCatchEvent id="timerintermediatecatchevent1" name="TimerCatchEvent">
      <timerEventDefinition>
        <timeDuration>PT10S</timeDuration>
      </timerEventDefinition>
    </intermediateCatchEvent>
    <exclusiveGateway id="exclusivegateway1" name="Exclusive Gateway"></exclusiveGateway>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <sequenceFlow id="flow4" sourceRef="timerintermediatecatchevent1" targetRef="usertask1"></sequenceFlow>
    <userTask id="usertask1" name="User Task" activiti:assignee="kermit">
      <extensionElements>
        <activiti:formProperty id="count" name="count" type="long" expression="count" variable="count"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow3" sourceRef="exclusivegateway1" targetRef="timerintermediatecatchevent1">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${count<5}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="usertask1" targetRef="exclusivegateway1"></sequenceFlow>
    <sequenceFlow id="flow5" sourceRef="exclusivegateway1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow7" sourceRef="timerBoundaryEvent" targetRef="exclusivegateway1"></sequenceFlow>
    <boundaryEvent id="timerBoundaryEvent" name="Boundary timer" attachedToRef="usertask1"  cancelActivity="true">
      <timerEventDefinition>
        <timeDate>PT10S</timeDate>
      </timerEventDefinition>
    </boundaryEvent>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_MyProcess_pend_task123">
    <bpmndi:BPMNPlane bpmnElement="MyProcess_pend_task123" id="BPMNPlane_MyProcess_pend_task123">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="30.0" width="30.0" x="120.0" y="170.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="timerintermediatecatchevent1" id="BPMNShape_timerintermediatecatchevent1">
        <omgdc:Bounds height="31.0" width="31.0" x="285.0" y="90.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="exclusivegateway1" id="BPMNShape_exclusivegateway1">
        <omgdc:Bounds height="40.0" width="40.0" x="480.0" y="167.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="28.0" width="28.0" x="620.0" y="170.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="250.0" y="160.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="timerBoundaryEvent" id="BPMNShape_timerBoundaryEvent">
        <omgdc:Bounds height="31.0" width="31.0" x="287.0" y="195.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="499.51807228915663" y="167.48192771084337"></omgdi:waypoint>
        <omgdi:waypoint x="498.0" y="106.0"></omgdi:waypoint>
        <omgdi:waypoint x="315.99995032871175" y="105.539240380579"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="355.0" y="187.36708860759495"></omgdi:waypoint>
        <omgdi:waypoint x="480.050505050505" y="187.05050505050505"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="519.5620437956204" y="186.56204379562044"></omgdi:waypoint>
        <omgdi:waypoint x="620.0035072581308" y="184.31335431511647"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="300.877936383048" y="120.99539170496728"></omgdi:waypoint>
        <omgdi:waypoint x="301.8292682926829" y="160.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="149.998329528365" y="185.22385566460247"></omgdi:waypoint>
        <omgdi:waypoint x="250.0" y="186.71641791044777"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
        <omgdi:waypoint x="303.0" y="227.0"></omgdi:waypoint>
        <omgdi:waypoint x="303.0" y="316.0"></omgdi:waypoint>
        <omgdi:waypoint x="502.0" y="316.0"></omgdi:waypoint>
        <omgdi:waypoint x="502.0" y="205.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>
</blockcode>

shiva_arunachal
Champ in-the-making
Champ in-the-making
Regarding Activiti-ldap Query:
<blockcode>5. Is this your own web app or Explorer? Explorer can use the LdapConfiguration to hook into the Apache DS.</blockcode>
It is my own web-application how will i use Activiti-ldap for authentication.

shiva_arunachal
Champ in-the-making
Champ in-the-making
Regarding my Task variable Vs process variable. query:
<blockcode>1. Not sure I'm following here. I would need code to understand what you are doing.</blockcode>
<blockcode>
  List<Task> tasks = taskService.createTaskQuery().taskAssignee(userName)
    .includeTaskLocalVariables().includeProcessVariables().list();

  ClaimValidationRequest claim = new ClaimValidationRequest();
  for (Task task : tasks) {
   claim.setSubscriberName((String) task.getProcessVariables().get(
     "name"));
   claim.setAssigneeName((String) task.getProcessVariables().get(
     "assignee"));
   claim.setClaimNo((String) task.getProcessVariables().get(
     "issue"));
</blockcode>
i was thinking i will retrive the form related variables of a user task using <code>task.getTaskLocalVariables().get("variableName") </code>but it does not provide the value. but when i do a <code> task.getProcessVariables().get("variableName");</code> i am able to get the value. so what does the <code>task.getTaskLocalVariables() </code>fetch???

jbarrez
Star Contributor
Star Contributor
Ok, loads of questions Smiley Tongue

> It was not getting triggered properly.

Did you check if the job executor was running?

> so what does the task.getTaskLocalVariables() fetch???

Well, the variables local for the task Smiley Tongue Form variables are process instance scoped, not task local. When you create a variable on a task, the API gives you the option to select the scope.

> It is my own web-application

Then you don't need it. It doesn't really add anything to your application. The main part it does is the authentication in Explorer and feching some basic user/group info.