本文整理汇总了Java中org.camunda.bpm.engine.task.Task.setOwner方法的典型用法代码示例。如果您正苦于以下问题:Java Task.setOwner方法的具体用法?Java Task.setOwner怎么用?Java Task.setOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.task.Task
的用法示例。
在下文中一共展示了Task.setOwner方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAssignSameAssigneeAndOwnerToTask
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public void testAssignSameAssigneeAndOwnerToTask() {
// given
createGrantAuthorization(Resources.TASK, Authorization.ANY, userId, Permissions.ALL);
// when
Task newTask = taskService.newTask();
newTask.setAssignee("Horst");
newTask.setOwner("Horst");
// then
try {
taskService.saveTask(newTask);
} catch (Exception e) {
fail("Setting same assignee and owner to user should not fail!");
}
taskService.deleteTask(newTask.getId(), true);
}
示例2: testPermissionsOnAssignSameAssigneeAndOwnerToTask
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public void testPermissionsOnAssignSameAssigneeAndOwnerToTask() {
try {
// given
createGrantAuthorization(Resources.TASK, Authorization.ANY, userId, Permissions.CREATE, Permissions.DELETE, Permissions.READ);
processEngineConfiguration.setResourceAuthorizationProvider(new MyExtendedPermissionDefaultAuthorizationProvider());
// when
Task newTask = taskService.newTask();
newTask.setAssignee("Horst");
newTask.setOwner("Horst");
taskService.saveTask(newTask);
// then
Authorization auth = authorizationService.createAuthorizationQuery().userIdIn("Horst").singleResult();
assertTrue(auth.isPermissionGranted(Permissions.DELETE_HISTORY));
taskService.deleteTask(newTask.getId(), true);
} finally {
processEngineConfiguration.setResourceAuthorizationProvider(new DefaultAuthorizationProvider());
}
}
示例3: testTaskOwner
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
public void testTaskOwner() {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
// Fetch the task again and update
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertEquals("johndoe", task.getOwner());
task.setOwner("joesmoe");
taskService.saveTask(task);
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertEquals("joesmoe", task.getOwner());
// Finally, delete task
taskService.deleteTask(task.getId(), true);
}
示例4: testSetDelegationState
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
/**
* @see http://jira.codehaus.org/browse/ACT-1059
*/
@Test
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);
}
示例5: createTasks
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
protected void createTasks() {
Task task = taskService.newTask("task1");
task.setName("Task 1");
task.setOwner(testUser.getId());
task.setDelegationState(DelegationState.PENDING);
taskService.saveTask(task);
taskService.addCandidateGroup(task.getId(), "accounting");
task = taskService.newTask("task2");
task.setName("Task 2");
task.setOwner(testUser.getId());
task.setDelegationState(DelegationState.RESOLVED);
taskService.saveTask(task);
taskService.setAssignee(task.getId(), "kermit");
taskService.addCandidateGroup(task.getId(), "accounting");
task = taskService.newTask("task3");
task.setName("Task 3");
task.setOwner(testUser.getId());
task.setDelegationState(DelegationState.RESOLVED);
taskService.saveTask(task);
}
示例6: testStandaloneTaskSetOwnerOutsideCommandContextInsert
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public void testStandaloneTaskSetOwnerOutsideCommandContextInsert() {
// given
String taskId = "myTask";
createGrantAuthorization(TASK, ANY, userId, CREATE);
createGrantAuthorization(TASK, taskId, userId, UPDATE);
Task task = taskService.newTask(taskId);
task.setOwner("demo");
// when
taskService.saveTask(task);
// then
disableAuthorization();
Authorization authorization = authorizationService
.createAuthorizationQuery()
.userIdIn("demo")
.singleResult();
enableAuthorization();
assertNotNull(authorization);
assertEquals(TASK.resourceType(), authorization.getResourceType());
assertEquals(taskId, authorization.getResourceId());
assertTrue(authorization.isPermissionGranted(READ));
assertTrue(authorization.isPermissionGranted(getDefaultTaskPermissionForUser()));
deleteTask(taskId, true);
}
示例7: testStandaloneTaskSetOwnerOutsideCommandContextSave
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public void testStandaloneTaskSetOwnerOutsideCommandContextSave() {
// given
String taskId = "myTask";
createTask(taskId);
createGrantAuthorization(TASK, taskId, userId, UPDATE);
Task task = selectSingleTask();
task.setOwner("demo");
// when
taskService.saveTask(task);
// then
disableAuthorization();
Authorization authorization = authorizationService
.createAuthorizationQuery()
.userIdIn("demo")
.singleResult();
enableAuthorization();
assertNotNull(authorization);
assertEquals(TASK.resourceType(), authorization.getResourceType());
assertEquals(taskId, authorization.getResourceId());
assertTrue(authorization.isPermissionGranted(READ));
assertTrue(authorization.isPermissionGranted(getDefaultTaskPermissionForUser()));
deleteTask(taskId, true);
}
示例8: testStandaloneTaskSaveWithGenericResourceIdOwner
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public void testStandaloneTaskSaveWithGenericResourceIdOwner() {
createGrantAuthorization(TASK, ANY, userId, CREATE);
Task task = taskService.newTask();
task.setOwner("*");
try {
taskService.saveTask(task);
fail("it should not be possible to save a task with the generic resource id *");
} catch (ProcessEngineException e) {
assertTextPresent("Cannot create default authorization for owner *: "
+ "id cannot be *. * is a reserved identifier", e.getMessage());
}
}
示例9: testTaskComments
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
public void testTaskComments() {
int historyLevel = processEngineConfiguration.getHistoryLevel().getId();
if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
identityService.setAuthenticatedUserId("johndoe");
// Fetch the task again and update
Comment comment = taskService.createComment(taskId, null, "look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd");
assertNotNull(comment.getId());
assertEquals("johndoe", comment.getUserId());
assertEquals(taskId, comment.getTaskId());
assertNull(comment.getProcessInstanceId());
assertEquals("look at this isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg ...", ((Event)comment).getMessage());
assertEquals("look at this \n isn't this great? slkdjf sldkfjs ldkfjs ldkfjs ldkfj sldkfj sldkfj sldkjg laksfg sdfgsd;flgkj ksajdhf skjdfh ksjdhf skjdhf kalskjgh lskh dfialurhg kajsh dfuieqpgkja rzvkfnjviuqerhogiuvysbegkjz lkhf ais liasduh flaisduh ajiasudh vaisudhv nsfd", comment.getFullMessage());
assertNotNull(comment.getTime());
taskService.createComment(taskId, "pid", "one");
taskService.createComment(taskId, "pid", "two");
Set<String> expectedComments = new HashSet<String>();
expectedComments.add("one");
expectedComments.add("two");
Set<String> comments = new HashSet<String>();
for (Comment cmt: taskService.getProcessInstanceComments("pid")) {
comments.add(cmt.getFullMessage());
}
assertEquals(expectedComments, comments);
// Finally, delete task
taskService.deleteTask(taskId, true);
}
}
示例10: testTaskAttachments
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
public void testTaskAttachments() {
int historyLevel = processEngineConfiguration.getHistoryLevel().getId();
if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
Task task = taskService.newTask();
task.setOwner("johndoe");
taskService.saveTask(task);
String taskId = task.getId();
identityService.setAuthenticatedUserId("johndoe");
// Fetch the task again and update
taskService.createAttachment("web page", taskId, "someprocessinstanceid", "weatherforcast", "temperatures and more", "http://weather.com");
Attachment attachment = taskService.getTaskAttachments(taskId).get(0);
assertEquals("weatherforcast", attachment.getName());
assertEquals("temperatures and more", attachment.getDescription());
assertEquals("web page", attachment.getType());
assertEquals(taskId, attachment.getTaskId());
assertEquals("someprocessinstanceid", attachment.getProcessInstanceId());
assertEquals("http://weather.com", attachment.getUrl());
assertNull(taskService.getAttachmentContent(attachment.getId()));
// Finally, clean up
taskService.deleteTask(taskId);
assertEquals(0, taskService.getTaskComments(taskId).size());
assertEquals(1, historyService.createHistoricTaskInstanceQuery().taskId(taskId).list().size());
taskService.deleteTask(taskId, true);
}
}
示例11: testTaskDelegation
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
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: testTaskDelegationThroughServiceCall
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
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);
}
示例13: shouldReturnTasksWithMultipleOrCriteria
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
public void shouldReturnTasksWithMultipleOrCriteria() {
// given
Task task1 = taskService.newTask();
task1.setName("aTaskName");
taskService.saveTask(task1);
Task task2 = taskService.newTask();
task2.setDescription("aTaskDescription");
taskService.saveTask(task2);
Task task3 = taskService.newTask();
taskService.saveTask(task3);
Task task4 = taskService.newTask();
task4.setPriority(5);
taskService.saveTask(task4);
Task task5 = taskService.newTask();
task5.setOwner("aTaskOwner");
taskService.saveTask(task5);
// when
List<Task> tasks = taskService.createTaskQuery()
.or()
.taskName("aTaskName")
.taskDescription("aTaskDescription")
.taskId(task3.getId())
.taskPriority(5)
.taskOwner("aTaskOwner")
.endOr()
.list();
// then
assertEquals(5, tasks.size());
}
示例14: testShouldAddIdentityLinkForTaskCreationWithAssigneeAndOwner
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public void testShouldAddIdentityLinkForTaskCreationWithAssigneeAndOwner() {
String taskAssigneeId = "Assigneee";
String taskOwnerId = "Owner";
// Pre test
List<HistoricIdentityLinkLog> historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 0);
Task taskAssignee = taskService.newTask(taskAssigneeId);
taskAssignee.setAssignee(USER_1);
taskService.saveTask(taskAssignee);
Task taskOwner = taskService.newTask(taskOwnerId);
taskOwner.setOwner(OWNER_1);
taskService.saveTask(taskOwner);
Task taskEmpty = taskService.newTask();
taskService.saveTask(taskEmpty);
// then
historicIdentityLinks = historyService.createHistoricIdentityLinkLogQuery().list();
assertEquals(historicIdentityLinks.size(), 2);
// Basic Query test
HistoricIdentityLinkLogQuery query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.type(IdentityLinkType.ASSIGNEE).count(), 1);
assertEquals(query.userId(USER_1).count(), 1);
query = historyService.createHistoricIdentityLinkLogQuery();
assertEquals(query.type(IdentityLinkType.OWNER).count(), 1);
assertEquals(query.userId(OWNER_1).count(), 1);
taskService.deleteTask(taskAssigneeId,true);
taskService.deleteTask(taskOwnerId,true);
taskService.deleteTask(taskEmpty.getId(), true);
}
示例15: testDeleteOwner
import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public void testDeleteOwner() {
Task task = taskService.newTask();
task.setOwner("nonExistingUser");
taskService.saveTask(task);
taskService.deleteUserIdentityLink(task.getId(), "nonExistingUser", IdentityLinkType.OWNER);
task = taskService.createTaskQuery().taskId(task.getId()).singleResult();
assertNull(task.getOwner());
assertEquals(0, taskService.getIdentityLinksForTask(task.getId()).size());
// cleanup
taskService.deleteTask(task.getId(), true);
}