JBPM4.3会签中的signalName值如何获取?
本帖最后由 tiehou 于 2010-09-07 12:36:10 编辑 在会签中的
public void signal(ActivityExecution activityExecution, String signalName,
Map<String, ?> parameters) throws Exception {
ExecutionImpl execution = (ExecutionImpl) activityExecution;
ExecutionService executionService = EnvironmentImpl
.getFromCurrent(ExecutionService.class);
TaskService taskService = EnvironmentImpl.getFromCurrent(TaskService.class);
String executionId = activityExecution.getId();
Map<String, Object> variables = executionService.getVariables(executionId, executionService
.getVariableNames(executionId));
//获取子任务
Task subTask = (Task) parameters.get("subTask");
taskService.completeTask(subTask.getId());//结束子任务
//收集会签意见
String countersignAgree = (String) parameters.get("countersignAgree");//会签意见内容
Conclusion conclusion = (Conclusion) parameters.get("conclusion");//会签选择
signalName=(String)parameters.get("signalName");
String assignee = subTask.getAssignee();//会签人
//更新集合信息
CountersignInfo countersignInfo = (CountersignInfo) variables.get(subTask.getActivityName() + "_COUNTERSIGN_INFO");
Map<String, CountersignUser> users = countersignInfo.getUsers();
CountersignUser countersignUser = users.get(assignee);
countersignUser.setConclusion(conclusion);
countersignUser.setCountersignAgree(countersignAgree);
boolean allSign = true;
//遍历是否会签完毕
for (CountersignUser item : users.values()) {
if(item.getConclusion() == Conclusion.NOSTART){
allSign = false;
}
}
countersignInfo.setAllSign(allSign);
//如果会签完毕,计算结果
if(allSign){
countersignInfo.calculate();
String agree = "同意";
//如果结果为否决
if(countersignInfo.getConclusion() == Conclusion.DENED){
agree = "不同意";
}
variables.put("agree", agree);
//更新集合信息
signalName="";
executionService.setVariables(executionId, variables);
if(signalName!=null&&!signalName.equals(""))
{
activityExecution.take(signalName);//执行下一步
}
return;
}
//否则继续等待
execution.waitForSignal();
}