Advertisement
Guest User

myworkflow.bpmn

a guest
Sep 28th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.73 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <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">
  3. <process id="helloWorldUI" name="Hello World UI" isExecutable="true">
  4. <startEvent id="startevent1" name="Start" activiti:formKey="scwf:submitHelloWorldTask"></startEvent>
  5. <endEvent id="endevent1" name="End"></endEvent>
  6. <userTask id="alfrescoUsertask1" name="Alfresco User Task" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:activitiReviewTask">
  7. <extensionElements>
  8. <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
  9. <activiti:field name="script">
  10. <activiti:string><![CDATA[execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));]]></activiti:string>
  11. </activiti:field>
  12. </activiti:taskListener>
  13. </extensionElements>
  14. </userTask>
  15. <serviceTask id="alfrescoScripttask1" name="Alfresco Script Task" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
  16. <extensionElements>
  17. <activiti:field name="script">
  18. <activiti:string><![CDATA[ var docList = "\t";
  19. for (var i = 0; i &lt; bpm_package.children.length; i++)
  20. {
  21. docList += bpm_package.children[i].displayPath + "/" + bpm_package.children[i].properties["cm:name"] + "\n\t";
  22.  
  23. bpm_package.children[i].properties["ks:status"] = "Approved";
  24. bpm_package.children[i].properties["ks:reviewComment"] = kswf_comment;
  25. bpm_package.children[i].save();
  26.  
  27. var workingCopy = bpm_package.children[i].checkout();
  28. workingCopy.checkin("Document approved by " + bpm_assignee.properties["cm:userName"], true);
  29.  
  30. /* get name without extension */
  31. var cmname = bpm_package.children[i].properties["cm:name"];
  32. var idx = cmname.length - 1;
  33. if(cmname.lastIndexOf(".") > 0)
  34. {
  35. idx = cmname.lastIndexOf(".");
  36. }
  37. var docname = cmname.substr(0, idx);
  38.  
  39. /* find space where released documents live */
  40. var drafts = bpm_package.children[i].parent;
  41. var docroot = drafts.parent;
  42. var dest = docroot.childByNamePath("Released");
  43.  
  44. /* see if document was created previously. if not, do initial version bump */
  45. var transdoc = dest.childByNamePath(docname + ".pdf");
  46. var bumpver = false;
  47. if(transdoc == null)
  48. {
  49. bumpver = true;
  50. }
  51.  
  52. /* transform to pdf */
  53. var trans = actions.create("transform");
  54. trans.parameters["destination-folder"] = dest;
  55. trans.parameters["assoc-type"] = "{http://www.alfresco.org/model/content/1.0}contains";
  56. trans.parameters["assoc-name"] = "{http://www.alfresco.org/model/content/1.0}" + bpm_package.children[i].properties["cm:name"];
  57. trans.parameters["mime-type"] = "application/pdf";
  58. trans.execute(bpm_package.children[i]);
  59.  
  60. /* update properties */
  61. transdoc = dest.childByNamePath(docname + ".pdf");
  62. if(transdoc != null)
  63. {
  64. if(bumpver == true)
  65. {
  66. workingCopy = transdoc.checkout();
  67. workingCopy.checkin("Initial version.", true);
  68. }
  69. workingCopy = transdoc.checkout();
  70. workingCopy.properties["ks:status"] = "Approved";
  71. workingCopy.properties["ks:reviewComment"] = kswf_comment;
  72. workingCopy.save();
  73. workingCopy.checkin("Document approved by " + bpm_assignee.properties["cm:userName"], true);
  74. }
  75. }
  76. var email = actions.create("mail");
  77. email.parameters.subject = "Alfresco Task Update: Approved";
  78. email.parameters.to = initiator.properties["cm:email"];
  79. email.parameters.from = "alfresco@kses.net";
  80. email.parameters.text = "The following documents were approved by \"" + bpm_assignee.properties["cm:userName"] + "\":\n\n" + docList;
  81. email.parameters.text += "\nComments:\n" + kswf_comment;
  82. email.execute(bpm_package);]]></activiti:string>
  83. </activiti:field>
  84. </extensionElements>
  85. </serviceTask>
  86. <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="alfrescoUsertask1">
  87. <extensionElements>
  88. <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
  89. <activiti:field name="script">
  90. <activiti:string><![CDATA[logger.log("Hello, " + scwf_helloName + "!");]]></activiti:string>
  91. </activiti:field>
  92. </activiti:executionListener>
  93. </extensionElements>
  94. </sequenceFlow>
  95. <sequenceFlow id="flow2" sourceRef="alfrescoUsertask1" targetRef="alfrescoScripttask1"></sequenceFlow>
  96. <sequenceFlow id="flow3" sourceRef="alfrescoScripttask1" targetRef="endevent1"></sequenceFlow>
  97. </process>
  98. <bpmndi:BPMNDiagram id="BPMNDiagram_helloWorldUI">
  99. <bpmndi:BPMNPlane bpmnElement="helloWorldUI" id="BPMNPlane_helloWorldUI">
  100. <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
  101. <omgdc:Bounds height="35.0" width="35.0" x="100.0" y="200.0"></omgdc:Bounds>
  102. </bpmndi:BPMNShape>
  103. <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
  104. <omgdc:Bounds height="35.0" width="35.0" x="470.0" y="200.0"></omgdc:Bounds>
  105. </bpmndi:BPMNShape>
  106. <bpmndi:BPMNShape bpmnElement="alfrescoUsertask1" id="BPMNShape_alfrescoUsertask1">
  107. <omgdc:Bounds height="55.0" width="105.0" x="180.0" y="190.0"></omgdc:Bounds>
  108. </bpmndi:BPMNShape>
  109. <bpmndi:BPMNShape bpmnElement="alfrescoScripttask1" id="BPMNShape_alfrescoScripttask1">
  110. <omgdc:Bounds height="55.0" width="105.0" x="320.0" y="190.0"></omgdc:Bounds>
  111. </bpmndi:BPMNShape>
  112. <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
  113. <omgdi:waypoint x="135.0" y="217.0"></omgdi:waypoint>
  114. <omgdi:waypoint x="180.0" y="217.0"></omgdi:waypoint>
  115. </bpmndi:BPMNEdge>
  116. <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
  117. <omgdi:waypoint x="285.0" y="217.0"></omgdi:waypoint>
  118. <omgdi:waypoint x="320.0" y="217.0"></omgdi:waypoint>
  119. </bpmndi:BPMNEdge>
  120. <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
  121. <omgdi:waypoint x="425.0" y="217.0"></omgdi:waypoint>
  122. <omgdi:waypoint x="470.0" y="217.0"></omgdi:waypoint>
  123. </bpmndi:BPMNEdge>
  124. </bpmndi:BPMNPlane>
  125. </bpmndi:BPMNDiagram>
  126. </definitions>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement