AnsweredAssumed Answered

exlusiveGateway default error

Question asked by on Mar 5, 2014
Latest reply on Mar 10, 2014 by frederikheremans1
Hi I'm fairly new to activity, i have a situation where I want to do the following:
if a then taskA
if b then taskB
else throw java RuntimeException

here's what I got:

<sequenceFlow id="flow1" sourceRef="start" targetRef="decision" />
<exclusiveGateway id="decision" name="pick task" default="goToThrowException" />
<sequenceFlow id="flow2" sourceRef="decision" targetRef="taskA" >
<conditionExpression>${activitiWorkflowService.evaluate(execution, "isTaskA")}</conditionExpression>
<sequenceFlow id="flow3" sourceRef="decision" targetRef="taskB" >
<conditionExpression>${activitiWorkflowService.evaluate(execution, "isTaskB")}</conditionExpression>
<sequenceFlow id="goToThrowException" sourceRef="decision" targetRef="throwException"/>
<sequenceFlow id="flow4" sourceRef="throwException" targetRef="decisionEnd"/>
<serviceTask id="throwException" name="Throw error no task defined" activiti:class="com.path.activiti.ActivitiServiceTask" />
<exclusiveGateway id="decisionEnd" name="decision task END"/>
<sequenceFlow id="flow5" sourceRef="decisionEnd" targetRef="end" />

Sorry if some of the steps are redundant but I'm new to this and i'm unsure if there'a better way to do it. Now, how can i get this xml to call java code that will throw my exeption as follows or if activiti has a better way to do it:

public void handleUnsupportedSpecialDoc() throws Exception{
    throw new RuntimeException("unsupport task by workflow");