当前位置: 首页>>代码示例>>Java>>正文


Java Task.getId方法代码示例

本文整理汇总了Java中org.camunda.bpm.engine.task.Task.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Task.getId方法的具体用法?Java Task.getId怎么用?Java Task.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.camunda.bpm.engine.task.Task的用法示例。


在下文中一共展示了Task.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: get

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
/**
 * Gets one task for specified id.
 *
 * <p>
 *     Task must be assigned or assignable to calling user (directly or via candidate group).
 * </p>
 * <p>
 *     This method will fail if no user is logged in.
 * </p>
 *
 * @param id Id of the task
 * @return A task
 */
public TaskDto get(String id) {
    Task task = getOwnTask(id);

    if (task == null) {
        task = getUnassignedTask(id);
    }

    if (task == null) {
        task = getUnassignedGroupTask(id);
    }

    if (task != null) {
        Map<String, String> businessKeys = getProcessBusinessKeys(asSet(task.getProcessInstanceId()));

        return new TaskDto(task.getId(), task.getTaskDefinitionKey(), task.getName(),
                task.getDescription(), task.getProcessInstanceId(),
                toInstant(task.getDueDate()), toInstant(task.getCreateTime()), null,
                businessKeys.get(task.getProcessInstanceId()),
                task.getAssignee(), null);
    } else {
        throw new MissingObject(TaskDto.class, id);
    }
}
 
开发者ID:LIBCAS,项目名称:ARCLib,代码行数:37,代码来源:TaskList.java

示例2: testCleanupHistoryCaseInstanceTaskAttachmentByteArray

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testCleanupHistoryCaseInstanceTaskAttachmentByteArray() {
  // given
  // create case instance
  CaseInstance caseInstance = caseService.createCaseInstanceByKey("oneTaskCase");

  Task task = taskService.createTaskQuery().singleResult();
  String taskId = task.getId();
  taskService.createAttachment("foo", taskId, null, "something", null, new ByteArrayInputStream("someContent".getBytes()));

  // assume
  List<Attachment> attachments = taskService.getTaskAttachments(taskId);
  assertEquals(1, attachments.size());
  String contentId = findAttachmentContentId(attachments);
  terminateAndCloseCaseInstance(caseInstance.getId(), null);

  // when
  historyService.deleteHistoricCaseInstancesBulk(Arrays.asList(caseInstance.getId()));

  // then
  attachments = taskService.getTaskAttachments(taskId);
  assertEquals(0, attachments.size());
  verifyByteArraysWereRemoved(contentId);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:BulkHistoryDeleteTest.java

示例3: testCompleteTaskWithParametersEmptyParameters

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testCompleteTaskWithParametersEmptyParameters() {
  Task task = taskService.newTask();
  taskService.saveTask(task);

  String taskId = task.getId();
  taskService.complete(taskId, Collections.EMPTY_MAP);

  if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
    historyService.deleteHistoricTaskInstance(taskId);
  }

  // Fetch the task again
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertNull(task);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:TaskServiceTest.java

示例4: testGetTaskCommentByTaskIdAndCommentId

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
public void testGetTaskCommentByTaskIdAndCommentId() {
  if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
    // create and save new task
    Task task = taskService.newTask();
    taskService.saveTask(task);

    String taskId = task.getId();

    // add comment to task
    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");

    // select task comment for task id and comment id
    comment = taskService.getTaskComment(taskId, comment.getId());
    // check returned comment
    assertNotNull(comment.getId());
    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());

    // delete task
    taskService.deleteTask(task.getId(), true);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:27,代码来源:TaskServiceTest.java

示例5: newTaskAssignee

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public AuthorizationEntity[] newTaskAssignee(Task task, String oldAssignee, String newAssignee) {
  if (newAssignee != null) {

    ensureValidIndividualResourceId("Cannot create default authorization for assignee " + newAssignee,
        newAssignee);

    // create (or update) an authorization for the new assignee.

    String taskId = task.getId();

    // fetch existing authorization
    AuthorizationEntity authorization = getGrantAuthorizationByUserId(newAssignee, TASK, taskId);

    // update authorization:
    // (1) fetched authorization == null -> create a new authorization (with READ and (UPDATE/TASK_WORK) permission)
    // (2) fetched authorization != null -> add READ and (UPDATE/TASK_WORK) permission
    // Update or TASK_WORK permission is configurable in camunda.cfg.xml and by default, UPDATE permission is provided
    authorization = updateAuthorization(authorization, newAssignee, null, TASK, taskId, READ, getDefaultUserPermissionForTask());

    // return always created or updated authorization
    return new AuthorizationEntity[]{ authorization };
  }

  return null;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:DefaultAuthorizationProvider.java

示例6: newTaskOwner

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public AuthorizationEntity[] newTaskOwner(Task task, String oldOwner, String newOwner) {
  if (newOwner != null) {

    ensureValidIndividualResourceId("Cannot create default authorization for owner " + newOwner,
        newOwner);

    // create (or update) an authorization for the new owner.
    String taskId = task.getId();

    // fetch existing authorization
    AuthorizationEntity authorization = getGrantAuthorizationByUserId(newOwner, TASK, taskId);

    // update authorization:
    // (1) fetched authorization == null -> create a new authorization (with READ and (UPDATE/TASK_WORK) permission)
    // (2) fetched authorization != null -> add READ and (UPDATE/TASK_WORK) permission
    // Update or TASK_WORK permission is configurable in camunda.cfg.xml and by default, UPDATE permission is provided
    authorization = updateAuthorization(authorization, newOwner, null, TASK, taskId, READ, getDefaultUserPermissionForTask());

    // return always created or updated authorization
    return new AuthorizationEntity[]{ authorization };
  }

  return null;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:DefaultAuthorizationProvider.java

示例7: newTaskUserIdentityLink

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
public AuthorizationEntity[] newTaskUserIdentityLink(Task task, String userId, String type) {
  // create (or update) an authorization for the given user
  // whenever a new user identity link will be added

  ensureValidIndividualResourceId("Cannot grant default authorization for identity link to user " + userId,
      userId);

  String taskId = task.getId();

  // fetch existing authorization
  AuthorizationEntity authorization = getGrantAuthorizationByUserId(userId, TASK, taskId);

  // update authorization:
  // (1) fetched authorization == null -> create a new authorization (with READ and (UPDATE/TASK_WORK) permission)
  // (2) fetched authorization != null -> add READ and (UPDATE or TASK_WORK) permission
  // Update or TASK_WORK permission is configurable in camunda.cfg.xml and by default, UPDATE permission is provided
  authorization = updateAuthorization(authorization, userId, null, TASK, taskId, READ, getDefaultUserPermissionForTask());

  // return always created or updated authorization
  return new AuthorizationEntity[]{ authorization };
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:DefaultAuthorizationProvider.java

示例8: testCompleteTaskWithParametersNullParameters

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
public void testCompleteTaskWithParametersNullParameters() {
  Task task = taskService.newTask();
  taskService.saveTask(task);

  String taskId = task.getId();
  taskService.complete(taskId, null);

  if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
    historyService.deleteHistoricTaskInstance(taskId);
  }

  // Fetch the task again
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertNull(task);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:TaskServiceTest.java

示例9: testResolveTaskWithParametersEmptyParameters

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
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().getId()>= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT) {
    historyService.deleteHistoricTaskInstance(taskId);
  }

  // Fetch the task again
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertEquals(DelegationState.RESOLVED, task.getDelegationState());

  taskService.deleteTask(taskId, true);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:TaskServiceTest.java

示例10: testInitSynchronization

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
@ScenarioUnderTest("init.1")
public void testInitSynchronization() {
  // given
  Task eventSubProcessTask1 = rule.taskQuery().taskDefinitionKey("innerEventSubProcessTask1").singleResult();
  Task eventSubProcessTask2 = rule.taskQuery().taskDefinitionKey("innerEventSubProcessTask2").singleResult();

  // when
  CompleteTaskThread completeTaskThread1 = new CompleteTaskThread(eventSubProcessTask1.getId(),
      (ProcessEngineConfigurationImpl) rule.getProcessEngine().getProcessEngineConfiguration());

  CompleteTaskThread completeTaskThread2 = new CompleteTaskThread(eventSubProcessTask2.getId(),
      (ProcessEngineConfigurationImpl) rule.getProcessEngine().getProcessEngineConfiguration());

  completeTaskThread1.startAndWaitUntilControlIsReturned();
  completeTaskThread2.startAndWaitUntilControlIsReturned();

  completeTaskThread1.proceedAndWaitTillDone();
  completeTaskThread2.proceedAndWaitTillDone();

  // then
  Assert.assertNull(completeTaskThread1.getException());
  Assert.assertNotNull(completeTaskThread2.getException());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:NestedInterruptingEventSubprocessParallelScenarioTest.java

示例11: testGetIdentityLinksWithNonExistingOwner

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
public void testGetIdentityLinksWithNonExistingOwner() {
  Task task = taskService.newTask();
  taskService.saveTask(task);
  String taskId = task.getId();

  taskService.claim(taskId, "nonExistingOwner");
  taskService.delegateTask(taskId, "nonExistingAssignee");
  List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
  assertEquals(2, identityLinks.size());

  IdentityLink assignee = identityLinks.get(0);
  assertEquals("nonExistingAssignee", assignee.getUserId());
  assertNull(assignee.getGroupId());
  assertEquals(IdentityLinkType.ASSIGNEE, assignee.getType());

  IdentityLink owner = identityLinks.get(1);
  assertEquals("nonExistingOwner", owner.getUserId());
  assertNull(owner.getGroupId());
  assertEquals(IdentityLinkType.OWNER, owner.getType());

  //cleanup
  taskService.deleteTask(taskId, true);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:TaskServiceTest.java

示例12: testGetTaskAttachmentContentByTaskIdAndAttachmentId

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
public void testGetTaskAttachmentContentByTaskIdAndAttachmentId() {
  int historyLevel = processEngineConfiguration.getHistoryLevel().getId();
  if (historyLevel> ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
    // create and save task
    Task task = taskService.newTask();
    taskService.saveTask(task);
    String taskId = task.getId();

    // Fetch the task again and update
    // add attachment
    Attachment attachment = taskService.createAttachment("web page", taskId, "someprocessinstanceid", "weatherforcast", "temperatures and more", new ByteArrayInputStream("someContent".getBytes()));
    String attachmentId = attachment.getId();

    // get attachment for taskId and attachmentId
    InputStream taskAttachmentContent = taskService.getTaskAttachmentContent(taskId, attachmentId);
    assertNotNull(taskAttachmentContent);

    byte[] byteContent = IoUtil.readInputStream(taskAttachmentContent, "weatherforcast");
    assertEquals("someContent", new String(byteContent));

    taskService.deleteTask(taskId, true);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:TaskServiceTest.java

示例13: testGetIdentityLinksWithAssignee

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Test
public void testGetIdentityLinksWithAssignee() {
  Task task = taskService.newTask();
  taskService.saveTask(task);
  String taskId = task.getId();

  identityService.saveUser(identityService.newUser("kermit"));

  taskService.claim(taskId, "kermit");
  List<IdentityLink> identityLinks = taskService.getIdentityLinksForTask(taskId);
  assertEquals(1, identityLinks.size());
  assertEquals("kermit", identityLinks.get(0).getUserId());
  assertNull(identityLinks.get(0).getGroupId());
  assertEquals(IdentityLinkType.ASSIGNEE, identityLinks.get(0).getType());

  //cleanup
  taskService.deleteTask(taskId, true);
  identityService.deleteUser("kermit");
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:20,代码来源:TaskServiceTest.java

示例14: testReleaseTask

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
@Deployment
public void testReleaseTask() throws Exception {
  runtimeService.startProcessInstanceByKey("releaseTaskProcess");
  
  Task task = taskService.createTaskQuery().taskAssignee("fozzie").singleResult();
  assertNotNull(task);
  String taskId = task.getId();
  
  // Set assignee to null
  taskService.setAssignee(taskId, null);
  
  task = taskService.createTaskQuery().taskAssignee("fozzie").singleResult();
  assertNull(task);
  
  task = taskService.createTaskQuery().taskId(taskId).singleResult();
  assertNotNull(task);
  assertNull(task.getAssignee());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:CustomTaskAssignmentTest.java

示例15: updateFollowUpDate

import org.camunda.bpm.engine.task.Task; //导入方法依赖的package包/类
/**
 * Test to update the followUp date of a given user task instance. Also check of task scope
 * variables are not changed.
 */
@Test
public void updateFollowUpDate() {

    ProcessInstance processInstance =
            runtimeService.startProcessInstanceByKey("demoProcessWithTimerCycle");
    Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId())
            .singleResult();
    runtimeService.setVariableLocal(task.getExecutionId(), "foo", "bar");

    String taskInstanceId = task.getId();
    String taskExecutionId = task.getExecutionId();

    // followUpDate is set in BPM diagram
    assertNotNull(task.getFollowUpDate());

    // now unset followUpDate
    task.setFollowUpDate(null);
    taskService.saveTask(task);

    // request task
    Task task1 = taskService.createTaskQuery().processInstanceId(processInstance.getId())
            .singleResult();

    // check task properties
    assertEquals(taskInstanceId, task1.getId());
    assertEquals(taskExecutionId, task1.getExecutionId());
    assertNull(task.getFollowUpDate());

    // check task scope variable
    assertEquals("bar", runtimeService.getVariableLocal(task.getExecutionId(), "foo"));

    // cleanup after test
    runtimeService.deleteProcessInstance(processInstance.getId(), "JUnit test");

}
 
开发者ID:FrVaBe,项目名称:camunda,代码行数:40,代码来源:UserTaskTest.java


注:本文中的org.camunda.bpm.engine.task.Task.getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。