<?xml version="1.0" encoding="utf-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="scwf:test">
<!–Definition des swimlanes–>
<swimlane name="initiator">
</swimlane>
<swimlane name="assignee">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<actor>#{bpm_assignee}</actor>
</assignment>
</swimlane>
<!–Definition du processus–>
<start-state name="start">
<task name="scwf:submitReviewTask" swimlane="initiator"/>
<transition name="submit" to="Submit">
<action class="org.alfresco.repo.workflow.jbpm.AlfJavaScript">
<script>
<!–Find the Acceptance folder–>
var acceptanceFolder = companyhome.childByNamePath("Acceptance");
<!–If it doesn't exist, create it for the first time–>
if (acceptanceFolder == null){
acceptanceFolder = companyhome.createFolder("Acceptance");
}
if (acceptanceFolder != null){
var bpmpackage = bpm_package;
<!–get the file from where the workflow was started = the file one wants to move–>
var doc = bpmpackage.children[0];
doc.addAspect("cm:versionable");
doc.save();
doc.move(acceptanceFolder);
acceptanceFolder.setPermission("Delete");
<!– create mail action–>
var mail = actions.create("mail");
mail.parameters.to = initiator.properties["cm:email"];;
mail.parameters.subject = "Hello from JavaScript";
mail.parameters.from = bpm_assignee.properties["cm:email"];
mail.parameters.template = companyhome.childByNamePath("space/notify_user_email.ftl");
mail.parameters.text = "some text, in case template is not found";
<!–execute action against a document–>
mail.execute(doc);
}
</script>
</action>
</transition>
</start-state>
<node name="Submit">
<transition name="accepted" to="A Review"/>
</node>
<task-node name="A Review">
<task name="scwf:aReview" swimlane="assignee"/>
<transition name="approve" to="end1">
<action class="org.alfresco.repo.workflow.jbpm.AlfJavaScript">
<runas>admin</runas>
<script>
<!–Find the Acceptance folder–>
var validatedFolder = companyhome.childByNamePath("Validated");
<!–If it doesn't exist, create it for the first time–>
if (validatedFolder == null){
validatedFolder= companyhome.createFolder("Validated");
}
if (validatedFolder != null){
validatedFolder.setPermission("CreateChildren");
var bpmpackage = bpm_package;
<!–get the file from where the workflow was started = the file one wants to move–>
var doc = bpmpackage.children[0];
doc.move(validatedFolder);
}
</script>
</action>
</transition>
<transition name="reject" to="S Revision">
<action class="org.alfresco.repo.workflow.jbpm.AlfJavaScript">
<runas>admin</runas>
<script>
<!–Find the Acceptance folder–>
var workingFolder = companyhome.childByNamePath("Working");
<!–If it doesn't exist, create it for the first time–>
if (workingFolder == null){
workingFolder = companyhome.createFolder("Working");
}
if (workingFolder != null){
var bpmpackage = bpm_package;
<!–get the file from where the workflow was started = the file one wants to move–>
var doc = bpmpackage.children[0];
doc.move(workingFolder);
}
</script>
</action>
</transition>
</task-node>
<task-node name="S Revision">
<task name="scwf:sRevision" swimlane="assignee"/>
<transition name="Re-Submit" to="A Review">
<action class="org.alfresco.repo.workflow.jbpm.AlfJavaScript">
<script>
<!–Find the Acceptance folder–>
var acceptanceFolder = companyhome.childByNamePath("Acceptance");
<!–If it doesn't exist, create it for the first time–>
if (acceptanceFolder == null){
acceptanceFolder = companyhome.createFolder("Acceptance");
}
if (acceptanceFolder != null){
var bpmpackage = bpm_package;
<!–get the file from where the workflow was started = the file one wants to move–>
var doc = bpmpackage.children[0];
doc.move(acceptanceFolder);
}
</script>
</action>
</transition>
</task-node>
<end-state name="end1"/>
</process-definition>
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.