cancel
Showing results for 
Search instead for 
Did you mean: 

jPDL process design strategy to ease portability to Activiti

daramcguinness
Champ in-the-making
Champ in-the-making
Hi,

We’re currently implementing an Alfresco project with a particular emphasis on process modeling which, due to our release timescales, is targeted at Alfresco 3.x and therefore jBPM/jPDL. Given the imminent move of Alfresco to Activiti/BPMN2.0 in future releases, we’d like to ensure that we make informed decisions around process design that will make future migration easier – especially in the area of scripting reuse and node compatibility.

As I realize that this is quite a broad area that would require a lot of discussion and comparisons between the two technologies and their integration in Alfresco, I’ll limit this post to three “big hitter” questions:

(1) Is there any material available (perhaps from work in the jBPM migration area) on how best to map from jPDL to BPMN? My thinking is that we could use this as a starting point for laying down some guidelines on how to design our new jPDL processes (for example, guidelines like: in jPDL avoid multiple transitions in favor of task node + decision node, which will map more easily to a task + Exclusive Gateway in BPMN2.0 etc.)?

(2) Is it worth it? i.e. would you (given your in-depth knowledge of both jBPM/jPDL and Activiti/BPMN2.0) consider laying down such guidelines a useful/feasible approach, or do you think we should just go ahead without constraining process definitions now and deal with migration later?

(3) Will Alfresco’s JavaScript API continue to be supported as the principle scripting means for interacting with Alfresco from Process nodes (as currently happens in jPDL using an action with class=”org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript”) and, if so, will this be done using a Java Service Task (that accepts the script in input) or directly from a Script Task?

Many thanks,
Dara
1 REPLY 1

frederikherema1
Star Contributor
Star Contributor
I can give you an answer on 3):

Activiti in Alfresco will also support using the Alfresco-scripting. Simmilar to the AlfrescoJavaScript, there are TaskListeners and ExecutionListeners available that execute alfresco-javascript. This is done exactly the same way as with JBPM, exposing root-objects (eg. nodeService, people) to be used.
eg:

<extensionElements>
              <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
           <activiti:field name="script">
                      <activiti:string>
                         var members = people.getMembers(bpm_groupAssignee);
                         var memberNames = new java.util.ArrayList();
                        
                         for(var i in members) {
                          memberNames.add(members[i].properties.userName);
                         }
                         execution.setVariable('wf_groupMembers', memberNames);
                         execution.setVariable('wf_reviewerCount', memberNames.size());
                      </activiti:string>
                   </activiti:field>
             </activiti:executionListener>
          </extensionElements>


Since Activiti uses JSR-233 for it's scripting (and script-task), currently it's not possible to use Alfresco Javascript from within a BPMN ScriptTask. However, you can use scripting on the NodeRefs (eg. initiator.properties.userName etc) in JSR-233 environment. But to have full alfresco-js-support, a custom service-task should indeed be used.