New Tutorial: Alfresco Advanced Workflows

3,244 views
Skip to first unread message

Jeff Potts

unread,
Feb 20, 2012, 3:33:21 PM2/20/12
to alfresco-techn...@googlegroups.com
If you or your team are looking for a gentle intro to Alfresco's Advanced Workflows you might want to check out my new tutorial. It covers Activiti and configuring the workflow in the Share UI.

Enjoy!

Jeff

Jeff Potts

unread,
Apr 3, 2013, 4:29:45 PM4/3/13
to alfresco-techn...@googlegroups.com
Thanks for working through the tutorial and for posting your business process definitions. I agree they are extremely close. I thought maybe you were using a form key that wasn't declared as a type but you appear to be using the exact same types as the ones in my tutorial. What about your share-config-custom.xml. Are the forms showing up identical when starting and running through the two workflows?

Jeff

On Wednesday, April 3, 2013 8:59:51 AM UTC-5, LorenzoRep wrote:
Attachments aren't working so I write down the code. 

helloWorldUI2 (yours)

<?xml version="1.0" encoding="UTF-8"?>
  <process id="helloWorldUI2" name="activitiHelloWorldUI2">
    <startEvent id="startevent1" name="Start" activiti:formKey="scwf:submitHelloWorldTask"></startEvent>
    <userTask id="usertask1" name="User Task" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:activitiReviewTask">
      <!-- Setting an execution variable using the value of a task variable -->
      <extensionElements>
        <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
          <activiti:field name="script">
            <activiti:string>execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));</activiti:string>
          </activiti:field>
        </activiti:taskListener>
      </extensionElements>
    </userTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow1" name="" sourceRef="startevent1" targetRef="usertask1">
      <!-- Alfresco javaScript writing a log entry with the name of the scwf_helloName variable -->
      <extensionElements>
        <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
          <activiti:field name="script">
            <activiti:string>logger.log("Hello, " + scwf_helloName + "!");</activiti:string>
          </activiti:field>
        </activiti:executionListener>
      </extensionElements>
    </sequenceFlow>
    <sequenceFlow id="flow2" name="" sourceRef="usertask1" targetRef="alfrescoScripttask1"></sequenceFlow>
    <serviceTask id="alfrescoScripttask1" name="Alfresco Script Task" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
      <!-- Logging the value of the wf_reviewOutcome -->
      <extensionElements>
        <activiti:field name="script">
          <activiti:string>logger.log("The outcome of the review task is: " + wf_reviewOutcome);</activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="flow3" name="" sourceRef="alfrescoScripttask1" targetRef="endevent1"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_helloWorldUI">
    <bpmndi:BPMNPlane bpmnElement="helloWorldUI" id="BPMNPlane_helloWorldUI">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35" width="35" x="30" y="200"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55" width="105" x="125" y="190"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35" width="35" x="420" y="200"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="alfrescoScripttask1" id="BPMNShape_alfrescoScripttask1">
        <omgdc:Bounds height="55" width="105" x="280" y="190"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="65" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="125" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="230" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="280" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="385" y="217"></omgdi:waypoint>
        <omgdi:waypoint x="420" y="217"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

helloWorldUI (mine)

<?xml version="1.0" encoding="UTF-8"?>
  <process id="helloWorldUI" name="bspaActivitiHelloWorldUI" >
    <startEvent id="alfrescoStartevent1" name="Alfresco start" activiti:formKey="scwf:submitHelloWorldTask"></startEvent>
    <userTask id="alfrescoUsertask1" name="Alfresco User Task" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:activitiReviewTask">
    <!-- Setting an execution variable using the value of a task variable -->
    <extensionElements>
    <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
    <activiti:field name="script">
    <activiti:string>execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));</activiti:string>
    </activiti:field>
    </activiti:taskListener>
    </extensionElements>
    </userTask>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow3" name="to Alfresco User Task" sourceRef="alfrescoStartevent1" targetRef="alfrescoUsertask1">
    <!-- Alfresco javaScript writing a log entry with the name of the scwf_helloName variable -->
    <extensionElements>
    <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
    <activiti:field name="script">
    <activiti:string>logger.log("Hello, " + scwf_helloName + "!");</activiti:string>
    </activiti:field>
    </activiti:executionListener>
    </extensionElements>
    </sequenceFlow>
    <sequenceFlow id="flow1" name="to End" sourceRef="alfrescoScripttask1" targetRef="endevent1"></sequenceFlow>
    <sequenceFlow id="flow2" name="to Alfresco Script Task" sourceRef="alfrescoUsertask1" targetRef="alfrescoScripttask1"></sequenceFlow>
    <serviceTask id="alfrescoScripttask1" name="Alfresco Script Task" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
    <!-- Logging the value of the wf_reviewOutcome -->
    <extensionElements>
    <activiti:field name="script">
    <activiti:string>logger.log("The outcome of the review task is: " + wf_reviewOutcome);</activiti:string>
    </activiti:field>
    </extensionElements>
    </serviceTask>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_myProcess">
    <bpmndi:BPMNPlane bpmnElement="HelloWorldUI" id="BPMNPlane_myProcess">
      <bpmndi:BPMNShape bpmnElement="alfrescoStartevent1" id="BPMNShape_alfrescoStartevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="40.0" y="190.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="alfrescoUsertask1" id="BPMNShape_alfrescoUsertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="190.0" y="180.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="alfrescoScripttask1" id="BPMNShape_alfrescoScripttask1">
        <omgdc:Bounds height="55.0" width="105.0" x="400.0" y="180.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="650.0" y="190.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="505.0" y="207.0"></omgdi:waypoint>
        <omgdi:waypoint x="650.0" y="207.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="16.0" width="100.0" x="-26.0" y="2.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="295.0" y="207.0"></omgdi:waypoint>
        <omgdi:waypoint x="400.0" y="207.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="48.0" width="100.0" x="-37.0" y="2.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
        <omgdi:waypoint x="75.0" y="207.0"></omgdi:waypoint>
        <omgdi:waypoint x="190.0" y="207.0"></omgdi:waypoint>
        <bpmndi:BPMNLabel>
          <omgdc:Bounds height="48.0" width="100.0" x="-41.0" y="2.0"></omgdc:Bounds>
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

