本文整理汇总了Java中org.activiti.engine.task.DelegationState类的典型用法代码示例。如果您正苦于以下问题:Java DelegationState类的具体用法?Java DelegationState怎么用?Java DelegationState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DelegationState类属于org.activiti.engine.task包,在下文中一共展示了DelegationState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: taskDelegationState
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
public TaskQuery taskDelegationState(DelegationState delegationState) {
if (orActive) {
if (delegationState == null) {
currentOrQueryObject.noDelegationState = true;
} else {
currentOrQueryObject.delegationState = delegationState;
}
} else {
if (delegationState == null) {
this.noDelegationState = true;
} else {
this.delegationState = delegationState;
}
}
return this;
}
示例2: testTaskDelegationThroughServiceCall
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
public void testTaskDelegationThroughServiceCall() {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
// Fetch the task again and update
task = taskService.createTaskQuery().taskId(taskId).singleResult();
taskService.delegateTask(taskId, "joesmoe");
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("joesmoe", task.getAssignee());
assertEquals(DelegationState.PENDING, task.getDelegationState());
taskService.resolveTask(taskId);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("johndoe", task.getAssignee());
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
// Finally, delete task
taskService.deleteTask(taskId, true);
}
示例3: testSetDelegationState
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
/**
* @see http://jira.codehaus.org/browse/ACT-1059
*/
public void testSetDelegationState() {
Task task = taskService.newTask();
task.setOwner("wuzh");
task.delegate("other");
taskService.saveTask(task);
String taskId = task.getId();
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("wuzh", task.getOwner());
assertEquals("other", task.getAssignee());
assertEquals(DelegationState.PENDING, task.getDelegationState());
task.setDelegationState(DelegationState.RESOLVED);
taskService.saveTask(task);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("wuzh", task.getOwner());
assertEquals("other", task.getAssignee());
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
taskService.deleteTask(taskId, true);
}
示例4: testResolveTaskWithParametersNullParameters
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
public void testResolveTaskWithParametersNullParameters() {
Task task = taskService.newTask();
task.setDelegationState(DelegationState.PENDING);
taskService.saveTask(task);
String taskId = task.getId();
taskService.resolveTask(taskId, null);
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
historyService.deleteHistoricTaskInstance(taskId);
}
// Fetch the task again
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
taskService.deleteTask(taskId, true);
}
示例5: testResolveTaskWithParametersEmptyParameters
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public void testResolveTaskWithParametersEmptyParameters() {
Task task = taskService.newTask();
task.setDelegationState(DelegationState.PENDING);
taskService.saveTask(task);
String taskId = task.getId();
taskService.resolveTask(taskId, Collections.EMPTY_MAP);
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
historyService.deleteHistoricTaskInstance(taskId);
}
// Fetch the task again
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
taskService.deleteTask(taskId, true);
}
示例6: testResolveWithParametersTask
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
@Deployment(resources = { "org/activiti/engine/test/api/twoTasksProcess.bpmn20.xml" })
public void testResolveWithParametersTask() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoTasksProcess");
// Fetch first task
Task task = taskService.createTaskQuery().singleResult();
assertEquals("First task", task.getName());
task.delegate("johndoe");
// Resolve first task
Map<String, Object> taskParams = new HashMap<String, Object>();
taskParams.put("myParam", "myValue");
taskService.resolveTask(task.getId(), taskParams);
// Verify that task is resolved
task = taskService.createTaskQuery().taskDelegationState(DelegationState.RESOLVED).singleResult();
assertEquals("First task", task.getName());
// Verify task parameters set on execution
Map<String, Object> variables = runtimeService.getVariables(processInstance.getId());
assertEquals(1, variables.size());
assertEquals("myValue", variables.get("myParam"));
}
示例7: findDelegatedTasks
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
/**
* 代理中的任务(代理人还未完成该任务).
*/
public Page findDelegatedTasks(String userId, String tenantId, Page page) {
TaskService taskService = processEngine.getTaskService();
long count = taskService.createTaskQuery().taskTenantId(tenantId)
.taskOwner(userId).taskDelegationState(DelegationState.PENDING)
.count();
List<Task> tasks = taskService.createTaskQuery().taskTenantId(tenantId)
.taskOwner(userId).taskDelegationState(DelegationState.PENDING)
.listPage((int) page.getStart(), page.getPageSize());
page.setResult(tasks);
page.setTotalCount(count);
return page;
}
示例8: Task
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
public Task(org.activiti.engine.task.Task taskInstance)
{
this.id = taskInstance.getId();
this.processId = taskInstance.getProcessInstanceId();
this.processDefinitionId = taskInstance.getProcessDefinitionId();
this.activityDefinitionId = taskInstance.getTaskDefinitionKey();
this.name = taskInstance.getName();
this.description = taskInstance.getDescription();
this.dueAt = taskInstance.getDueDate();
this.startedAt = taskInstance.getCreateTime();
this.priority = taskInstance.getPriority();
this.owner = taskInstance.getOwner();
this.assignee = taskInstance.getAssignee();
if (taskInstance.getDelegationState() == DelegationState.PENDING)
{
this.state = TaskStateTransition.DELEGATED.name().toLowerCase();
}
else if (taskInstance.getDelegationState() == DelegationState.RESOLVED)
{
this.state = TaskStateTransition.RESOLVED.name().toLowerCase();
}
else if (taskInstance.getAssignee() != null)
{
this.state = TaskStateTransition.CLAIMED.name().toLowerCase();
}
else
{
this.state = TaskStateTransition.UNCLAIMED.name().toLowerCase();
}
}
示例9: testTaskDelegate
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
/**
* 学习任务委派的过程,任务分配给bill,然后bill把任务委派给henryyan,henryyan处理完成后任务回归到bill
*/
@Deployment(resources = "diagrams/chapter12/taskDelegate.bpmn")
public void testTaskDelegate() throws Exception {
Map<String, Object> variables = new HashMap<String, Object>();
String userId = "bill";
variables.put("userId", userId);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("taskDelegateProcess", variables);
Task task = taskService.createTaskQuery().taskAssignee(userId).singleResult();
assertNotNull(task);
assertNull(task.getOwner());
// 委派任务给其他人
String delegatedUserId = "henryyan";
taskService.delegateTask(task.getId(), delegatedUserId);
// 查看数据状态
task = taskService.createTaskQuery().taskAssignee(delegatedUserId).taskDelegationState(DelegationState.PENDING).singleResult();
assertEquals(task.getOwner(), userId);
assertEquals(task.getAssignee(), delegatedUserId);
// 被委派人处理完成任务
taskService.resolveTask(task.getId());
// 任务回归到委派人
task = taskService.createTaskQuery().taskAssignee(userId).taskDelegationState(DelegationState.RESOLVED).singleResult();
assertEquals(task.getOwner(), userId);
assertEquals(task.getAssignee(), userId);
// 委派人完成任务
taskService.complete(task.getId());
long count = historyService.createHistoricProcessInstanceQuery().finished().count();
assertEquals(1, count);
}
示例10: testTaskDelegate
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
/**
* 学习任务委派的过程,任务分配给bill,然后bill把任务委派给henryyan,henryyan处理完成后任务回归到bill
*/
@Deployment(resources = "diagrams/chapter12/taskDelegate.bpmn")
public void testTaskDelegate() throws Exception {
Map<String, Object> variables = new HashMap<String, Object>();
String userId = "bill";
variables.put("userId", userId);
runtimeService.startProcessInstanceByKey("taskDelegateProcess", variables);
Task task = taskService.createTaskQuery().taskAssignee(userId).singleResult();
assertNotNull(task);
assertNull(task.getOwner());
// 委派任务给其他人
String delegatedUserId = "henryyan";
taskService.delegateTask(task.getId(), delegatedUserId);
// 查看数据状态
task = taskService.createTaskQuery().taskAssignee(delegatedUserId).taskDelegationState(DelegationState.PENDING).singleResult();
assertEquals(task.getOwner(), userId);
assertEquals(task.getAssignee(), delegatedUserId);
// 被委派人处理完成任务
taskService.resolveTask(task.getId());
// 任务回归到委派人
task = taskService.createTaskQuery().taskAssignee(userId).taskDelegationState(DelegationState.RESOLVED).singleResult();
assertEquals(task.getOwner(), userId);
assertEquals(task.getAssignee(), userId);
// 委派人完成任务
taskService.complete(task.getId());
long count = historyService.createHistoricProcessInstanceQuery().finished().count();
assertEquals(1, count);
}
示例11: testTaskDelegation
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
public void testTaskDelegation() {
Task task = taskService.newTask();
task.setOwner("johndoe");
task.delegate("joesmoe");
taskService.saveTask(task);
String taskId = task.getId();
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("joesmoe", task.getAssignee());
assertEquals(DelegationState.PENDING, task.getDelegationState());
taskService.resolveTask(taskId);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("johndoe", task.getAssignee());
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
task.setAssignee(null);
task.setDelegationState(null);
taskService.saveTask(task);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertNull(task.getAssignee());
assertNull(task.getDelegationState());
task.setAssignee("jackblack");
task.setDelegationState(DelegationState.RESOLVED);
taskService.saveTask(task);
task = taskService.createTaskQuery().taskId(taskId).singleResult();
assertEquals("johndoe", task.getOwner());
assertEquals("jackblack", task.getAssignee());
assertEquals(DelegationState.RESOLVED, task.getDelegationState());
// Finally, delete task
taskService.deleteTask(taskId, true);
}
示例12: getDelegationStateString
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
protected String getDelegationStateString(DelegationState state) {
String result = null;
if(state != null) {
result = state.toString().toLowerCase();
}
return result;
}
示例13: getDelegationState
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
protected DelegationState getDelegationState(String delegationState) {
if (delegationState != null) {
if (DelegationState.RESOLVED.name().toLowerCase().equals(delegationState)) {
return DelegationState.RESOLVED;
} else if (DelegationState.PENDING.name().toLowerCase().equals(delegationState)) {
return DelegationState.PENDING;
} else {
throw new ActivitiIllegalArgumentException("Illegal value for delegationState: " + delegationState);
}
}
return null;
}
示例14: taskDelegationState
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
public TaskQuery taskDelegationState(DelegationState delegationState) {
if (delegationState == null) {
this.noDelegationState = true;
} else {
this.delegationState = delegationState;
}
return this;
}
示例15: delegate
import org.activiti.engine.task.DelegationState; //导入依赖的package包/类
public void delegate(String userId) {
setDelegationState(DelegationState.PENDING);
if (getOwner() == null) {
setOwner(getAssignee());
}
setAssignee(userId);
}