@Test public void deleteProcessInstance() throws Exception { String processInstanceId = "processInstanceId"; String deleteReason = "TERMINATED"; String parentId = "parentId"; String userId = "userId"; mockTaskDao.deleteProcessInstance(eq(parentId), eq(processInstanceId), eq(deleteReason), eq(mockAuthentication), eq(null)); expect(mockAuthentication.getName()).andReturn(userId).atLeastOnce(); replayAll(); MvcResult result = mockMvc.perform( post("/api/v1/plugin/task/deleteProcessInstance/{parentObjectId}/{processInstanceId}", parentId, processInstanceId) .accept(MediaType.parseMediaType("application/json;charset=UTF-8")) .session(mockHttpSession) .principal(mockAuthentication) .content(deleteReason)) .andReturn(); verifyAll(); assertEquals(HttpStatus.OK.value(), result.getResponse().getStatus()); }
@RequestMapping(value = "/deleteProcessInstance/{parentObjectId}/{processInstanceId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public void deleteProcessInstance( @PathVariable("parentObjectId") String parentObjectId, @PathVariable("processInstanceId") String processInstanceId, @RequestBody String deleteReason, Authentication authentication, HttpSession httpSession) throws AcmUserActionFailedException { log.info("User [{}] is deleting workflow process with ID [{}]", authentication.getName(), processInstanceId); try { String ipAddress = (String) httpSession.getAttribute("acm_ip_address"); getTaskDao().deleteProcessInstance(parentObjectId, processInstanceId, deleteReason, authentication, ipAddress); } catch (AcmTaskException e) { log.debug("failed deleting process instance with ID [{}]", processInstanceId); throw new AcmUserActionFailedException("delete", "process instance", Long.valueOf(processInstanceId), e.getMessage(), e); } }
DeleteProcessInstanceAPIController { @RequestMapping(value = "/deleteProcessInstance/{parentObjectId}/{processInstanceId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public void deleteProcessInstance( @PathVariable("parentObjectId") String parentObjectId, @PathVariable("processInstanceId") String processInstanceId, @RequestBody String deleteReason, Authentication authentication, HttpSession httpSession) throws AcmUserActionFailedException { log.info("User [{}] is deleting workflow process with ID [{}]", authentication.getName(), processInstanceId); try { String ipAddress = (String) httpSession.getAttribute("acm_ip_address"); getTaskDao().deleteProcessInstance(parentObjectId, processInstanceId, deleteReason, authentication, ipAddress); } catch (AcmTaskException e) { log.debug("failed deleting process instance with ID [{}]", processInstanceId); throw new AcmUserActionFailedException("delete", "process instance", Long.valueOf(processInstanceId), e.getMessage(), e); } } }
DeleteProcessInstanceAPIController { @RequestMapping(value = "/deleteProcessInstance/{parentObjectId}/{processInstanceId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public void deleteProcessInstance( @PathVariable("parentObjectId") String parentObjectId, @PathVariable("processInstanceId") String processInstanceId, @RequestBody String deleteReason, Authentication authentication, HttpSession httpSession) throws AcmUserActionFailedException { log.info("User [{}] is deleting workflow process with ID [{}]", authentication.getName(), processInstanceId); try { String ipAddress = (String) httpSession.getAttribute("acm_ip_address"); getTaskDao().deleteProcessInstance(parentObjectId, processInstanceId, deleteReason, authentication, ipAddress); } catch (AcmTaskException e) { log.debug("failed deleting process instance with ID [{}]", processInstanceId); throw new AcmUserActionFailedException("delete", "process instance", Long.valueOf(processInstanceId), e.getMessage(), e); } }  }
DeleteProcessInstanceAPIController { @RequestMapping(value = "/deleteProcessInstance/{parentObjectId}/{processInstanceId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public void deleteProcessInstance( @PathVariable("parentObjectId") String parentObjectId, @PathVariable("processInstanceId") String processInstanceId, @RequestBody String deleteReason, Authentication authentication, HttpSession httpSession) throws AcmUserActionFailedException { log.info("User [{}] is deleting workflow process with ID [{}]", authentication.getName(), processInstanceId); try { String ipAddress = (String) httpSession.getAttribute("acm_ip_address"); getTaskDao().deleteProcessInstance(parentObjectId, processInstanceId, deleteReason, authentication, ipAddress); } catch (AcmTaskException e) { log.debug("failed deleting process instance with ID [{}]", processInstanceId); throw new AcmUserActionFailedException("delete", "process instance", Long.valueOf(processInstanceId), e.getMessage(), e); } }  @RequestMapping(value = "/deleteProcessInstance/{parentObjectId}/{processInstanceId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody void deleteProcessInstance(
            @PathVariable("parentObjectId") String parentObjectId,
            @PathVariable("processInstanceId") String processInstanceId,
            @RequestBody String deleteReason,
            Authentication authentication,
            HttpSession httpSession); TaskEventPublisher getTaskEventPublisher(); void setTaskEventPublisher(TaskEventPublisher taskEventPublisher); TaskDao getTaskDao(); void setTaskDao(TaskDao taskDao); }
DeleteProcessInstanceAPIController { @RequestMapping(value = "/deleteProcessInstance/{parentObjectId}/{processInstanceId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody public void deleteProcessInstance( @PathVariable("parentObjectId") String parentObjectId, @PathVariable("processInstanceId") String processInstanceId, @RequestBody String deleteReason, Authentication authentication, HttpSession httpSession) throws AcmUserActionFailedException { log.info("User [{}] is deleting workflow process with ID [{}]", authentication.getName(), processInstanceId); try { String ipAddress = (String) httpSession.getAttribute("acm_ip_address"); getTaskDao().deleteProcessInstance(parentObjectId, processInstanceId, deleteReason, authentication, ipAddress); } catch (AcmTaskException e) { log.debug("failed deleting process instance with ID [{}]", processInstanceId); throw new AcmUserActionFailedException("delete", "process instance", Long.valueOf(processInstanceId), e.getMessage(), e); } }  @RequestMapping(value = "/deleteProcessInstance/{parentObjectId}/{processInstanceId}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @ResponseBody void deleteProcessInstance(
            @PathVariable("parentObjectId") String parentObjectId,
            @PathVariable("processInstanceId") String processInstanceId,
            @RequestBody String deleteReason,
            Authentication authentication,
            HttpSession httpSession); TaskEventPublisher getTaskEventPublisher(); void setTaskEventPublisher(TaskEventPublisher taskEventPublisher); TaskDao getTaskDao(); void setTaskDao(TaskDao taskDao);  }