/// <summary>
        ///
        /// </summary>
        public virtual IPage <TaskModel> GetTasks(string processInstanceId, string businessKey, string tenantId, Pageable pageable)
        {
            ITaskQuery query = taskService.CreateTaskQuery();

            if (string.IsNullOrWhiteSpace(processInstanceId) == false)
            {
                query.SetProcessInstanceId(processInstanceId);
            }
            else
            {
                query.SetProcessInstanceBusinessKey(businessKey)
                .SetTaskTenantId(tenantId);
            }
            if (pageable.PageSize == 0)
            {
                pageable.PageNo   = 1;
                pageable.PageSize = int.MaxValue;
            }

            sortApplier.ApplySort(query, pageable);

            return(pageRetriever.LoadPage(taskService as ServiceImpl, query, pageable, taskConverter, (q, firstResult, pageSize) =>
            {
                return new GetProcessInstanceTasksCmd(q, firstResult, pageSize);
            }));
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        public virtual IPage <TaskModel> GetTasks(TaskQuery query)
        {
            string     userId    = authenticationWrapper.AuthenticatedUser.Id;
            ITaskQuery taskQuery = taskService.CreateTaskQuery();

            if (userId is object)
            {
                IList <string> groups = null;
                if (userGroupLookupProxy != null)
                {
                    groups = userGroupLookupProxy.GetGroupsForCandidateUser(userId);
                }
                taskQuery = taskQuery.SetTaskCandidateOrAssigned(userId, groups);
            }
            if (query.ProcessInstanceBusinessKey is object)
            {
                taskQuery.SetProcessInstanceBusinessKey(query.ProcessInstanceBusinessKey);
            }
            sortApplier.ApplySort(taskQuery, query.Pageable);

            return(pageRetriever.LoadPage <ITask, TaskModel, ITaskQuery>(taskService as ServiceImpl, taskQuery, query.Pageable, taskConverter, (q, firstResult, pageSize) =>
            {
                return new GetProcessInstanceTasksCmd(q, firstResult, pageSize);
            }));
        }