AnsweredAssumed Answered

From jpdl to bpmn 2.0, oh so verbose.

Question asked by unsavory on Jul 28, 2011
Latest reply on Jul 28, 2011 by ronald.van.kuijk
I'm hoping someone has some pointers for me and can help me figure out how to model this process is a more efficient manner.  I am porting our existing business processes from JBPM 4 to Activiti.  Our old processes were written in jpdl, and now that I'm moving things over to bpmn, I am finding bpmn to be both extremely verbose and complicated to do very simple things.

Here is a task we had modeled in jpdl:
<decision name="check_if_language_exam_required">
      <!– Language exam required for Simplified Chinese. –>
      <transition name="to complete language exam" to="complete_language_exam">
         <condition expr="#{ (!isLanguageExamComplete) and jobLanguage == 'zh' }" />
      </transition>
      <transition name="to check applicant auto rejection" to="check_applicant_auto_rejection" />
   </decision>
<task name="complete_language_exam" assignee="#{ stringId }">
            <transition name="completed" to="check_applicant_auto_rejection" />
            <transition name="abandoned" to="abandoned" />
            <transition name="to abandoned" to="abandoned" ends-task="true">
               <timer duedate="45 days" />
            </transition>
         </task>

It is essentially a language screening exam for Chinese applicants that they have 45 days to complete.  If it is not completed within 45 days, the process is ended in an abandoned state.  We also have the ability to manually mark a screening exam as abandoned.  Pretty simple stuff.

Now for bpmn 2.0:
      <exclusiveGateway id="isLanguageExamRequiredGw" name="Check if language exam required" default="langExamNotRequiredFlow" />
      
      <sequenceFlow id="langExamRequiredFlow" sourceRef="isLanguageExamRequiredGw" targetRef="completeLangExamTaskSetup">
         <!– Language exam required for Simplified Chinese. –>
         <conditionExpression xsi:type="tFormalExpression">${ (!isLanguageExamComplete) and jobLanguage == 'zh' }</conditionExpression>
      </sequenceFlow>
      
      <sequenceFlow id="langExamNotRequiredFlow" sourceRef="isLanguageExamRequiredGw" targetRef="sendRegisteredEmailTask" />
      
      <scriptTask id="completeLangExamTaskSetup" name="Complete language exam setup (hidden)" scriptFormat="groovy">
         <script>execution.setVariable('AvailableOutcomes', 'completed,abandoned')</script>
      </scriptTask>
      
      <sequenceFlow id="completeLangExamSetupFlow" sourceRef="completeLangExamTaskSetup" targetRef="completeLangExamTask" />
               
      <userTask id="completeLangExamTask" name="Complete language exam">
         <documentation>
            Complete the required language screening exam.
         </documentation>
         <extensionElements>
            <activiti:formProperty id="TaskOutcome" variable="TaskOutcome" required="true" />
         </extensionElements>
         <humanPerformer>
            <resourceAssignmentExpression>
               <formalExpression>${ stringId }</formalExpression>
            </resourceAssignmentExpression>
         </humanPerformer>
      </userTask>
      
      <boundaryEvent id="completeLangExamTaskAbandonedTimer" cancelActivity="true" attachedToRef="completeLangExamTask">
         <timerEventDefinition>
            <timeDuration>P45D</timeDuration>
         </timerEventDefinition>
      </boundaryEvent>
      
      <sequenceFlow id="completeLangExamTaskAbandonedTimerFlow" sourceRef="completeLangExamTaskAbandonedTimer" targetRef="abandonedOutcome" />
      
      <sequenceFlow id="langExamCompletedFlow" sourceRef="completeLangExamTask" targetRef="completeLangExamTaskOutcomeGw" />
      
      <exclusiveGateway id="completeLangExamTaskOutcomeGw" name="Check language exam outcome (hidden)" default="completeLangExamCompletedFlow" />
      
      <sequenceFlow id="completeLangExamCompletedFlow" sourceRef="completeLangExamTaskOutcomeGw" targetRef="sendRegisteredEmailTask" />
      
      <sequenceFlow id="completeLangExamAbandonedFlow" sourceRef="completeLangExamTaskOutcomeGw" targetRef="abandonedOutcome">
         <conditionExpression xsi:type="tFormalExpression">${ (LastTaskOutcome == 'abandoned') }</conditionExpression>
      </sequenceFlow>

Wow :shock: .  Please tell me there is a more efficient way to do this.  Am I missing something?  Thanks for any help or pointers you can provide.

Outcomes