The log

  [... THE GOOD ONE]
 
 2013-04-03 15:12:54,125  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-3] Generating form for item:
 2013-04-03 15:12:54,125  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-3] kind = workflow
 2013-04-03 15:12:54,125  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-3] id = activiti$helloWorldUI2
 2013-04-03 15:12:54,126  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-3] fields = bpm:workflowDescription,packageItems,scwf:helloName,transitions
 2013-04-03 15:12:54,130  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-3] formModel = {"formData": {"assoc_packageItems": "", "prop_bpm_packageActionGroup": "add_package_item_actions", "prop_bpm_packageItemActionGroup": "start_package_item_actions"}, "item": "api\/workflow-definitions\/activiti$helloWorldUI2:1:1903", "type": "activiti$helloWorldUI2", "submissionUrl": "\/api\/workflow\/activiti%24helloWorldUI2\/formprocessor", "fields": "[Lorg.alfresco.repo.forms.FieldDefinition;@f5bbb1b"}
 2013-04-03 15:13:02,653  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] json form submission for item:
 2013-04-03 15:13:02,654  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] kind = workflow
 2013-04-03 15:13:02,654  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] id = activiti$helloWorldUI2
 2013-04-03 15:13:02,720  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] Hello, tutorial wf!
 2013-04-03 15:13:05,252  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] Generating form for item:
 2013-04-03 15:13:05,252  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] kind = task
 2013-04-03 15:13:05,253  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] id = activiti$2236
 2013-04-03 15:13:05,253  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] fields = message,taskOwner,bpm:priority,bpm:dueDate,bpm:taskId,bpm:status,packageItems,bpm:comment,wf:reviewOutcome
 2013-04-03 15:13:05,301  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] formModel = {"formData": {"assoc_packageItems": "", "prop_bpm_taskId": "2236", "prop_bpm_priority": 2, "prop_bpm_packageItemActionGroup": "edit_package_item_actions", "prop_bpm_status": "Not Yet Started", "prop_message": "tutorial wf", "prop_wf_reviewOutcome": "Reject", "prop_taskOwner": "lorenzo.repichini|Lorenzo|Repichini", "prop_bpm_packageActionGroup": ""}, "item": "api\/task-instances\/activiti$2236", "type": "wf:activitiReviewTask", "submissionUrl": "\/api\/task\/activiti%242236\/formprocessor", "fields": "[Lorg.alfresco.repo.forms.FieldDefinition;@5f3fb7c0"}
 2013-04-03 15:13:07,990  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] json form submission for item:
 2013-04-03 15:13:07,990  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] kind = task
 2013-04-03 15:13:07,990  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] id = activiti$2236
 2013-04-03 15:13:08,168  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] The outcome of the review task is: Approve

 [... THE BAD ONE]

