use of org.activiti.engine.TaskService in project midpoint by Evolveum.
the class TestActivitiQuery method test200TestQueryByTaskVariable.
/**
* Actually, this mechanism is not used anymore. We use identity links to store information about assignees.
* But keeping this test - just in case something like that would be needed later.
*/
@Test
public void test200TestQueryByTaskVariable() throws Exception {
final String TEST_NAME = "test200TestQueryByTaskVariable";
TestUtil.displayTestTile(this, TEST_NAME);
login(userAdministrator);
TaskService taskService = activitiEngine.getTaskService();
TaskQuery tq = taskService.createTaskQuery();
org.activiti.engine.task.Task task = tq.singleResult();
System.out.println("Task = " + task);
assertNotNull("No task", task);
final String TASK_NAME = "Approve assigning Role1a to jack";
final String VAR = "someVariable";
taskService.setVariableLocal(task.getId(), VAR, "[:abc];[:def];[UserType:" + userLead1Oid + "]");
TaskQuery tq1 = taskService.createTaskQuery().includeTaskLocalVariables().taskVariableValueLike(VAR, "%:def]%").taskName(TASK_NAME);
assertFound(tq1, "#1");
TaskQuery tq2 = taskService.createTaskQuery().includeTaskLocalVariables().taskVariableValueLike(VAR, "%:xyz]%");
org.activiti.engine.task.Task task2 = tq2.singleResult();
System.out.println("Task2 = " + task2);
assertNull("Found task2 even if it shouldn't", task2);
TaskQuery tq3 = taskService.createTaskQuery().includeTaskLocalVariables().taskName(TASK_NAME).or().taskVariableValueLike(VAR, "%:ghi]%").taskVariableValueLike(VAR, "%:xxx]%").taskVariableValueLike(VAR, "%:" + userLead1Oid + "]%").endOr();
org.activiti.engine.task.Task task3 = tq3.singleResult();
System.out.println("Task3 = " + task3);
assertNotNull("No task3", task3);
TaskQuery tq4 = taskService.createTaskQuery().includeTaskLocalVariables().taskName(TASK_NAME).or().taskVariableValueLike(VAR, "%:" + userLead1Oid + "]%").taskVariableValueLike(VAR, "%:xxx]%").taskAssignee(userLead1Oid).endOr();
org.activiti.engine.task.Task task4 = tq4.singleResult();
System.out.println("Task4 = " + task4);
assertNotNull("No task4", task4);
TaskQuery tq5 = taskService.createTaskQuery().includeTaskLocalVariables().taskName(TASK_NAME).or().taskVariableValueLike(VAR, "%:" + userLead1Oid + "]%").taskVariableValueLike(VAR, "%:xxx]%").taskAssignee("xxx;" + userLead1Oid).endOr();
org.activiti.engine.task.Task task5 = tq5.singleResult();
System.out.println("Task5 = " + task5);
assertNotNull("No task5", task5);
TaskQuery tq6 = taskService.createTaskQuery().includeTaskLocalVariables().taskName(TASK_NAME).or().taskVariableValueLike(VAR, "%:xxx]%").taskVariableValueLike(VAR, "%:" + userLead1Oid + "]%").taskAssignee("xxx;yyy").endOr();
org.activiti.engine.task.Task task6 = tq6.singleResult();
System.out.println("Task6 = " + task6);
assertNotNull("No task6", task6);
TaskQuery tq7 = taskService.createTaskQuery().includeTaskLocalVariables().taskName(TASK_NAME).or().taskVariableValueLike(VAR, "%:xxx]%").taskVariableValueLike(VAR, "%:yyy]%").taskAssignee("xxx;UserType:" + userLead1Oid).endOr();
org.activiti.engine.task.Task task7 = tq7.singleResult();
System.out.println("Task7 = " + task7);
assertNotNull("No task7", task7);
}
use of org.activiti.engine.TaskService in project midpoint by Evolveum.
the class TaskCreateListener method notify.
@Override
public void notify(DelegateTask delegateTask) {
OperationResult result = new OperationResult(TaskCreateListener.class.getName() + ".notify");
Task wfTask = ActivitiUtil.getTask(delegateTask.getExecution(), result);
String taskId = delegateTask.getId();
// duration/deadline
ApprovalStageDefinitionType stageDef = WfContextUtil.getCurrentStageDefinition(wfTask.getWorkflowContext());
if (stageDef == null) {
throw new IllegalStateException("No approval stage information in " + delegateTask);
}
if (stageDef.getDuration() != null) {
MidpointUtil.setTaskDeadline(delegateTask, stageDef.getDuration());
}
// triggers
int escalationLevel = ActivitiUtil.getEscalationLevelNumber(delegateTask.getVariables());
MidpointUtil.createTriggersForTimedActions(taskId, escalationLevel, delegateTask.getCreateTime(), delegateTask.getDueDate(), wfTask, stageDef.getTimedActions(), result);
// originalAssignee
String assignee = delegateTask.getAssignee();
if (assignee != null) {
TaskService taskService = delegateTask.getExecution().getEngineServices().getTaskService();
taskService.setVariableLocal(taskId, CommonProcessVariableNames.VARIABLE_ORIGINAL_ASSIGNEE, assignee);
taskService.addUserIdentityLink(taskId, assignee, CommonProcessVariableNames.MIDPOINT_ASSIGNEE);
}
getActivitiInterface().notifyMidpointAboutTaskEvent(delegateTask);
}
use of org.activiti.engine.TaskService in project bamboobsc by billchen198318.
the class TestBPMN001 method completeTask.
@Test
public void completeTask() throws Exception {
String assignee = "張三";
//String assignee = "王經理";
TaskService taskService = (TaskService) AppContext.getBean("taskService");
List<Task> tasks = taskService.createTaskQuery().list();
if (tasks == null || tasks.size() < 1) {
System.out.println("no task.");
return;
}
for (Task task : tasks) {
taskService.setAssignee(task.getId(), assignee);
taskService.complete(task.getId());
this.printTask(task);
}
}
use of org.activiti.engine.TaskService in project bamboobsc by billchen198318.
the class TestBPMN001 method queryTask.
@Test
public void queryTask() throws Exception {
String assignee = "張三";
TaskService taskService = (TaskService) AppContext.getBean("taskService");
List<Task> tasks = taskService.createTaskQuery().taskAssignee(assignee).list();
if (tasks == null || tasks.size() < 1) {
System.out.println("no task.");
return;
}
for (Task task : tasks) {
this.printTask(task);
}
}
use of org.activiti.engine.TaskService in project crnk-framework by crnk-project.
the class ActivitiTestBase method teardown.
@After
public void teardown() {
RuntimeService runtimeService = processEngine.getRuntimeService();
List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().list();
for (ProcessInstance processInstance : processInstances) {
runtimeService.deleteProcessInstance(processInstance.getId(), "");
}
TaskService taskService = processEngine.getTaskService();
List<Task> tasks = taskService.createTaskQuery().list();
for (Task task : tasks) {
taskService.deleteTask(task.getId());
}
}
Aggregations