You learn how to delete a workflow process.
It is assumed you have completed the other workflow tutorials in this section.
Once a workflow process has been started it may be deleted at any time.
- Log into the SkyVault Share interface.
-
Check the number of workflow process tasks currently listed, or, if the tasks are no
longer needed, delete them all (you can do this by clicking on View
Workflow, and then clicking Cancel Workflow).
The main reason for doing this step is to make sure that when the following code is run, it does not result in a new workflow process being listed. The code actually creates a process as before, and then immediately deletes it (along with its associated tasks).
-
In the project you worked on previously, replace the createWorkflow
method with the following code. This code sets up a workflow process, starts it, and then
deletes it:
- (void) createWorkflow { NSLog(@"*********** createWorkflow"); // create service SkyVaultWorkflowService *workflowService = [[AlfrescoWorkflowService alloc] initWithSession:self.session]; // list process definitions available [workflowService retrieveProcessDefinitionsWithCompletionBlock:^(NSArray *array, NSError *error) { if (array == nil) { NSLog(@"Failed to retrieve process definitions: %@", error); } // for each item in the array print out some information for (AlfrescoWorkflowProcessDefinition *pd in array) { NSLog(@"---> Identifier: %@\n", pd.identifier); NSLog(@"---> Key: %@\n", pd.key); NSLog(@"---> Name: %@\n", pd.name); NSLog(@"---> Summary: %@\n", pd.summary); NSLog(@"---> Version: %@\n", pd.version); } }]; // retrieve process definition for activitiAdhoc:1:4 NSString *processDefinitionID = @"activitiAdhoc:1:4"; [workflowService retrieveProcessDefinitionWithIdentifier:processDefinitionID completionBlock:^(AlfrescoWorkflowProcessDefinition *processDefinition, NSError *error){ if (processDefinition == nil) { NSLog(@"Failed to retrieve process definition: %@", error); } else { // start process [workflowService startProcessForProcessDefinition:processDefinition assignees:nil variables:nil attachments:nil completionBlock:^(AlfrescoWorkflowProcess *process, NSError *error){ NSLog(@"---> Process created!\n"); NSLog(@"---> identifier: %@\n", process.identifier); NSLog(@"---> processDefinitionIdentifier: %@\n", process.processDefinitionIdentifier); NSLog(@"---> processDefinitionKey: %@\n", process.processDefinitionKey); NSLog(@"---> name: %@\n", process.name); NSLog(@"---> startedAt: %@\n", process.startedAt); NSLog(@"---> endedAt: %@\n", process.endedAt); NSLog(@"---> dueAt: %@\n", process.dueAt); NSLog(@"---> priority: %@\n", process.priority); NSLog(@"---> summary: %@\n", process.summary); NSLog(@"---> initiatorUsername: %@\n", process.initiatorUsername); // Get tasks for process [workflowService retrieveTasksForProcess:process completionBlock:^(NSArray *array, NSError *error){ for (AlfrescoWorkflowTask *task in array) { NSLog(@"---> Task information:\n"); NSLog(@"---> identifier: %@\n", task.identifier); NSLog(@"---> processIdentifier: %@\n", task.processIdentifier); NSLog(@"---> processDefinitionIdentifier: %@\n", task.processDefinitionIdentifier); NSLog(@"---> name: %@\n", task.name); NSLog(@"---> type: %@\n", task.type); NSLog(@"---> startedAt: %@\n", task.startedAt); NSLog(@"---> endedAt: %@\n", task.endedAt); NSLog(@"---> dueAt: %@\n", task.dueAt); NSLog(@"---> summary: %@\n", task.summary); NSLog(@"---> priority: %@\n", task.priority); NSLog(@"---> assigneeIdentifier: %@\n", task.assigneeIdentifier); } }]; // Now delete process [workflowService deleteProcess:process completionBlock:^(BOOL succeeded, NSError *error){ if (succeeded) { NSLog(@"#### Process deleted!\n"); } else { NSLog(@"#### Failed to delete process with %@\n", error); } }]; }]; } }]; }
- Build and run your code.
-
Examine the log messages in the Xcode output window:
2014-04-24 10:16:11.339 HelloRepo[14815:60b] *********** helloFromRepository 2014-04-24 10:16:11.566 HelloRepo[14815:60b] Authenticated successfully 2014-04-24 10:16:11.567 HelloRepo[14815:60b] Repository version: 4.2.1 (r63452-b50) 2014-04-24 10:16:11.567 HelloRepo[14815:60b] Repository edition: Enterprise 2014-04-24 10:16:11.567 HelloRepo[14815:60b] *********** createWorkflow 2014-04-24 10:16:11.582 HelloRepo[14815:60b] ---> Identifier: activitiAdhoc:1:4 2014-04-24 10:16:11.582 HelloRepo[14815:60b] ---> Key: activitiAdhoc 2014-04-24 10:16:11.582 HelloRepo[14815:60b] ---> Name: New Task 2014-04-24 10:16:11.583 HelloRepo[14815:60b] ---> Summary: Assign a new task to yourself or a colleague 2014-04-24 10:16:11.583 HelloRepo[14815:60b] ---> Version: 1 2014-04-24 10:16:11.583 HelloRepo[14815:60b] ---> Identifier: activitiParallelGroupReview:1:20 2014-04-24 10:16:11.583 HelloRepo[14815:60b] ---> Key: activitiParallelGroupReview 2014-04-24 10:16:11.583 HelloRepo[14815:60b] ---> Name: Group Review And Approve 2014-04-24 10:16:11.584 HelloRepo[14815:60b] ---> Summary: Group review and approval of content using Activiti workflow engine 2014-04-24 10:16:11.584 HelloRepo[14815:60b] ---> Version: 1 2014-04-24 10:16:11.584 HelloRepo[14815:60b] ---> Identifier: activitiParallelReview:1:16 2014-04-24 10:16:11.584 HelloRepo[14815:60b] ---> Key: activitiParallelReview 2014-04-24 10:16:11.584 HelloRepo[14815:60b] ---> Name: Send Document(s) For Review 2014-04-24 10:16:11.584 HelloRepo[14815:60b] ---> Summary: Request document approval from one or more colleagues 2014-04-24 10:16:11.585 HelloRepo[14815:60b] ---> Version: 1 2014-04-24 10:16:11.585 HelloRepo[14815:60b] ---> Identifier: activitiReview:1:8 2014-04-24 10:16:11.585 HelloRepo[14815:60b] ---> Key: activitiReview 2014-04-24 10:16:11.585 HelloRepo[14815:60b] ---> Name: Review And Approve 2014-04-24 10:16:11.585 HelloRepo[14815:60b] ---> Summary: Review and approval of content using Activiti workflow engine 2014-04-24 10:16:11.586 HelloRepo[14815:60b] ---> Version: 1 2014-04-24 10:16:11.586 HelloRepo[14815:60b] ---> Identifier: activitiReviewPooled:1:12 2014-04-24 10:16:11.586 HelloRepo[14815:60b] ---> Key: activitiReviewPooled 2014-04-24 10:16:11.586 HelloRepo[14815:60b] ---> Name: Pooled Review And Approve 2014-04-24 10:16:11.586 HelloRepo[14815:60b] ---> Summary: Pooled review and approval of content using Activiti workflow engine 2014-04-24 10:16:11.586 HelloRepo[14815:60b] ---> Version: 1 2014-04-24 10:16:11.711 HelloRepo[14815:60b] ---> Process created! 2014-04-24 10:16:11.711 HelloRepo[14815:60b] ---> identifier: 150 2014-04-24 10:16:11.711 HelloRepo[14815:60b] ---> processDefinitionIdentifier: activitiAdhoc:1:4 2014-04-24 10:16:11.711 HelloRepo[14815:60b] ---> processDefinitionKey: activitiAdhoc 2014-04-24 10:16:11.711 HelloRepo[14815:60b] ---> name: (null) 2014-04-24 10:16:11.712 HelloRepo[14815:60b] ---> startedAt: 2014-04-24 09:16:11 +0000 2014-04-24 10:16:11.712 HelloRepo[14815:60b] ---> endedAt: (null) 2014-04-24 10:16:11.712 HelloRepo[14815:60b] ---> dueAt: (null) 2014-04-24 10:16:11.713 HelloRepo[14815:60b] ---> priority: 2 2014-04-24 10:16:11.713 HelloRepo[14815:60b] ---> summary: (null) 2014-04-24 10:16:11.713 HelloRepo[14815:60b] ---> initiatorUsername: admin 2014-04-24 10:16:11.724 HelloRepo[14815:60b] ---> Task information: 2014-04-24 10:16:11.725 HelloRepo[14815:60b] ---> identifier: 192 2014-04-24 10:16:11.725 HelloRepo[14815:60b] ---> processIdentifier: 150 2014-04-24 10:16:11.725 HelloRepo[14815:60b] ---> processDefinitionIdentifier: activitiAdhoc:1:4 2014-04-24 10:16:11.725 HelloRepo[14815:60b] ---> name: Adhoc Task 2014-04-24 10:16:11.725 HelloRepo[14815:60b] ---> type: wf:adhocTask 2014-04-24 10:16:11.726 HelloRepo[14815:60b] ---> startedAt: 2014-04-24 09:16:11 +0000 2014-04-24 10:16:11.726 HelloRepo[14815:60b] ---> endedAt: (null) 2014-04-24 10:16:11.726 HelloRepo[14815:60b] ---> dueAt: (null) 2014-04-24 10:16:11.726 HelloRepo[14815:60b] ---> summary: Adhoc Task 2014-04-24 10:16:11.726 HelloRepo[14815:60b] ---> priority: 2 2014-04-24 10:16:11.726 HelloRepo[14815:60b] ---> assigneeIdentifier: admin 2014-04-24 10:16:11.751 HelloRepo[14815:60b] #### Process deleted! ...
- Log back into the SkyVault Share interface.
-
Click My Tasks from the main menu.
There should be no new tasks present, as the code created a process and then immediately deleted it.
You have seen how to delete a workflow process.