INFO: Process with id='helloWorldUI2' hasn't the attribute isExecutable set. Please maintain it, so you are compatible to future activiti versions.
2013-04-03 15:12:08,183  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-2] Generating form for item:
 2013-04-03 15:12:08,183  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-2] kind = workflow
 2013-04-03 15:12:08,183  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-2] id = activiti$helloWorldUI
 2013-04-03 15:12:08,184  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-2] fields = bpm:workflowDescription,packageItems,scwf:helloName,transitions
 2013-04-03 15:12:08,198  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-2] formModel = {"formData": {"assoc_packageItems": "", "prop_bpm_packageActionGroup": "add_package_item_actions", "prop_bpm_packageItemActionGroup": "start_package_item_actions"}, "item": "api\/workflow-definitions\/activiti$helloWorldUI:1:1203", "type": "activiti$helloWorldUI", "submissionUrl": "\/api\/workflow\/activiti%24helloWorldUI\/formprocessor", "fields": "[Lorg.alfresco.repo.forms.FieldDefinition;@79a50618"}
 2013-04-03 15:12:18,784  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] json form submission for item:
 2013-04-03 15:12:18,785  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] kind = workflow
 2013-04-03 15:12:18,785  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] id = activiti$helloWorldUI
 2013-04-03 15:12:18,907  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] Hello, mio wf! - UI -
 2013-04-03 15:12:19,508  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-7] Unable to resolve specified root node reference: alfresco://company/home
 2013-04-03 15:12:19,508  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-7] Processing resultset of length: 0
 2013-04-03 15:12:19,508  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-7] Filtered resultset to length: 0. Discarded item count: 0
 2013-04-03 15:12:19,532  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] Processing resultset of length: 0
 2013-04-03 15:12:19,534  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] Filtered resultset to length: 0. Discarded item count: 0
 2013-04-03 15:12:19,541  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] Processing resultset of length: 3
 2013-04-03 15:12:19,549  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-6] doclist.get.js - NodeRef: alfresco://sites/home Query: +PATH:"/app:company_home/st:sites//cm:*" +((+@cm\:workingCopyOwner:"lorenzo.repichini") OR (+@cm\:lockOwner:"lorenzo.repichini" +@cm\:lockType:"WRITE_LOCK")) +(TYPE:"content" OR TYPE:"app:filelink" OR TYPE:"folder")
 2013-04-03 15:12:19,566  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-6] doclist.get.js - query results: 0
 2013-04-03 15:12:19,567  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-6] doclist.get.js - will match results using regex: \/app:company_home\/st:sites\/.*\/cm:documentLibrary\/.*
 2013-04-03 15:12:19,567  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-6] doclist.get.js - totalRecords: 0
 2013-04-03 15:12:19,609  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] doclist.get.js - NodeRef: alfresco://sites/home Query: +PATH:"/app:company_home/st:sites//cm:*" +@cm\:modified:[2013\-3\-27T00\:00\:00.000 TO 2013\-4\-3T23\:59\:59.999] +@cm\:modifier:"lorenzo.repichini" +TYPE:"cm:content" -TYPE:"cm:systemfolder" -TYPE:"fm:forums" -TYPE:"fm:forum" -TYPE:"fm:topic" -TYPE:"fm:post" +(TYPE:"content" OR TYPE:"app:filelink" OR TYPE:"folder")
 2013-04-03 15:12:19,638  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] doclist.get.js - query results: 0
 2013-04-03 15:12:19,639  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] doclist.get.js - will match results using regex: \/app:company_home\/st:sites\/.*\/cm:documentLibrary\/.*
 2013-04-03 15:12:19,639  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-9] doclist.get.js - totalRecords: 0
 2013-04-03 15:12:19,648  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] Filtered resultset to length: 3. Discarded item count: 0
 2013-04-03 15:12:19,668  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] Processing resultset of length: 0
 2013-04-03 15:12:19,669  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-4] Filtered resultset to length: 0. Discarded item count: 0
 2013-04-03 15:12:21,924  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-5] Generating form for item:
 2013-04-03 15:12:21,925  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-5] kind = task
 2013-04-03 15:12:21,925  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-5] id = activiti$2142
 2013-04-03 15:12:21,926  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-5] fields = message,taskOwner,bpm:priority,bpm:dueDate,bpm:taskId,bpm:status,packageItems,bpm:comment,wf:reviewOutcome
 2013-04-03 15:12:22,005  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-5] formModel = {"formData": {"assoc_packageItems": "", "prop_bpm_taskId": "2142", "prop_bpm_priority": 2, "prop_bpm_packageItemActionGroup": "edit_package_item_actions", "prop_bpm_status": "Not Yet Started", "prop_message": "mio wf", "prop_wf_reviewOutcome": "Reject", "prop_taskOwner": "lorenzo.repichini|Lorenzo|Repichini", "prop_bpm_packageActionGroup": ""}, "item": "api\/task-instances\/activiti$2142", "type": "wf:activitiReviewTask", "submissionUrl": "\/api\/task\/activiti%242142\/formprocessor", "fields": "[Lorg.alfresco.repo.forms.FieldDefinition;@8fe94f5"}
 2013-04-03 15:12:23,220  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-12] json form submission for item:
 2013-04-03 15:12:23,224  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-12] kind = task
 2013-04-03 15:12:23,224  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-12] id = activiti$2142
 Apr 03, 2013 3:12:23 PM org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
