Class TaskService
- java.lang.Object
-
- com.netgrif.application.engine.workflow.service.TaskService
-
- All Implemented Interfaces:
ITaskService
@Service public class TaskService extends java.lang.Object implements ITaskService
-
-
Field Summary
Fields Modifier and Type Field Description protected IDataService
dataService
protected IElasticTaskService
elasticTaskService
protected IEventService
eventService
protected IHistoryService
historyService
protected org.springframework.data.mongodb.core.MongoTemplate
mongoTemplate
protected IProcessRoleService
processRoleService
protected org.springframework.context.ApplicationEventPublisher
publisher
protected org.springframework.scheduling.TaskScheduler
scheduler
protected TaskSearchService
searchService
protected IElasticTaskMappingService
taskMappingService
protected TaskRepository
taskRepository
protected IUserService
userService
protected IValidationService
validation
protected IWorkflowService
workflowService
-
Constructor Summary
Constructors Constructor Description TaskService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AssignTaskEventOutcome
assignTask(LoggedUser loggedUser, java.lang.String taskId)
AssignTaskEventOutcome
assignTask(LoggedUser loggedUser, java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params)
AssignTaskEventOutcome
assignTask(Task task, IUser user)
AssignTaskEventOutcome
assignTask(Task task, IUser user, java.util.Map<java.lang.String,java.lang.String> params)
AssignTaskEventOutcome
assignTask(java.lang.String taskId)
AssignTaskEventOutcome
assignTask(java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params)
java.util.List<AssignTaskEventOutcome>
assignTasks(java.util.List<Task> tasks, IUser user)
java.util.List<AssignTaskEventOutcome>
assignTasks(java.util.List<Task> tasks, IUser user, java.util.Map<java.lang.String,java.lang.String> params)
protected Case
assignTaskToUser(IUser user, Task task, java.lang.String useCaseId)
CancelTaskEventOutcome
cancelTask(LoggedUser loggedUser, java.lang.String taskId)
CancelTaskEventOutcome
cancelTask(LoggedUser loggedUser, java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params)
CancelTaskEventOutcome
cancelTask(Task task, IUser user)
CancelTaskEventOutcome
cancelTask(Task task, IUser user, java.util.Map<java.lang.String,java.lang.String> params)
java.util.List<CancelTaskEventOutcome>
cancelTasks(java.util.List<Task> tasks, IUser user)
java.util.List<CancelTaskEventOutcome>
cancelTasks(java.util.List<Task> tasks, IUser user, java.util.Map<java.lang.String,java.lang.String> params)
void
cancelTasksWithoutReload(java.util.Set<java.lang.String> transitions, java.lang.String caseId)
Used in cancel task actionvoid
cancelTasksWithoutReload(java.util.Set<java.lang.String> transitions, java.lang.String caseId, java.util.Map<java.lang.String,java.lang.String> params)
Used in cancel task actionlong
count(java.util.List<TaskSearchRequest> requests, LoggedUser user, java.util.Locale locale, java.lang.Boolean isIntersection)
protected void
delegate(IUser delegated, Task task, Case useCase)
DelegateTaskEventOutcome
delegateTask(LoggedUser loggedUser, java.lang.String delegatedId, java.lang.String taskId)
DelegateTaskEventOutcome
delegateTask(LoggedUser loggedUser, java.lang.String delegatedId, java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params)
void
delete(java.util.List<Task> tasks, Case useCase)
void
delete(java.util.List<Task> tasks, java.lang.String caseId)
void
deleteTasksByCase(java.lang.String caseId)
void
deleteTasksByPetriNetId(java.lang.String petriNetId)
protected Case
evaluateRules(java.lang.String caseId, Task task, EventType eventType, EventPhase eventPhase)
protected void
execute(Transition transition, Case useCase, java.util.function.Predicate<Arc> predicate)
protected java.util.List<EventOutcome>
executeTransition(Task task, Case useCase)
java.util.List<Task>
findAllByCase(java.lang.String caseId)
java.util.List<TaskReference>
findAllByCase(java.lang.String caseId, java.util.Locale locale)
java.util.List<Task>
findAllById(java.util.List<java.lang.String> ids)
org.springframework.data.domain.Page<Task>
findByCases(org.springframework.data.domain.Pageable pageable, java.util.List<java.lang.String> cases)
Task
findById(java.lang.String id)
org.springframework.data.domain.Page<Task>
findByTransitions(org.springframework.data.domain.Pageable pageable, java.util.List<java.lang.String> transitions)
org.springframework.data.domain.Page<Task>
findByUser(org.springframework.data.domain.Pageable pageable, IUser user)
Task
findOne(java.lang.String taskId)
FinishTaskEventOutcome
finishTask(LoggedUser loggedUser, java.lang.String taskId)
FinishTaskEventOutcome
finishTask(LoggedUser loggedUser, java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params)
FinishTaskEventOutcome
finishTask(Task task, IUser user)
FinishTaskEventOutcome
finishTask(Task task, IUser user, java.util.Map<java.lang.String,java.lang.String> params)
FinishTaskEventOutcome
finishTask(java.lang.String taskId)
FinishTaskEventOutcome
finishTask(java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params)
java.util.List<FinishTaskEventOutcome>
finishTasks(java.util.List<Task> tasks, IUser user)
java.util.List<FinishTaskEventOutcome>
finishTasks(java.util.List<Task> tasks, IUser user, java.util.Map<java.lang.String,java.lang.String> params)
org.springframework.data.domain.Page<Task>
getAll(LoggedUser loggedUser, org.springframework.data.domain.Pageable pageable, java.util.Locale locale)
SetDataEventOutcome
getMainOutcome(java.util.Map<java.lang.String,SetDataEventOutcome> outcomes, java.lang.String taskId)
protected IUser
getUserFromLoggedUser(LoggedUser loggedUser)
void
reloadTasks(Case useCase)
Reloads all unassigned tasks of given case: Task is presentTask is not present Transition executableno actioncreate task Transition not executabledestroy taskno actionvoid
resolveUserRef(Case useCase)
Task
resolveUserRef(Task task, Case useCase)
Task
save(Task task)
java.util.List<Task>
save(java.util.List<Task> tasks)
protected void
scheduleTaskExecution(Task task, java.time.LocalDateTime time, Case useCase)
org.springframework.data.domain.Page<Task>
search(com.querydsl.core.types.Predicate predicate, org.springframework.data.domain.Pageable pageable)
org.springframework.data.domain.Page<Task>
search(java.util.List<TaskSearchRequest> requests, org.springframework.data.domain.Pageable pageable, LoggedUser user, java.util.Locale locale, java.lang.Boolean isIntersection)
org.springframework.data.domain.Page<Task>
searchAll(com.querydsl.core.types.Predicate predicate)
Task
searchOne(com.querydsl.core.types.Predicate predicate)
void
setElasticTaskService(IElasticTaskService elasticTaskService)
void
startExecution(Transition transition, Case useCase)
-
-
-
Field Detail
-
publisher
@Autowired protected org.springframework.context.ApplicationEventPublisher publisher
-
taskRepository
@Autowired protected TaskRepository taskRepository
-
userService
@Autowired protected IUserService userService
-
mongoTemplate
@Autowired protected org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
-
searchService
@Autowired protected TaskSearchService searchService
-
scheduler
@Autowired @Qualifier("taskScheduler") protected org.springframework.scheduling.TaskScheduler scheduler
-
workflowService
@Autowired protected IWorkflowService workflowService
-
dataService
@Autowired protected IDataService dataService
-
processRoleService
@Autowired protected IProcessRoleService processRoleService
-
taskMappingService
@Autowired protected IElasticTaskMappingService taskMappingService
-
eventService
@Autowired protected IEventService eventService
-
elasticTaskService
protected IElasticTaskService elasticTaskService
-
historyService
@Autowired protected IHistoryService historyService
-
validation
@Autowired protected IValidationService validation
-
-
Method Detail
-
setElasticTaskService
@Lazy @Autowired public void setElasticTaskService(IElasticTaskService elasticTaskService)
-
assignTasks
public java.util.List<AssignTaskEventOutcome> assignTasks(java.util.List<Task> tasks, IUser user) throws TransitionNotExecutableException
- Specified by:
assignTasks
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
assignTasks
public java.util.List<AssignTaskEventOutcome> assignTasks(java.util.List<Task> tasks, IUser user, java.util.Map<java.lang.String,java.lang.String> params) throws TransitionNotExecutableException
- Specified by:
assignTasks
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
assignTask
public AssignTaskEventOutcome assignTask(LoggedUser loggedUser, java.lang.String taskId) throws TransitionNotExecutableException
- Specified by:
assignTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
assignTask
public AssignTaskEventOutcome assignTask(LoggedUser loggedUser, java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params) throws TransitionNotExecutableException
- Specified by:
assignTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
assignTask
public AssignTaskEventOutcome assignTask(java.lang.String taskId) throws TransitionNotExecutableException
- Specified by:
assignTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
assignTask
public AssignTaskEventOutcome assignTask(java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params) throws TransitionNotExecutableException
- Specified by:
assignTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
assignTask
public AssignTaskEventOutcome assignTask(Task task, IUser user) throws TransitionNotExecutableException
- Specified by:
assignTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
assignTask
public AssignTaskEventOutcome assignTask(Task task, IUser user, java.util.Map<java.lang.String,java.lang.String> params) throws TransitionNotExecutableException
- Specified by:
assignTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
assignTaskToUser
protected Case assignTaskToUser(IUser user, Task task, java.lang.String useCaseId) throws TransitionNotExecutableException
- Throws:
TransitionNotExecutableException
-
finishTasks
public java.util.List<FinishTaskEventOutcome> finishTasks(java.util.List<Task> tasks, IUser user) throws TransitionNotExecutableException
- Specified by:
finishTasks
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
finishTasks
public java.util.List<FinishTaskEventOutcome> finishTasks(java.util.List<Task> tasks, IUser user, java.util.Map<java.lang.String,java.lang.String> params) throws TransitionNotExecutableException
- Specified by:
finishTasks
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
finishTask
public FinishTaskEventOutcome finishTask(java.lang.String taskId) throws java.lang.IllegalArgumentException, TransitionNotExecutableException
- Specified by:
finishTask
in interfaceITaskService
- Throws:
java.lang.IllegalArgumentException
TransitionNotExecutableException
-
finishTask
public FinishTaskEventOutcome finishTask(java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params) throws java.lang.IllegalArgumentException, TransitionNotExecutableException
- Specified by:
finishTask
in interfaceITaskService
- Throws:
java.lang.IllegalArgumentException
TransitionNotExecutableException
-
finishTask
public FinishTaskEventOutcome finishTask(LoggedUser loggedUser, java.lang.String taskId) throws java.lang.IllegalArgumentException, TransitionNotExecutableException
- Specified by:
finishTask
in interfaceITaskService
- Throws:
java.lang.IllegalArgumentException
TransitionNotExecutableException
-
finishTask
public FinishTaskEventOutcome finishTask(LoggedUser loggedUser, java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params) throws java.lang.IllegalArgumentException, TransitionNotExecutableException
- Specified by:
finishTask
in interfaceITaskService
- Throws:
java.lang.IllegalArgumentException
TransitionNotExecutableException
-
finishTask
public FinishTaskEventOutcome finishTask(Task task, IUser user) throws TransitionNotExecutableException
- Specified by:
finishTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
finishTask
public FinishTaskEventOutcome finishTask(Task task, IUser user, java.util.Map<java.lang.String,java.lang.String> params) throws TransitionNotExecutableException
- Specified by:
finishTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
cancelTasks
public java.util.List<CancelTaskEventOutcome> cancelTasks(java.util.List<Task> tasks, IUser user)
- Specified by:
cancelTasks
in interfaceITaskService
-
cancelTasks
public java.util.List<CancelTaskEventOutcome> cancelTasks(java.util.List<Task> tasks, IUser user, java.util.Map<java.lang.String,java.lang.String> params)
- Specified by:
cancelTasks
in interfaceITaskService
-
cancelTask
public CancelTaskEventOutcome cancelTask(LoggedUser loggedUser, java.lang.String taskId)
- Specified by:
cancelTask
in interfaceITaskService
-
cancelTask
public CancelTaskEventOutcome cancelTask(LoggedUser loggedUser, java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params)
- Specified by:
cancelTask
in interfaceITaskService
-
cancelTask
public CancelTaskEventOutcome cancelTask(Task task, IUser user)
- Specified by:
cancelTask
in interfaceITaskService
-
cancelTask
public CancelTaskEventOutcome cancelTask(Task task, IUser user, java.util.Map<java.lang.String,java.lang.String> params)
- Specified by:
cancelTask
in interfaceITaskService
-
cancelTasksWithoutReload
public void cancelTasksWithoutReload(java.util.Set<java.lang.String> transitions, java.lang.String caseId)
Used in cancel task action- Specified by:
cancelTasksWithoutReload
in interfaceITaskService
-
cancelTasksWithoutReload
public void cancelTasksWithoutReload(java.util.Set<java.lang.String> transitions, java.lang.String caseId, java.util.Map<java.lang.String,java.lang.String> params)
Used in cancel task action- Specified by:
cancelTasksWithoutReload
in interfaceITaskService
-
delegateTask
public DelegateTaskEventOutcome delegateTask(LoggedUser loggedUser, java.lang.String delegatedId, java.lang.String taskId) throws TransitionNotExecutableException
- Specified by:
delegateTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
delegateTask
public DelegateTaskEventOutcome delegateTask(LoggedUser loggedUser, java.lang.String delegatedId, java.lang.String taskId, java.util.Map<java.lang.String,java.lang.String> params) throws TransitionNotExecutableException
- Specified by:
delegateTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
delegate
protected void delegate(IUser delegated, Task task, Case useCase) throws TransitionNotExecutableException
- Throws:
TransitionNotExecutableException
-
evaluateRules
protected Case evaluateRules(java.lang.String caseId, Task task, EventType eventType, EventPhase eventPhase)
-
reloadTasks
public void reloadTasks(Case useCase)
Reloads all unassigned tasks of given case:Task is present Task is not present Transition executable no action create task Transition not executable destroy task no action - Specified by:
reloadTasks
in interfaceITaskService
-
startExecution
public void startExecution(Transition transition, Case useCase) throws TransitionNotExecutableException
- Throws:
TransitionNotExecutableException
-
execute
protected void execute(Transition transition, Case useCase, java.util.function.Predicate<Arc> predicate) throws TransitionNotExecutableException
- Throws:
TransitionNotExecutableException
-
executeTransition
protected java.util.List<EventOutcome> executeTransition(Task task, Case useCase)
-
scheduleTaskExecution
protected void scheduleTaskExecution(Task task, java.time.LocalDateTime time, Case useCase)
-
findOne
public Task findOne(java.lang.String taskId)
- Specified by:
findOne
in interfaceITaskService
-
getAll
public org.springframework.data.domain.Page<Task> getAll(LoggedUser loggedUser, org.springframework.data.domain.Pageable pageable, java.util.Locale locale)
- Specified by:
getAll
in interfaceITaskService
-
search
public org.springframework.data.domain.Page<Task> search(java.util.List<TaskSearchRequest> requests, org.springframework.data.domain.Pageable pageable, LoggedUser user, java.util.Locale locale, java.lang.Boolean isIntersection)
- Specified by:
search
in interfaceITaskService
-
count
public long count(java.util.List<TaskSearchRequest> requests, LoggedUser user, java.util.Locale locale, java.lang.Boolean isIntersection)
- Specified by:
count
in interfaceITaskService
-
findByCases
public org.springframework.data.domain.Page<Task> findByCases(org.springframework.data.domain.Pageable pageable, java.util.List<java.lang.String> cases)
- Specified by:
findByCases
in interfaceITaskService
-
findById
public Task findById(java.lang.String id)
- Specified by:
findById
in interfaceITaskService
-
findAllById
public java.util.List<Task> findAllById(java.util.List<java.lang.String> ids)
- Specified by:
findAllById
in interfaceITaskService
-
findByUser
public org.springframework.data.domain.Page<Task> findByUser(org.springframework.data.domain.Pageable pageable, IUser user)
- Specified by:
findByUser
in interfaceITaskService
-
findByTransitions
public org.springframework.data.domain.Page<Task> findByTransitions(org.springframework.data.domain.Pageable pageable, java.util.List<java.lang.String> transitions)
- Specified by:
findByTransitions
in interfaceITaskService
-
searchAll
public org.springframework.data.domain.Page<Task> searchAll(com.querydsl.core.types.Predicate predicate)
- Specified by:
searchAll
in interfaceITaskService
-
search
public org.springframework.data.domain.Page<Task> search(com.querydsl.core.types.Predicate predicate, org.springframework.data.domain.Pageable pageable)
- Specified by:
search
in interfaceITaskService
-
searchOne
public Task searchOne(com.querydsl.core.types.Predicate predicate)
- Specified by:
searchOne
in interfaceITaskService
-
findAllByCase
public java.util.List<TaskReference> findAllByCase(java.lang.String caseId, java.util.Locale locale)
- Specified by:
findAllByCase
in interfaceITaskService
-
findAllByCase
public java.util.List<Task> findAllByCase(java.lang.String caseId)
- Specified by:
findAllByCase
in interfaceITaskService
-
save
public Task save(Task task)
- Specified by:
save
in interfaceITaskService
-
save
public java.util.List<Task> save(java.util.List<Task> tasks)
- Specified by:
save
in interfaceITaskService
-
resolveUserRef
public void resolveUserRef(Case useCase)
- Specified by:
resolveUserRef
in interfaceITaskService
-
resolveUserRef
public Task resolveUserRef(Task task, Case useCase)
- Specified by:
resolveUserRef
in interfaceITaskService
-
delete
public void delete(java.util.List<Task> tasks, Case useCase)
- Specified by:
delete
in interfaceITaskService
-
delete
public void delete(java.util.List<Task> tasks, java.lang.String caseId)
- Specified by:
delete
in interfaceITaskService
-
deleteTasksByCase
public void deleteTasksByCase(java.lang.String caseId)
- Specified by:
deleteTasksByCase
in interfaceITaskService
-
deleteTasksByPetriNetId
public void deleteTasksByPetriNetId(java.lang.String petriNetId)
- Specified by:
deleteTasksByPetriNetId
in interfaceITaskService
-
getMainOutcome
public SetDataEventOutcome getMainOutcome(java.util.Map<java.lang.String,SetDataEventOutcome> outcomes, java.lang.String taskId)
- Specified by:
getMainOutcome
in interfaceITaskService
-
getUserFromLoggedUser
protected IUser getUserFromLoggedUser(LoggedUser loggedUser)
-
-