use of org.kie.internal.task.api.model.InternalTask in project jbpm by kiegroup.
the class EGetTaskTest method testFormName.
@Test
public void testFormName() {
Map<String, Object> params = new HashMap<>();
params.put("userName", "johndoe");
Long pid = ejb.startProcess(ProcessDefinitions.HUMAN_TASK_WITH_FORM, params);
List<Status> statusList = new ArrayList<>();
statusList.add(Status.Reserved);
List<TaskSummary> summaryList = ejb.getTasksByStatusByProcessInstanceId(pid, statusList, new QueryFilter(0, 1));
Assertions.assertThat(summaryList).isNotNull().isNotEmpty();
TaskSummary summary = summaryList.get(0);
Task task = ejb.getTask(summary.getId());
String formName = ((InternalTask) task).getFormName();
Assertions.assertThat(formName).as("Expected different form name.").isEqualTo("UserNameInputTask");
}
use of org.kie.internal.task.api.model.InternalTask in project jbpm by kiegroup.
the class UserTaskServiceImplTest method testGetTaskOfAbortedProcess.
@Test
public void testGetTaskOfAbortedProcess() {
processInstanceId = processService.startProcess(deploymentUnit.getIdentifier(), "org.jbpm.writedocument.noform");
assertNotNull(processInstanceId);
List<Long> taskIds = runtimeDataService.getTasksByProcessInstanceId(processInstanceId);
assertNotNull(taskIds);
assertEquals(1, taskIds.size());
Long taskId = taskIds.get(0);
Task taskInstance = userTaskService.getTask(taskId);
assertNotNull(taskInstance);
assertEquals(Status.Reserved, taskInstance.getTaskData().getStatus());
assertEquals("Write a Document", taskInstance.getName());
assertTrue(StringUtils.isEmpty(((InternalTask) taskInstance).getFormName()));
processService.abortProcessInstance(processInstanceId);
taskInstance = userTaskService.getTask(taskId);
assertNotNull(taskInstance);
assertEquals(Status.Exited, taskInstance.getTaskData().getStatus());
assertEquals("Write a Document", taskInstance.getName());
assertTrue(StringUtils.isEmpty(((InternalTask) taskInstance).getFormName()));
}
use of org.kie.internal.task.api.model.InternalTask in project jbpm by kiegroup.
the class TaskInstanceServiceImpl method setSubject.
@Override
public void setSubject(long taskId, String subject) {
Task task = persistenceContext.findTask(taskId);
((InternalTask) task).setSubject(subject);
}
use of org.kie.internal.task.api.model.InternalTask in project jbpm by kiegroup.
the class TaskInstanceServiceImpl method setTaskNames.
public void setTaskNames(long taskId, List<I18NText> inputTaskNames) {
Task task = persistenceContext.findTask(taskId);
taskEventSupport.fireBeforeTaskUpdated(task, context);
List<I18NText> taskNames = new ArrayList<I18NText>(inputTaskNames.size());
for (I18NText inputText : inputTaskNames) {
I18NText text = TaskModelProvider.getFactory().newI18NText();
((InternalI18NText) text).setLanguage(inputText.getLanguage());
((InternalI18NText) text).setText(inputText.getText());
taskNames.add(text);
}
((InternalTask) task).setNames(taskNames);
((InternalTask) task).setName(taskNames.get(0).getText());
taskEventSupport.fireAfterTaskUpdated(task, context);
}
use of org.kie.internal.task.api.model.InternalTask in project jbpm by kiegroup.
the class TaskAdminServiceImpl method archiveTasks.
public int archiveTasks(List<TaskSummary> tasks) {
int archivedTasks = 0;
for (TaskSummary sum : tasks) {
long taskId = sum.getId();
Task task = persistenceContext.findTask(taskId);
if (task != null) {
((InternalTask) task).setArchived(true);
persistenceContext.updateTask(task);
archivedTasks++;
}
}
return archivedTasks;
}
Aggregations