use of org.kie.internal.task.api.model.Deadline in project jbpm by kiegroup.
the class UserTaskAdminServiceImpl method reassign.
protected Long reassign(String deploymentId, long taskId, String timeExpression, DeadlineType type, OrganizationalEntity... orgEntities) throws TaskNotFoundException {
UserTaskInstanceDesc task = runtimeDataService.getTaskById(taskId);
validateTask(deploymentId, taskId, task);
if (timeExpression == null || timeExpression.isEmpty()) {
throw new IllegalArgumentException("Invalid time expression");
}
if (orgEntities == null || orgEntities.length <= 0) {
throw new IllegalArgumentException("Invalid org entity");
}
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 reassignment for task " + taskId);
List<Reassignment> reassignments = new ArrayList<Reassignment>();
Reassignment reassignment = TaskModelProvider.getFactory().newReassignment();
reassignment.setPotentialOwners(new ArrayList<>(Arrays.asList(orgEntities)));
reassignments.add(reassignment);
escalation.setReassignments(reassignments);
return userTaskService.execute(task.getDeploymentId(), ProcessInstanceIdContext.get(task.getProcessInstanceId()), new ScheduleTaskDeadlineCommand(identityProvider.getName(), taskId, type, taskDeadline, timeExpression));
}
Aggregations