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 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(Task task, IUser user)
AssignTaskEventOutcome
assignTask(java.lang.String taskId)
java.util.List<AssignTaskEventOutcome>
assignTasks(java.util.List<Task> tasks, IUser user)
protected Case
assignTaskToUser(IUser user, Task task, java.lang.String useCaseId)
CancelTaskEventOutcome
cancelTask(LoggedUser loggedUser, java.lang.String taskId)
CancelTaskEventOutcome
cancelTask(Task task, IUser user)
java.util.List<CancelTaskEventOutcome>
cancelTasks(java.util.List<Task> tasks, IUser user)
void
cancelTasksWithoutReload(java.util.Set<java.lang.String> transitions, java.lang.String caseId)
Used in cancel task actionlong
count(java.util.List<TaskSearchRequest> requests, LoggedUser user, java.util.Locale locale, java.lang.Boolean isIntersection)
void
createTasks(Case useCase)
protected void
delegate(IUser delegated, Task task, Case useCase)
DelegateTaskEventOutcome
delegateTask(LoggedUser loggedUser, java.lang.String delegatedId, java.lang.String taskId)
void
delete(java.lang.Iterable<? extends Task> tasks, Case useCase)
void
delete(java.lang.Iterable<? extends 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<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(Task task, IUser user)
FinishTaskEventOutcome
finishTask(java.lang.String taskId)
java.util.List<FinishTaskEventOutcome>
finishTasks(java.util.List<Task> tasks, IUser user)
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)
void
reloadTasks(Case useCase)
Reloads all unassigned tasks of given case: LocalisedTask is presentLocalisedTask 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)
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
-
-
Method Detail
-
setElasticTaskService
@Autowired public void setElasticTaskService(IElasticTaskService elasticTaskService)
-
assignTasks
@Transactional(rollbackFor=java.lang.Exception.class) public java.util.List<AssignTaskEventOutcome> assignTasks(java.util.List<Task> tasks, IUser user) throws TransitionNotExecutableException
- Specified by:
assignTasks
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
assignTask
@Transactional public AssignTaskEventOutcome assignTask(LoggedUser loggedUser, java.lang.String taskId) 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
@Transactional public AssignTaskEventOutcome assignTask(Task task, IUser user) throws TransitionNotExecutableException
- Specified by:
assignTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
assignTaskToUser
@Transactional protected Case assignTaskToUser(IUser user, Task task, java.lang.String useCaseId) throws TransitionNotExecutableException
- Throws:
TransitionNotExecutableException
-
finishTasks
@Transactional(rollbackFor=java.lang.Exception.class) public java.util.List<FinishTaskEventOutcome> finishTasks(java.util.List<Task> tasks, IUser user) 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
@Transactional 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
@Transactional public FinishTaskEventOutcome finishTask(Task task, IUser user) throws TransitionNotExecutableException
- Specified by:
finishTask
in interfaceITaskService
- Throws:
TransitionNotExecutableException
-
cancelTasks
@Transactional(rollbackFor=java.lang.Exception.class) public java.util.List<CancelTaskEventOutcome> cancelTasks(java.util.List<Task> tasks, IUser user)
- Specified by:
cancelTasks
in interfaceITaskService
-
cancelTask
@Transactional public CancelTaskEventOutcome cancelTask(LoggedUser loggedUser, java.lang.String taskId)
- Specified by:
cancelTask
in interfaceITaskService
-
cancelTask
@Transactional public CancelTaskEventOutcome cancelTask(Task task, IUser user)
- 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
-
delegateTask
@Transactional public DelegateTaskEventOutcome delegateTask(LoggedUser loggedUser, java.lang.String delegatedId, java.lang.String taskId) 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
@Transactional public void reloadTasks(Case useCase)
Reloads all unassigned tasks of given case:LocalisedTask is present LocalisedTask is not present Transition executable no action create task Transition not executable destroy task no action - Specified by:
reloadTasks
in interfaceITaskService
-
startExecution
@Transactional public void startExecution(Transition transition, Case useCase) throws TransitionNotExecutableException
- Throws:
TransitionNotExecutableException
-
execute
@Transactional protected void execute(Transition transition, Case useCase, java.util.function.Predicate<Arc> predicate) throws TransitionNotExecutableException
- Throws:
TransitionNotExecutableException
-
executeTransition
@Transactional protected java.util.List<EventOutcome> executeTransition(Task task, Case useCase)
-
scheduleTaskExecution
@Transactional 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
-
createTasks
@Transactional public void createTasks(Case useCase)
- Specified by:
createTasks
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
-
save
public Task save(Task task)
- 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.lang.Iterable<? extends Task> tasks, Case useCase)
- Specified by:
delete
in interfaceITaskService
-
delete
public void delete(java.lang.Iterable<? extends 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
-
-