* 删除部署.
*/
@RequestMapping("console-removeDeployment")
public String removeDeployment(
@RequestParam("deploymentId") String deploymentId) {
RepositoryService repositoryService = processEngine
.getRepositoryService();
List<ProcessDefinition> processDefinitions = repositoryService
.createProcessDefinitionQuery().deploymentId(deploymentId)
.list();
for (ProcessDefinition processDefinition : processDefinitions) {
String hql = "from BpmConfBase where processDefinitionId=? or (processDefinitionKey=? and processDefinitionVersion=?)";
List<BpmConfBase> bpmConfBases = bpmConfBaseManager.find(hql,
processDefinition.getId(), processDefinition.getKey(),
processDefinition.getVersion());
for (BpmConfBase bpmConfBase : bpmConfBases) {
for (BpmConfNode bpmConfNode : bpmConfBase.getBpmConfNodes()) {
for (BpmConfCountersign bpmConfCountersign : bpmConfNode
.getBpmConfCountersigns()) {
bpmConfBaseManager.remove(bpmConfCountersign);
}
for (BpmConfForm bpmConfForm : bpmConfNode
.getBpmConfForms()) {
bpmConfBaseManager.remove(bpmConfForm);
}
for (BpmConfListener bpmConfListener : bpmConfNode
.getBpmConfListeners()) {
bpmConfBaseManager.remove(bpmConfListener);
}
for (BpmConfNotice bpmConfNotice : bpmConfNode
.getBpmConfNotices()) {
bpmConfBaseManager.remove(bpmConfNotice);
}
for (BpmConfOperation bpmConfOperation : bpmConfNode
.getBpmConfOperations()) {
bpmConfBaseManager.remove(bpmConfOperation);
}
for (BpmConfRule bpmConfRule : bpmConfNode
.getBpmConfRules()) {
bpmConfBaseManager.remove(bpmConfRule);
}
for (BpmConfUser bpmConfUser : bpmConfNode
.getBpmConfUsers()) {
bpmConfBaseManager.remove(bpmConfUser);
}
bpmConfBaseManager.remove(bpmConfNode);
}
bpmConfBaseManager.remove(bpmConfBase);
}
}
repositoryService.deleteDeployment(deploymentId, true);
return "redirect:/bpm/console-listDeployments.do";
}