Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="UTF-8"?>
- <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">
- <process id="helloWorldUI" name="Hello World UI" isExecutable="true">
- <startEvent id="startevent1" name="Start" activiti:formKey="scwf:submitHelloWorldTask"></startEvent>
- <endEvent id="endevent1" name="End"></endEvent>
- <userTask id="alfrescoUsertask1" name="Alfresco User Task" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:activitiReviewTask">
- <extensionElements>
- <activiti:taskListener event="complete" class="org.alfresco.repo.workflow.activiti.tasklistener.ScriptTaskListener">
- <activiti:field name="script">
- <activiti:string><![CDATA[execution.setVariable('wf_reviewOutcome', task.getVariable('wf_reviewOutcome'));]]></activiti:string>
- </activiti:field>
- </activiti:taskListener>
- </extensionElements>
- </userTask>
- <serviceTask id="alfrescoScripttask1" name="Alfresco Script Task" activiti:class="org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate">
- <extensionElements>
- <activiti:field name="script">
- <activiti:string><![CDATA[ var docList = "\t";
- for (var i = 0; i < bpm_package.children.length; i++)
- {
- docList += bpm_package.children[i].displayPath + "/" + bpm_package.children[i].properties["cm:name"] + "\n\t";
- bpm_package.children[i].properties["ks:status"] = "Approved";
- bpm_package.children[i].properties["ks:reviewComment"] = kswf_comment;
- bpm_package.children[i].save();
- var workingCopy = bpm_package.children[i].checkout();
- workingCopy.checkin("Document approved by " + bpm_assignee.properties["cm:userName"], true);
- /* get name without extension */
- var cmname = bpm_package.children[i].properties["cm:name"];
- var idx = cmname.length - 1;
- if(cmname.lastIndexOf(".") > 0)
- {
- idx = cmname.lastIndexOf(".");
- }
- var docname = cmname.substr(0, idx);
- /* find space where released documents live */
- var drafts = bpm_package.children[i].parent;
- var docroot = drafts.parent;
- var dest = docroot.childByNamePath("Released");
- /* see if document was created previously. if not, do initial version bump */
- var transdoc = dest.childByNamePath(docname + ".pdf");
- var bumpver = false;
- if(transdoc == null)
- {
- bumpver = true;
- }
- /* transform to pdf */
- var trans = actions.create("transform");
- trans.parameters["destination-folder"] = dest;
- trans.parameters["assoc-type"] = "{http://www.alfresco.org/model/content/1.0}contains";
- trans.parameters["assoc-name"] = "{http://www.alfresco.org/model/content/1.0}" + bpm_package.children[i].properties["cm:name"];
- trans.parameters["mime-type"] = "application/pdf";
- trans.execute(bpm_package.children[i]);
- /* update properties */
- transdoc = dest.childByNamePath(docname + ".pdf");
- if(transdoc != null)
- {
- if(bumpver == true)
- {
- workingCopy = transdoc.checkout();
- workingCopy.checkin("Initial version.", true);
- }
- workingCopy = transdoc.checkout();
- workingCopy.properties["ks:status"] = "Approved";
- workingCopy.properties["ks:reviewComment"] = kswf_comment;
- workingCopy.save();
- workingCopy.checkin("Document approved by " + bpm_assignee.properties["cm:userName"], true);
- }
- }
- var email = actions.create("mail");
- email.parameters.subject = "Alfresco Task Update: Approved";
- email.parameters.to = initiator.properties["cm:email"];
- email.parameters.from = "alfresco@kses.net";
- email.parameters.text = "The following documents were approved by \"" + bpm_assignee.properties["cm:userName"] + "\":\n\n" + docList;
- email.parameters.text += "\nComments:\n" + kswf_comment;
- email.execute(bpm_package);]]></activiti:string>
- </activiti:field>
- </extensionElements>
- </serviceTask>
- <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="alfrescoUsertask1">
- <extensionElements>
- <activiti:executionListener event="start" class="org.alfresco.repo.workflow.activiti.listener.ScriptExecutionListener">
- <activiti:field name="script">
- <activiti:string><![CDATA[logger.log("Hello, " + scwf_helloName + "!");]]></activiti:string>
- </activiti:field>
- </activiti:executionListener>
- </extensionElements>
- </sequenceFlow>
- <sequenceFlow id="flow2" sourceRef="alfrescoUsertask1" targetRef="alfrescoScripttask1"></sequenceFlow>
- <sequenceFlow id="flow3" 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.0" width="35.0" x="100.0" y="200.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
- <omgdc:Bounds height="35.0" width="35.0" x="470.0" y="200.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape bpmnElement="alfrescoUsertask1" id="BPMNShape_alfrescoUsertask1">
- <omgdc:Bounds height="55.0" width="105.0" x="180.0" y="190.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape bpmnElement="alfrescoScripttask1" id="BPMNShape_alfrescoScripttask1">
- <omgdc:Bounds height="55.0" width="105.0" x="320.0" y="190.0"></omgdc:Bounds>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
- <omgdi:waypoint x="135.0" y="217.0"></omgdi:waypoint>
- <omgdi:waypoint x="180.0" y="217.0"></omgdi:waypoint>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
- <omgdi:waypoint x="285.0" y="217.0"></omgdi:waypoint>
- <omgdi:waypoint x="320.0" y="217.0"></omgdi:waypoint>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
- <omgdi:waypoint x="425.0" y="217.0"></omgdi:waypoint>
- <omgdi:waypoint x="470.0" y="217.0"></omgdi:waypoint>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
- </definitions>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement