if (task == null) {
return null;
}
ts.setAssignee(task.getId(), user.getLogin());
ProcessInstance pi2 = ctx.getProcessInstanceDAO().getProcessInstanceByInternalId(task.getProcessInstanceId());
if (pi2 == null) {
if (pi == null)
return assignTaskFromQueue(pq, ctx);
else
return null;
}
if (!user.getLogin().equals(ts.createTaskQuery().taskId(task.getId()).singleResult().getAssignee())) {
if (pi == null)
return assignTaskFromQueue(pq, ctx);
else
return null;
}
pi2.setTaskId(task.getId());
pi2.setState(task.getName());
ProcessInstanceLog log = new ProcessInstanceLog();
log.setLogType(ProcessInstanceLog.LOG_TYPE_CLAIM_PROCESS);
log.setState(ctx.getProcessDefinitionDAO().getProcessStateConfiguration(pi));
log.setEntryDate(Calendar.getInstance());
log.setEventI18NKey("process.log.process-assigned");
log.setLogValue(pq.getName());
log.setUser(ctx.getUserDataDAO().findOrCreateUser(user));
log.setAdditionalInfo(pq.getDescription());
pi2.addProcessLog(log);
fillProcessAssignmentData(pi2, ctx);
ctx.getProcessInstanceDAO().saveProcessInstance(pi2);
eventBusManager.publish(new BpmEvent(BpmEvent.Type.ASSIGN_TASK,