public Process startProcess(ProcessDefinition processDefinition,
List<Person> assignees, Map<String, Serializable> variables, List<Node>
items) creates and starts a new process.
Attention: This method was introduced in SDK version 1.3.
Parameters
- ProcessDefinition processDefinition
- The process definition.
- List <Person> assignees
- List of people to assign to the workflow.
- Map<String, Serializable> variables
- Variables.
- List<Node> items
- Items.
Returns
A Process object representing the newly created and started process.
Example
Quickly start a process with minimal configuration:
WorkflowService workflowService = alfsession.getServiceRegistry().getWorkflowService(); // Process Definition ProcessDefinition def = workflowService.getProcessDefinition(WorkflowModel.KEY_ADHOC_ACTIVITI); // Assignee Person user = alfsession.getServiceRegistry().getPersonService().getPerson(alfsession.getPersonIdentifier()); List<Person> users = new ArrayList<Person>(); users.add(user); // Start Process : Prepare Variables Map<String, Serializable> variables = new HashMap<String, Serializable>(); variables.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, DESCRIPTION); // START THE PROCESS Process adhocProcess = workflowService.startProcess(def, users, variables, null);
Start a process with a collection of variables:
// Start Process : Prepare Variables Map<String, Serializable> variables = new HashMap<String, Serializable>(); // Process Definition ProcessDefinition def = getProcessDefinition(getAdHocWorkflowkey()); // Assignee Person user = alfsession.getServiceRegistry().getPersonService().getPerson(alfsession.getPersonIdentifier()); List<Person> users = new ArrayList<Person>(); users.add(user); // Items - Attachments Document doc = (Document) alfsession.getServiceRegistry().getDocumentFolderService() .getChildByPath(SAMPLE_DATAPATH_WORKFLOW); List<Document> docs = new ArrayList<Document>(); docs.add(doc); // Due date GregorianCalendar calendar = new GregorianCalendar(); calendar.set(Calendar.YEAR, 2000); variables.put(WorkflowModel.PROP_WORKFLOW_DUE_DATE, DateUtils.format(calendar)); // Priority variables.put(WorkflowModel.PROP_WORKFLOW_PRIORITY, WorkflowModel.PRIORITY_HIGH); // Description variables.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, DESCRIPTION); // Notification variables.put(WorkflowModel.PROP_SEND_EMAIL_NOTIFICATIONS, "true"); // START THE PROCESS Process adhocProcess = workflowService.startProcess(def, users, variables, docs);