CCM NG/ccm-core: WorkflowManager added multiple TaskAssignments for same task and assignee
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4799 8810af33-2d31-482b-a856-94f89814c4df
Former-commit-id: d4619d7f4c
pull/2/head
parent
fe8f1c98ef
commit
5805f50949
|
|
@ -49,7 +49,9 @@ import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
|
import org.libreccm.security.Role;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manager for {@link Workflow}s. The logic of some of these classes has been
|
* Manager for {@link Workflow}s. The logic of some of these classes has been
|
||||||
|
|
@ -82,6 +84,9 @@ public class WorkflowManager {
|
||||||
@Inject
|
@Inject
|
||||||
private TaskManager taskManager;
|
private TaskManager taskManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private AssignableTaskManager assignableTaskManager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Shiro shiro;
|
private Shiro shiro;
|
||||||
|
|
||||||
|
|
@ -138,6 +143,8 @@ public class WorkflowManager {
|
||||||
.forEach((locale, str) -> description.addValue(locale, str));
|
.forEach((locale, str) -> description.addValue(locale, str));
|
||||||
workflow.setDescription(description);
|
workflow.setDescription(description);
|
||||||
|
|
||||||
|
workflowRepo.save(workflow);
|
||||||
|
|
||||||
final Map<Long, Task> tasks = new HashMap<>();
|
final Map<Long, Task> tasks = new HashMap<>();
|
||||||
|
|
||||||
template
|
template
|
||||||
|
|
@ -224,10 +231,24 @@ public class WorkflowManager {
|
||||||
| InvocationTargetException ex) {
|
| InvocationTargetException ex) {
|
||||||
throw new RuntimeException();
|
throw new RuntimeException();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
workflow.addTask(task);
|
workflow.addTask(task);
|
||||||
task.setWorkflow(workflow);
|
task.setWorkflow(workflow);
|
||||||
tasks.put(template.getTaskId(), task);
|
tasks.put(template.getTaskId(), task);
|
||||||
|
|
||||||
|
if (template instanceof AssignableTask) {
|
||||||
|
final AssignableTask assignableTemplate
|
||||||
|
= (AssignableTask) template;
|
||||||
|
final AssignableTask assignableTask = (AssignableTask) task;
|
||||||
|
|
||||||
|
assignableTemplate
|
||||||
|
.getAssignments()
|
||||||
|
.stream()
|
||||||
|
.map(TaskAssignment::getRole)
|
||||||
|
.forEach(role -> {
|
||||||
|
assignableTaskManager.assignTask(assignableTask, role);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue