06-06-2014 08:54 PM
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:pengesahan">
<swimlane name="initiator" />
<start-state name="start">
<task name="wf:submitGroupReviewTask" swimlane="initiator" />
<transition name="" to="review" />
</start-state>
<swimlane name="reviewer">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<pooledactors>#{bpm_groupAssignee}</pooledactors>
</assignment>
</swimlane>
<task-node name="review">
<timer name="emailReminderTimer" duedate="8 minutes">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
logger.log("send email");
var mail = actions.create("mail");
var node = people.getGroup(bpm_groupAssignee);
if(node)
{
var members = people.getMembers(node);
}
mail.parameters.subject=bpm_mailSubject;
mail.parameters.text=bpm_mailText;
mail.parameters.from = "alfrescousername@gmail.com";
for(var i=0;i < members.length;i++)
{
mail.parameters.to = members.properties.email;
mail.execute(bpm_package);
}
</script>
</action>
</timer>
<task name="wf:reviewTask" swimlane="reviewer">
<event type="task-create">
<script>
if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
</script>
</event>
<event type="task-end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
<variable name="bpm_assignee" access="write"/>
<expression>
if (taskInstance.actorId != null)
people.getPerson(taskInstance.actorId);
else
person;
</expression>
</script>
</action>
</event>
</task>
<transition name="Approve" to="approved"/>
<transition name="Reject" to="rejected"/>
</task-node>
<task-node name="rejected">
<transition name="" to="end" >
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<runas>admin</runas>
<script>
logger.log("reject");
var dest = companyhome.childByNamePath(bpm_rejectDestination);
for (var i = 0 ; i < bpm_package.children.length; i++)
{
bpm_package.children.move(dest);
}
</script>
</action>
</transition>
</task-node>
<task-node name="approved">
<transition name="" to="end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<runas>admin</runas>
<script>
if(bpm_package.children[0].mimetype!="application/pdf")
{
var contentPdf = bpm_package.children[0].transformDocument("application/pdf",dest);
}
else
{
logger.log("pdf");
var contentCopy = bpm_package.children[0].copy(dest);
}
</script>
</action>
</transition>
</task-node>
<end-state name="end" />
</process-definition>
<?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="parallel.workflowBootstrap" parent="workflowDeployer">
<property name="workflowDefinitions">
<list>
<props>
<prop key="engineId">jbpm</prop>
<prop key="location">
alfresco/extension/pengesahan_processdefinition.xml
</prop>
<prop key="mimetype">text/xml</prop>
<prop key="redeploy">true</prop>
</props>
</list>
</property>
</bean>
</beans>
var workflow = actions.create("start-workflow");
workflow.parameters.workflowName = "jbpm$wf:pengesahan";
workflow.parameters["bpm:workflowDescription"] = "Proses pengesahan dokumen : "+document.properties.name;
workflow.parameters["bpm:groupAssignee"] = "GROUP_KETUA URUSETIA SEKRETARIAT";
workflow.parameters["bpm:approveDestination"] = "Sites/ar-rahnutest/documentLibrary/PAPARAN";
workflow.parameters["bpm:rejectDestination"] = "Sites/ar-rahnutest/documentLibrary/TIDAK DILULUSKAN";
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 3);
workflow.parameters["bpm:workflowDueDate"] = futureDate;
workflow.parameters["bpm:workflowPriority"]="2";
workflow.parameters["bpm:mailSubject"]="Peringatan : Sila lakukan pengesahan";
workflow.execute(document);
06-06-2014 10:52 PM
06-07-2014 08:51 PM
06-07-2014 11:47 PM
var wfdef = workflow.getDefinitionByName("jbpm$wf:pengesahan");
logger.getSystem().out(wfdef.getName());
var wfparams = new Object();
wfparams["bpm:workflowDescription"] = "Proses pengesahan dokumen : "+document.properties.name;
wfparams["bpm:groupAssignee"] = "GROUP_KETUA URUSETIA SEKRETARIAT";
wfparams["bpm:approveDestination"] = "Sites/ar-rahnutest/documentLibrary/PAPARAN";
wfparams["bpm:rejectDestination"] = "Sites/ar-rahnutest/documentLibrary/TIDAK DILULUSKAN";
var futureDate = new Date();
futureDate.setDate(futureDate.getDate() + 3);
wfparams["bpm:workflowDueDate"] = futureDate;
wfparams["bpm:workflowPriority"]="2";
wfparams["bpm:mailSubject"]="Peringatan : Sila lakukan pengesahan";
var wfpackage = workflow.createPackage();
wfpackage.addNode(document);
wfdef.startWorkflow(wfpackage,wfparams);
06-10-2014 02:53 AM
06-09-2014 01:47 AM
06-10-2014 02:47 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.