07-05-2013 03:08 PM
$ curl -v -X DELETE -u admin http://.../activiti-rest/service/runtime/process-instances/1401
HTTP/1.1 204 No Content
$ curl -v -u admin http://.../activiti-rest/service/runtime/process-instances/1401
HTTP/1.1 200 OK
{
"id": "1401",
"url": "http://.../activiti-rest/service/runtime/process-instances/1401",
"businessKey": null,
"suspended": false,
"processDefinitionId": "process:2:1206",
"processDefinitionUrl": "http://.../activiti-rest/service/repository/process-definitions/process%3A2%3A1206",
"activityId": "checkRequest",
"variables": []
}
07-05-2013 05:05 PM
07-09-2013 04:11 AM
@Delete
public void deleteProcessInstance() {
if(!authenticate()) {
return;
}
ProcessInstance processInstance = getProcessInstanceFromRequest();
String deleteReason = getQueryParameter("deleteReason", getQuery());
ActivitiUtil.getRuntimeService().deleteProcessInstance(processInstance.getId(), deleteReason);
setStatus(Status.SUCCESS_NO_CONTENT);
}
Very straight-forward call to the JAVA-API. We also have test-coverage for this. I'm guessing there is something wrong with the way transaction are handled in your rest-app…
/**
* Test deleting a single process instance.
*/
@Deployment(resources = {"org/activiti/rest/api/runtime/ProcessInstanceResourceTest.process-one.bpmn20.xml"})
public void testDeleteProcessInstance() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("processOne", "myBusinessKey");
ClientResource client = getAuthenticatedClient(RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_INSTANCE, processInstance.getId()));
client.delete();
assertEquals(Status.SUCCESS_NO_CONTENT, client.getResponse().getStatus());
// Check if process-instance is gone
assertEquals(0, runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).count());
}
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.