AnsweredAssumed Answered

custom workflow difficulties

Question asked by georgy on Jul 30, 2014
Latest reply on Jul 31, 2014 by georgy
Hello
I'm having difficulties creating a custom advanced workflow. I've been working on it for well over a week, but don't fully understand all the facets of workflows.

We are using Alfrsco Community Edition 5.0a.

After making some changes today I am curently getting the error message:

org.activiti.engine.ActivitiIllegalArgumentException: org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener doesn't implement interface org.activiti.engine.delegate.ExecutionListener not interface org.activiti.engine.delegate.JavaDelegate

I created my workflow in the Activiti Designer in Eclipse. Here's the code:


<?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://www.activiti.org/test">
  <process id="activiti_apaVPAprocess" name="APA/VPA Freigabe Workflow" isExecutable="true">
    <startEvent id="startEvent" name="Alfresco start" activiti:formKey="wf:submitAdhocTask"></startEvent>
    <userTask id="qp_assignReviewTask" name="assign review" activiti:assignee="frehner" activiti:formKey="wf:adhocTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);
]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[execution.setVariable('bpm_assignee', task.getVariable('bpm_assignee'));
execution.setVariable('bpm_comment', task.getVariable('bpm_comment'));
execution.setVariable('abteilungsleiter', person);
execution.setVariable('bpm_dueDate', task.dueDate);
execution.setVariable('bpm_priority', task.priority);]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <userTask id="abtL_reviewTask" name="abtl_review" activiti:assignee="frehner" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);
]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[execution.setVariable('av_kab', person);
execution.setVariable('bpm_comment', task.getVariable('bpm_comment'));
execution.setVariable('abtl_reviewOutcome', task.getVariable('abtl_reviewOutcome'));]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <userTask id="av_reviewTask" name="av_review" activiti:assignee="keller" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[execution.setVariable('bpm_comment', task.getVariable('bpm_comment'));
execution.setVariable('av_ReviewOutcome', task.getVariable('av_ReviewOutcome'));]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <userTask id="documentsApproved" name="approved" activiti:assignee="frehner" activiti:formKey="wf:approvedTask">
      <documentation>Das Dokument wurde überprüft und genehmigt.
/ The document was reviewed and approved.</documentation>
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow1" name="1" sourceRef="startEvent" targetRef="qp_assignReviewTask"></sequenceFlow>
    <sequenceFlow id="flow2" name="2" sourceRef="qp_assignReviewTask" targetRef="abtL_reviewTask"></sequenceFlow>
    <exclusiveGateway id="reviewDecision1" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow3" name="3" sourceRef="abtL_reviewTask" targetRef="reviewDecision1"></sequenceFlow>
    <sequenceFlow id="flow4" name="4" sourceRef="reviewDecision1" targetRef="av_reviewTask">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${abtl_reviewOutcome == 'Approve'}]]></conditionExpression>
    </sequenceFlow>
    <exclusiveGateway id="reviewDecision2" name="Exclusive Gateway"></exclusiveGateway>
    <sequenceFlow id="flow6" name="6" sourceRef="av_reviewTask" targetRef="reviewDecision2"></sequenceFlow>
    <sequenceFlow id="flow7" name="7" sourceRef="reviewDecision2" targetRef="documentsApproved">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${av_ReviewOutcome == 'Approve'}]]></conditionExpression>
    </sequenceFlow>
    <endEvent id="endEvent" name="End"></endEvent>
    <sequenceFlow id="flow10" name="10" sourceRef="documentsApproved" targetRef="endEvent"></sequenceFlow>
    <userTask id="rejected" name="rejected" activiti:assignee="frehner" activiti:formKey="wf:rejectedTask">
      <documentation>Das Dokument wurde überprüft und abgelehnt.
/ The document was reviewed and rejected.</documentation>
      <extensionElements>
        <activiti:taskListener event="create" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string><![CDATA[if (typeof bpm_workflowDueDate != 'undefined') task.dueDate = bpm_workflowDueDate;
if (typeof bpm_workflowPriority != 'undefined') task.priority = bpm_workflowPriority;
if (typeof bpm_comment != 'undefined') task.setVariable('bpm_comment', bpm_comment);]]></activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow5" name="5" sourceRef="reviewDecision1" targetRef="rejected">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${abtl_reviewOutcome == 'Reject'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow8" name="8" sourceRef="reviewDecision2" targetRef="rejected">
      <conditionExpression xsi:type="tFormalExpression"><![CDATA[${av_ReviewOutcome == 'Reject'}]]></conditionExpression>
    </sequenceFlow>
    <sequenceFlow id="flow9" name="9" sourceRef="rejected" targetRef="qp_assignReviewTask"></sequenceFlow>
  </process>


I am thankful for any help rendered or advice given, as I am struggling to get this workflow running.

Description of the intended workflow process:
-the initiator sends a document to user1 to be reviewd
-if approved, user1 sends the document to user 2 to be reviewed
-if the document was approved by user1 and 2, the approved document returns to the initiator who converts it to a PDF file
-if the document is rejected by either user it comes back to the initiator.

nice-to-have:
-if the document is not approved/rejected within x days it geta approved automatically and is sent to the initiator.


P.S. now I cannot deploy the xml, receiving the message "Exception in Transaction."

Attachments

Outcomes