org.alfresco.scripts.ScriptException: 03030054 Failed to execute supplied script: 03030053 ReferenceError: "wf_reviewOutcome" is not defined. (AlfrescoJS#1)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:278)
at org.alfresco.repo.processor.ScriptServiceImpl.executeString(ScriptServiceImpl.java:286)
at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:193)
at org.alfresco.repo.processor.ScriptServiceImpl.executeScriptString(ScriptServiceImpl.java:183)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:159)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy263.executeScriptString(Unknown Source)
at org.alfresco.repo.workflow.activiti.script.ActivitiScriptBase.executeScript(ActivitiScriptBase.java:105)
at org.alfresco.repo.workflow.activiti.script.ActivitiScriptBase.executeScript(ActivitiScriptBase.java:63)
at org.alfresco.repo.workflow.activiti.script.DelegateExecutionScriptBase.runScript(DelegateExecutionScriptBase.java:70)
at org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate.execute(AlfrescoScriptDelegate.java:43)
at org.activiti.engine.impl.delegate.JavaDelegateInvocation.invoke(JavaDelegateInvocation.java:34)
at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:49)
at org.activiti.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:40)
at org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:115)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerStart.java:52)
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541)
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionCreateScope.execute(AtomicOperationTransitionCreateScope.java:49)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerTake.execute(AtomicOperationTransitionNotifyListenerTake.java:65)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionDestroyScope.execute(AtomicOperationTransitionDestroyScope.java:115)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541)
at org.activiti.engine.impl.pvm.runtime.AtomicOperationTransitionNotifyListenerEnd.eventNotificationsCompleted(AtomicOperationTransitionNotifyListenerEnd.java:36)
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:56)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541)
at org.activiti.engine.impl.pvm.runtime.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:49)
at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.take(ExecutionEntity.java:381)
at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performOutgoingBehavior(BpmnActivityBehavior.java:102)
at org.activiti.engine.impl.bpmn.behavior.BpmnActivityBehavior.performDefaultOutgoingBehavior(BpmnActivityBehavior.java:51)
at org.activiti.engine.impl.bpmn.behavior.FlowNodeActivityBehavior.leave(FlowNodeActivityBehavior.java:44)
at org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.leave(AbstractBpmnActivityBehavior.java:47)
at org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior.signal(UserTaskActivityBehavior.java:92)
at org.activiti.engine.impl.persistence.entity.ExecutionEntity.signal(ExecutionEntity.java:364)
at org.activiti.engine.impl.persistence.entity.TaskEntity.complete(TaskEntity.java:156)
at org.activiti.engine.impl.cmd.CompleteTaskCmd.completeTask(CompleteTaskCmd.java:63)
at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:57)
at org.activiti.engine.impl.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:28)
at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
at org.activiti.engine.impl.TaskServiceImpl.complete(TaskServiceImpl.java:144)
at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.endNormalTask(ActivitiWorkflowEngine.java:1405)
at org.alfresco.repo.workflow.activiti.ActivitiWorkflowEngine.endTask(ActivitiWorkflowEngine.java:1382)
at org.alfresco.repo.workflow.WorkflowServiceImpl.endTask(WorkflowServiceImpl.java:888)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:159)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy74.endTask(Unknown Source)
at org.alfresco.repo.workflow.TaskUpdater.transition(TaskUpdater.java:136)
at org.alfresco.repo.forms.processor.workflow.TaskFormPersister.persist(TaskFormPersister.java:173)
at org.alfresco.repo.forms.processor.workflow.TaskFormPersister.persist(TaskFormPersister.java:46)
at org.alfresco.repo.forms.processor.workflow.AbstractWorkflowFormProcessor.internalPersist(AbstractWorkflowFormProcessor.java:76)
at org.alfresco.repo.forms.processor.FilteredFormProcessor.persist(FilteredFormProcessor.java:131)
at org.alfresco.repo.forms.FormServiceImpl.saveForm(FormServiceImpl.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.alfresco.repo.security.permissions.impl.AlwaysProceedMethodInterceptor.invoke(AlwaysProceedMethodInterceptor.java:34)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethodInterceptor.invoke(ExceptionTranslatorMethodInterceptor.java:46)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInterceptor.java:159)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy134.saveForm(Unknown Source)
at org.alfresco.repo.forms.script.ScriptFormService.saveForm(ScriptFormService.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:155)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:243)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
at org.mozilla.javascript.gen.c14._c1(file:/opt/alfresco-4.2.c/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js:57)
at org.mozilla.javascript.gen.c14.call(file:/opt/alfresco-4.2.c/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName0(OptRuntime.java:108)
at org.mozilla.javascript.gen.c14._c0(file:/opt/alfresco-4.2.c/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js:90)
at org.mozilla.javascript.gen.c14.call(file:/opt/alfresco-4.2.c/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at org.mozilla.javascript.gen.c14.call(file:/opt/alfresco-4.2.c/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
at org.mozilla.javascript.gen.c14.exec(file:/opt/alfresco-4.2.c/tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/repository/forms/form.post.json.js)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:492)
at org.alfresco.repo.jscript.RhinoScriptProcessor.execute(RhinoScriptProcessor.java:198)
at org.alfresco.repo.processor.ScriptServiceImpl.execute(ScriptServiceImpl.java:212)
at org.alfresco.repo.processor.ScriptServiceImpl.executeScript(ScriptServiceImpl.java:174)
at org.alfresco.repo.web.scripts.RepositoryScriptProcessor.executeScript(RepositoryScriptProcessor.java:102)
at org.springframework.extensions.webscripts.AbstractWebScript.executeScript(AbstractWebScript.java:1305)
at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:86)
at org.alfresco.repo.web.scripts.RepositoryContainer$3.execute(RepositoryContainer.java:433)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:433)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecute(RepositoryContainer.java:495)
at org.alfresco.repo.web.scripts.RepositoryContainer.transactionedExecuteAs(RepositoryContainer.java:533)
at org.alfresco.repo.web.scripts.RepositoryContainer.executeScript(RepositoryContainer.java:349)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:377)
at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:209)
at org.springframework.extensions.webscripts.servlet.WebScriptServlet.service(WebScriptServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.alfresco.web.app.servlet.GlobalLocalizationFilter.doFilter(GlobalLocalizationFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1813)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.alfresco.error.AlfrescoRuntimeException: 03030053 ReferenceError: "wf_reviewOutcome" is not defined. (AlfrescoJS#1)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:516)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeString(RhinoScriptProcessor.java:274)
... 177 more
Caused by: org.mozilla.javascript.EcmaError: ReferenceError: "wf_reviewOutcome" is not defined. (AlfrescoJS#1)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3350)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3340)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3413)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1612)
at org.mozilla.javascript.gen.c17._c0(AlfrescoJS:1)
at org.mozilla.javascript.gen.c17.call(AlfrescoJS)
at org.mozilla.javascript.gen.c17.exec(AlfrescoJS)
at org.alfresco.repo.jscript.RhinoScriptProcessor.executeScriptImpl(RhinoScriptProcessor.java:492)
... 178 more

2013-04-03 15:12:23,480  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-12] org.alfresco.scripts.ScriptException: 03030054 Failed to execute supplied script: 03030053 ReferenceError: "wf_reviewOutcome" is not defined. (AlfrescoJS#1)
 2013-04-03 15:12:23,480  DEBUG [repo.jscript.ScriptLogger] [http-apr-8080-exec-12] Returning 500 status code

 
 [...]

LorenzoRep

unread,
Apr 4, 2013, 4:55:47 AM4/4/13
to alfresco-techn...@googlegroups.com
Hi Jeff, 
thanks for your reply. 

This is my share-config-custom.xml in the share-amp project:

<alfresco-config>

  <config evaluator="string-compare" condition="Remote">
    <remote>
      <endpoint>
        <id>alfresco-noauth</id>
        <name>Alfresco - unauthenticated access</name>
        <description>Access to Alfresco Repository WebScripts that do not require authentication</description>
        <connector-id>alfresco</connector-id>
        <endpoint-url>${alfresco.http.url}/s</endpoint-url>
        <identity>none</identity>
      </endpoint>

      <endpoint>
        <id>alfresco</id>
        <name>Alfresco - user access</name>
        <description>Access to Alfresco Repository WebScripts that require user authentication</description>
        <connector-id>alfresco</connector-id>
        <endpoint-url>${alfresco.http.url}/s</endpoint-url>
        <identity>user</identity>
      </endpoint>

      <endpoint>
        <id>alfresco-feed</id>
        <name>Alfresco Feed</name>
        <description>Alfresco Feed - supports basic HTTP authentication via the EndPointProxyServlet</description>
        <connector-id>http</connector-id>
        <endpoint-url>${alfresco.http.url}/s</endpoint-url>
        <basic-auth>true</basic-auth>
        <identity>user</identity>
      </endpoint>
    </remote>
  </config>
  
  <!--
      ====================================================================
      WORKFLOW FORMS
      ====================================================================
  -->
  
  <!-- Activiti Hello World UI Workflow Definition -->
    <config evaluator="string-compare" condition="activiti$helloWorldUI">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="packageItems" />
               <show id="scwf:helloName" />
               <show id="transitions" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="other" appearance="title" label-id="workflow.set.other" />
               <set id="response" appearance="title" label-id="workflow.set.response" />
               
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="packageItems" set="items" />
               <field id="helloName" set="other" />
               <field id="transitions" set="response" />
            </appearance>
         </form>
      </forms>
    </config>
    
    <config evaluator="string-compare" condition="activiti$helloWorldUI2">
      <forms>
         <form>
            <field-visibility>
               <show id="bpm:workflowDescription" />
               <show id="packageItems" />
               <show id="scwf:helloName" />
               <show id="transitions" />
            </field-visibility>
            <appearance>
               <set id="" appearance="title" label-id="workflow.set.general" />
               <set id="items" appearance="title" label-id="workflow.set.items" />
               <set id="other" appearance="title" label-id="workflow.set.other" />
               <set id="response" appearance="title" label-id="workflow.set.response" />
               
               <field id="bpm:workflowDescription" label-id="workflow.field.message">
                  <control template="/org/alfresco/components/form/controls/textarea.ftl">
                     <control-param name="style">width: 95%</control-param>
                  </control>
               </field>
               <field id="packageItems" set="items" />
               <field id="helloName" set="other" />
               <field id="transitions" set="response" />
            </appearance>
         </form>
      </forms>
    </config>
    
</alfresco-config>

And my model in the repo amp project named bspa-workflow-model.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- Definition of new Model -->
<model name="scwf:workflowmodel"

<!-- Optional meta-data about the model -->
<description>b!S.p.A. Workflow Model</description>
<author>Lorenzo Repichini</author>
<version>1.0</version>

<!-- Imports are required to allow references to definitions in other models -->
<imports>
prefix="d" />
prefix="bpm" />
</imports>

<!-- Introduction of new namespaces defined by this model -->
<namespaces>
prefix="scwf" />
</namespaces>

<types>
<type name="scwf:submitHelloWorldTask">
<parent>bpm:startTask</parent>
<properties>
<property name="scwf:helloName">
<type>d:text</type>
<mandatory>true</mandatory>
<multiple>false</multiple>
</property>
</properties>
</type>
</types>
</model>

...and the context for spring in the repo amp project named bspa-workflow-contex.xml

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
    <bean id="bspa.workflowBootstrap" parent="workflowDeployer">
        <property name="workflowDefinitions">
            <list>
                <props>
                    <prop key="engineId">activiti</prop>
                    <prop key="location">alfresco/module/${artifactId}/workflow/helloWorldUI.bpmn</prop>
                    <prop key="mimetype">text/xml</prop>
                    <prop key="redeploy">false</prop>           
                </props>
                <props>
                    <prop key="engineId">activiti</prop>
                    <prop key="location">alfresco/module/${artifactId}/workflow/helloWorldUI2.bpmn</prop>
                    <prop key="mimetype">text/xml</prop>
                    <prop key="redeploy">false</prop>           
                </props>
            </list>
        </property>
        <property name="models">
        <list>
        <value>alfresco/module/${artifactId}/model/bspa-workflow-model.xml</value>
        </list>
        </property>
        <property name="labels">
        <list>
        <value>alfresco.module.${artifactId}.messages.bspa-workflow</value>
        </list>
        </property
    </bean>
</beans>

Looking around I found the definition of the wf:activitiReviewTask, as you wrote in the tutorial. And it's in the .../alfresco/workflow/workflowModel.xml

...
       <type name="wf:activitiReviewTask">
            <parent>bpm:activitiOutcomeTask</parent>
            <properties>
                <property name="wf:reviewOutcome">
                    <type>d:text</type>
                    <default>Reject</default>
                    <constraints>
                        <constraint name="wf:reviewOutcomeOptions" type="LIST">
                            <parameter name="allowedValues">
                                <list>
                                    <value>Approve</value>
                                    <value>Reject</value>
                                </list>
                            </parameter>
                        </constraint>
                    </constraints>
                </property>
            </properties>
            <overrides>
                <property name="bpm:packageItemActionGroup">
                    <default>edit_package_item_actions</default>
                </property>
                <property name="bpm:outcomePropertyName">
                    <default>{http://www.alfresco.org/model/workflow/1.0}reviewOutcome</default>
                </property>
            </overrides>
        </type>
...

Really I can't understand what's wrong with my process!

Anyway I'm moving on on your tutorial so be aware, I'm going to ask you other questions :-)

Михаил Никитин

unread,
Jan 12, 2015, 9:56:33 AM1/12/15
to alfresco-techn...@googlegroups.com
Hi! There are a lot of nice tutorials about making workflows but no or very few tutorials about using java to extend the basic functions. i faced with the problem that I can't found any information of how to get nodes(files) attached to the workflow, I mean when the user creates a new task and attaches files I need to get them and make some transformation with it. Getting CompanyHome returns me the list of all folders in the alfresco what is not the what I expected.

понедельник, 20 февраля 2012 г., 23:33:21 UTC+3 пользователь Jeff Potts написал:

Douglas C. R. Paes

unread,
Jan 12, 2015, 12:08:08 PM1/12/15
to alfresco-techn...@googlegroups.com
From Jeff's tutorial (http://ecmarchitect.com/alfresco-developer-series-tutorials/workflow/tutorial/tutorial.html):

The bpm:workflowTask has an association called bpm:package. The bpm:package points to abpm:workflowPackage which is the aspect applied to a container (like a folder) that holds the documents being routed through a workflow. When you write code that needs to access the content being routed in a workflow you can get to it through the bpm:packageassociation.

Looking at the package association items, you will be able to manipulate documents the way you need.

--
You received this message because you are subscribed to the Google Groups "Alfresco Technical Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alfresco-technical-d...@googlegroups.com.
To post to this group, send email to alfresco-techn...@googlegroups.com.
Visit this group at http://groups.google.com/group/alfresco-technical-discussion.
For more options, visit https://groups.google.com/d/optout.

Михаил Никитин

unread,
Jan 13, 2015, 2:49:50 AM1/13/15
to alfresco-techn...@googlegroups.com
Yes, I've seen this but the the problem is how to access it from the java action.

понедельник, 12 января 2015 г., 20:08:08 UTC+3 пользователь Douglas C. R. Paes написал:
From Jeff's tutorial (http://ecmarchitect.com/alfresco-developer-series-tutorials/workflow/tutorial/tutorial.html):

The bpm:workflowTask has an association called bpm:package. The bpm:package points to abpm:workflowPackage which is the aspect applied to a container (like a folder) that holds the documents being routed through a workflow. When you write code that needs to access the content being routed in a workflow you can get to it through the bpm:packageassociation.

Looking at the package association items, you will be able to manipulate documents the way you need.

Em Mon Jan 12 2015 at 2:39:54 PM, Михаил Никитин <mihailni...@gmail.com> escreveu:
Hi! There are a lot of nice tutorials about making workflows but no or very few tutorials about using java to extend the basic functions. i faced with the problem that I can't found any information of how to get nodes(files) attached to the workflow, I mean when the user creates a new task and attaches files I need to get them and make some transformation with it. Getting CompanyHome returns me the list of all folders in the alfresco what is not the what I expected.

понедельник, 20 февраля 2012 г., 23:33:21 UTC+3 пользователь Jeff Potts написал:
If you or your team are looking for a gentle intro to Alfresco's Advanced Workflows you might want to check out my new tutorial. It covers Activiti and configuring the workflow in the Share UI.

Enjoy!

Jeff

--
You received this message because you are subscribed to the Google Groups "Alfresco Technical Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alfresco-technical-discussion+unsub...@googlegroups.com.

Igor Blanco

unread,
Jan 13, 2015, 3:39:28 AM1/13/15
to alfresco-techn...@googlegroups.com
I solve this in a maybe to "intricated" way, but the result is quite nice.

I define a bean called WhateverProcessHelper and when I define it in the context file I inject the workflow bearegistry to it:

<bean id="whateverProcessHelper" class="com.example.workflow.WhateverProcessHelper" init-method="init">
        <property name="beanRegistry" ref="activitiBeanRegistry" />
        <property name="serviceRegistry" ref="ServiceRegistry" />
    </bean>

In the init method of the bean I do:

    public void init()
    {
        this.beanRegistry.put(this.name, this);
    }

That way the bean is visible for Activiti workflows and I can use it as a regular expression.

For example in the bean I have a method like this:

    public boolean packageHasContent(ActivitiScriptNode packageActivitiScriptNode) {
        WorkflowService workflowService = serviceRegistry.getWorkflowService();
        List<NodeRef> packageContents = workflowService.getPackageContents(packageActivitiScriptNode.getNodeRef());
        return (packageContents.size() > 0);
    }

And if I want to use it in a transition condition I just define the transition like:

<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="ExclusiveGateway_1" targetRef="initializeProcess">
      <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">${whateverProcessHelper.packageHasContent(bpm_package)}</bpmn2:conditionExpression>
    </bpmn2:sequenceFlow>
      
Of course you can use the same technic in service tasks:

    <bpmn2:serviceTask id="processApprovedDocumentServiceTask" activiti:expression="${whateverProcessHelper.processApprovedDocument(execution, bpm_package)}" name="Process approved document">
      <bpmn2:incoming>noNextApproverSequence</bpmn2:incoming>
      <bpmn2:outgoing>SequenceFlow_20</bpmn2:outgoing>
    </bpmn2:serviceTask>

It might not be the expected way of injecting code in the workflow but it works great and allows an easy integration with other beans and services. It also is good because this way you can consider the processHelper bean as the entry point for the workflow related tasks and have IMHO a clearer organization of code.

Give it a try and I think you won't regreat.

To unsubscribe from this group and stop receiving emails from it, send an email to alfresco-technical-d...@googlegroups.com.

To post to this group, send email to alfresco-techn...@googlegroups.com.
Visit this group at http://groups.google.com/group/alfresco-technical-discussion.
For more options, visit https://groups.google.com/d/optout.



--
Igor Blanco González
Binovo IT Human Project
e-mail: ibl...@binovo.es
Telf. :   943493611
Dirección:
                         Astigarraga Bidea 2
                          Planta 6. - Ofi. 3-2 
                    20180 Oiartzun ( Gipuzkoa )

Михаил Никитин

unread,
Jan 13, 2015, 4:15:08 AM1/13/15
to alfresco-techn...@googlegroups.com

it seem to be no easy way to access it from the other java method but for calling it from the user task or other diagram object. Can't it be accessed by name like in the example I've provided with the "companyHome"?
вторник, 13 января 2015 г., 11:39:28 UTC+3 пользователь Igor Blanco написал:

Михаил Никитин

unread,
Jan 14, 2015, 3:22:38 AM1/14/15
to alfresco-techn...@googlegroups.com
look, for the <property name="serviceRegistry" ref="ServiceRegistry" /> We initialize a variable of org.alfresco.service.ServiceRegistry type/class. And what type shall I use for the activitiBeanRegistry?


вторник, 13 января 2015 г., 11:39:28 UTC+3 пользователь Igor Blanco написал:
I solve this in a maybe to "intricated" way, but the result is quite nice.

Igor Blanco

unread,
Jan 14, 2015, 4:54:12 AM1/14/15
to alfresco-techn...@googlegroups.com
private Map<Object, Object> beanRegistry;

To unsubscribe from this group and stop receiving emails from it, send an email to alfresco-technical-d...@googlegroups.com.

To post to this group, send email to alfresco-techn...@googlegroups.com.
Visit this group at http://groups.google.com/group/alfresco-technical-discussion.
For more options, visit https://groups.google.com/d/optout.

Михаил Никитин

unread,
Jan 14, 2015, 6:01:36 AM1/14/15
to alfresco-techn...@googlegroups.com
I defined the following bean:
<bean id="TransformationHandler" class="org.alfresco.transformation.TransformationHandler" parent="baseJavaDelegate" lazy-init="default" autowire="default" dependency-check="default">
 <property name="nodeService" ref="NodeService" />
      <property name="nodeLocatorService" ref="nodeLocatorService" />
      <property name="beanRegistry" ref="activitiBeanRegistry" />
      <property name="serviceRegistry" ref="ServiceRegistry" />
</bean>

then added setters to the TransformationHandler, added this code:
@Override
public void execute(DelegateExecution arg0) throws Exception {
     this.beanRegistry.put(this.name, this);

as the execute is the start method. Name, as I understand is the String variable;
then created method 
public void startProcess(ActivitiScriptNode packageNode){
}
wich contents the main code.
in the diagram I assigned this method to the service task:

 <serviceTask id="servicetask1" name="Service Task" activiti:expression="${TransformationHandler.startProcess(bpm_package)}"></serviceTask>

the workflow model has this:
type name="scwf:submitTestTask">
            <parent>bpm:startTask</parent>
            <overrides>
            <property name="bpm:packageItemActionGroup">
            <default>edit_and_remove_package_item_actions</default>
            </property>
            </overrides>            
        </type> 
and during the execution I have the following error 
  • A system error happened during the operation: Error while evaluating expression: ${TransformationHandler.startProcess(bpm_package)}

What is my mistake or what I have lost? I can't move further without this part
среда, 14 января 2015 г., 12:54:12 UTC+3 пользователь Igor Blanco написал:

Igor Blanco

unread,
Jan 14, 2015, 6:16:59 AM1/14/15
to alfresco-techn...@googlegroups.com
Don't know why you are mixing a javadelegate to do this, you don't need a java delegate to do what I explained to you a simple POJO will do the trick as long as register by calling the proper init method. Are you sure "execute" is being executed ?

"this.name" contains the name of the bean but only if you declare your class as implementing BeanNameAware and create a setter for field "name".


To unsubscribe from this group and stop receiving emails from it, send an email to alfresco-technical-d...@googlegroups.com.

To post to this group, send email to alfresco-techn...@googlegroups.com.
Visit this group at http://groups.google.com/group/alfresco-technical-discussion.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages