Search in sources :

Example 21 with UserTaskInstanceDesc

use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.

the class UserTaskAdminServiceImpl method cancelNotification.

@Override
public void cancelNotification(String deploymentId, long taskId, long notificationId) throws TaskNotFoundException {
    UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
    validateTask(deploymentId, taskId, task);
    userTaskService.execute(task.getDeploymentId(), ProcessInstanceIdContext.get(task.getProcessInstanceId()), new CancelTaskDeadlineCommand(identityProvider.getName(), taskId, notificationId));
}
Also used : CancelTaskDeadlineCommand(org.jbpm.kie.services.impl.admin.commands.CancelTaskDeadlineCommand) UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc)

Example 22 with UserTaskInstanceDesc

use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.

the class UserTaskAdminServiceImpl method getTaskNotifications.

@Override
public Collection<TaskNotification> getTaskNotifications(String deploymentId, long taskId, boolean activeOnly) throws TaskNotFoundException {
    UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
    validateTask(deploymentId, taskId, task);
    return userTaskService.execute(task.getDeploymentId(), ProcessInstanceIdContext.get(task.getProcessInstanceId()), new ListTaskNotificationsCommand(identityProvider.getName(), taskId, activeOnly));
}
Also used : ListTaskNotificationsCommand(org.jbpm.kie.services.impl.admin.commands.ListTaskNotificationsCommand) UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc)

Example 23 with UserTaskInstanceDesc

use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.

the class UserTaskAdminServiceImpl method addPeopleAssignment.

/*
     * Internal methods
     */
protected void addPeopleAssignment(String deploymentId, long taskId, boolean removeExisting, int type, OrganizationalEntity... orgEntities) throws TaskNotFoundException {
    UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
    validateTask(deploymentId, taskId, task);
    userTaskService.execute(task.getDeploymentId(), ProcessInstanceIdContext.get(task.getProcessInstanceId()), new AddPeopleAssignmentsCommand(identityProvider.getName(), taskId, type, orgEntities, removeExisting));
}
Also used : UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc) AddPeopleAssignmentsCommand(org.jbpm.kie.services.impl.admin.commands.AddPeopleAssignmentsCommand)

Example 24 with UserTaskInstanceDesc

use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.

the class UserTaskAdminServiceImpl method removeTaskInputs.

@Override
public void removeTaskInputs(String deploymentId, long taskId, String... name) throws TaskNotFoundException {
    UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
    validateTask(deploymentId, taskId, task);
    userTaskService.execute(task.getDeploymentId(), ProcessInstanceIdContext.get(task.getProcessInstanceId()), new RemoveTaskDataCommand(identityProvider.getName(), taskId, Arrays.asList(name), true));
}
Also used : RemoveTaskDataCommand(org.jbpm.kie.services.impl.admin.commands.RemoveTaskDataCommand) UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc)

Example 25 with UserTaskInstanceDesc

use of org.jbpm.services.api.model.UserTaskInstanceDesc in project jbpm by kiegroup.

the class UserTaskAdminServiceImpl method notify.

protected Long notify(String deploymentId, long taskId, String timeExpression, DeadlineType type, Notification notification) throws TaskNotFoundException {
    UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
    validateTask(deploymentId, taskId, task);
    List<Escalation> escalations = new ArrayList<Escalation>();
    Deadline taskDeadline = TaskModelProvider.getFactory().newDeadline();
    taskDeadline.setEscalations(escalations);
    Escalation escalation = TaskModelProvider.getFactory().newEscalation();
    escalations.add(escalation);
    escalation.setName("Admin notification for task " + taskId);
    List<Notification> notifications = new ArrayList<Notification>();
    notifications.add(notification);
    escalation.setNotifications(notifications);
    return userTaskService.execute(task.getDeploymentId(), ProcessInstanceIdContext.get(task.getProcessInstanceId()), new ScheduleTaskDeadlineCommand(identityProvider.getName(), taskId, type, taskDeadline, timeExpression));
}
Also used : Escalation(org.kie.internal.task.api.model.Escalation) Deadline(org.kie.internal.task.api.model.Deadline) ArrayList(java.util.ArrayList) ScheduleTaskDeadlineCommand(org.jbpm.kie.services.impl.admin.commands.ScheduleTaskDeadlineCommand) UserTaskInstanceDesc(org.jbpm.services.api.model.UserTaskInstanceDesc) TaskNotification(org.jbpm.services.api.admin.TaskNotification) Notification(org.kie.internal.task.api.model.Notification) EmailNotification(org.kie.internal.task.api.model.EmailNotification)

Aggregations

UserTaskInstanceDesc (org.jbpm.services.api.model.UserTaskInstanceDesc)118 Test (org.junit.Test)67 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)36 RuntimeManager (org.kie.api.runtime.manager.RuntimeManager)35 InternalRuntimeManager (org.kie.internal.runtime.manager.InternalRuntimeManager)35 InternalTaskService (org.kie.internal.task.api.InternalTaskService)35 UserTaskService (org.jbpm.services.api.UserTaskService)34 RuntimeEngine (org.kie.api.runtime.manager.RuntimeEngine)34 TaskService (org.kie.api.task.TaskService)34 HashMap (java.util.HashMap)23 QueryContext (org.kie.api.runtime.query.QueryContext)22 ArrayList (java.util.ArrayList)18 TaskNotFoundException (org.jbpm.services.api.TaskNotFoundException)16 PermissionDeniedException (org.jbpm.services.task.exception.PermissionDeniedException)16 ProcessInstanceDesc (org.jbpm.services.api.model.ProcessInstanceDesc)15 SqlQueryDefinition (org.jbpm.kie.services.impl.query.SqlQueryDefinition)11 QueryDefinition (org.jbpm.services.api.query.model.QueryDefinition)9 ProcessInstance (org.kie.api.runtime.process.ProcessInstance)7 CorrelationKey (org.kie.internal.process.CorrelationKey)7 AdvancedQueryContext (org.kie.api.runtime.query.AdvancedQueryContext)6