12-06-2007 10:54 AM
….
// Get a list of workflow definitions and search through them for the one we want.
// Not sure if this is the best way to do this, but it seems to work.
List<WorkflowDefinition> workflowDefs = workflowService.getDefinitions();
Iterator<WorkflowDefinition> workflowDefsIterator = workflowDefs.iterator();
WorkflowDefinition workflowDef = null;
// Get a handle to the required workflow.
while (workflowDefsIterator.hasNext()) {
workflowDef = workflowDefsIterator.next();
if (workflowDef.name.equals(JBPM_WORKFLOW_NAME)) {
break;
}
}
// If we did not find the workflow error.
if (!workflowDef.name.equals(JBPM_WORKFLOW_NAME)) {
return;
}
// Add the files to the workflow.
// First create the workflow, passing a null since this seems to be the most appropriate.
NodeRef workflowNodeRef = workflowService.createPackage(null);
for (int x = 0; x < fileList.length; x++) {
nodeService.addChild(workflowNodeRef, fileRefs[x], ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_PREFIX, "Advert within the workflow package"));
}
// Finally kick the workflow off.
Map<QName, Serializable> parameters = new HashMap<QName, Serializable>();
parameters.put(WorkflowModel.ASSOC_PACKAGE, workflowNodeRef);
parameters.put(WorkflowModel.ASSOC_ASSIGNEE, "GROUP_NameOfPool");
parameters.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, new Date(System.currentTimeMillis() + DUE_HOURS.getTime()));
parameters.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, "Name of task");
WorkflowPath path = workflowService.startWorkflow(workflowDef.id, parameters);
….
12-06-2007 11:06 AM
<swimlane name="marketing">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<pooledactors>#{people.getGroup('GROUP_marketing')}</pooledactors>
</assignment>
</swimlane>12-06-2007 11:17 AM
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="mywf:my_workflow">
<!– ======================================================================= –>
<!– Swimlanes for the different users the user may touch. –>
<swimlane name="readers">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<pooledactors>
#{people.getGroup('GROUP_NameOfPool')}
</pooledactors>
</assignment>
</swimlane>
<swimlane name="artists">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<pooledactors>
#{people.getGroup('GROUP_NameOfOtherPool')}
</pooledactors>
</assignment>
</swimlane>
<swimlane name="initiator">
<assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
<pooledactors>
#{people.getGroup('GROUP_NameOfYetOtherPool')}
</pooledactors>
</assignment>
</swimlane>
<!– ======================================================================= –>
<!– States the job goes through. –>
<start-state name="Start">
<task name="mywf:createTask" swimlane="artists"/>
<transition name="Send To Reader" to="Reading"></transition>
</start-state>
<task-node name="Reading">
<task name="mywf:readingTask" swimlane="readers"/>
<transition name="Finished Job" to="Approved"></transition>
<transition name="Send To Artist For Amend" to="Amend"></transition>
</task-node>
<task-node name="Amend">
<task name="mywf:amendTask" swimlane="artists"/>
<transition name="Return To Reader" to="Reading"></transition>
</task-node>
<end-state name="Approved" />
<event type="process-end">
<action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
<script>
logger.log("End of process. Cancelled: " + cancelled);
</script>
</action>
</event>
<!– ======================================================================= –>
</process-definition>
12-07-2007 11:22 AM
03-28-2008 05:17 AM
04-02-2008 04:11 AM
04-02-2008 04:34 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.