• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ClockUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.camunda.bpm.engine.impl.util.ClockUtil的典型用法代码示例。如果您正苦于以下问题:Java ClockUtil类的具体用法?Java ClockUtil怎么用?Java ClockUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ClockUtil类属于org.camunda.bpm.engine.impl.util包,在下文中一共展示了ClockUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: executeImpl

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
@Override
public void executeImpl(ProcessEngine engine) {
  if (workItem.isSuspended())
    return;

  if (workItem instanceof TimerEntity) {
    /*
     * Caused by DurationHelper.getDateAfterRepeat: return next.before(date)
     * ? null : next;
     * 
     * This leads to endless loop if we call a timer job at exactly the time
     * it will schedule next. Cannot be handled by engine, because there is
     * no "counter" in the database for executions - it has to trust the
     * clock on the wall.
     */
    Calendar cal = Calendar.getInstance();
    cal.setTime(ClockUtil.getCurrentTime());
    cal.add(Calendar.MILLISECOND, 1);
    ClockUtil.setCurrentTime(cal.getTime());
  }
  engine.getManagementService().executeJob(workItem.getId());
}
 
开发者ID:camunda-consulting,项目名称:camunda-util-demo-data-generator,代码行数:23,代码来源:TimeAwareDemoGenerator.java


示例2: prepareProcessInstances

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
protected void prepareProcessInstances(String key, int daysInThePast, Integer historyTimeToLive, int instanceCount) {
  ProcessDefinition processDefinition = selectProcessDefinitionByKey(key);
  disableAuthorization();
  repositoryService.updateProcessDefinitionHistoryTimeToLive(processDefinition.getId(), historyTimeToLive);
  enableAuthorization();

  Date oldCurrentTime = ClockUtil.getCurrentTime();
  ClockUtil.setCurrentTime(DateUtils.addDays(new Date(), daysInThePast));

  List<String> processInstanceIds = new ArrayList<String>();
  for (int i = 0; i < instanceCount; i++) {
    ProcessInstance processInstance = startProcessInstanceByKey(key);
    processInstanceIds.add(processInstance.getId());
  }

  disableAuthorization();
  runtimeService.deleteProcessInstances(processInstanceIds, null, true, true);
  enableAuthorization();

  ClockUtil.setCurrentTime(oldCurrentTime);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:HistoricProcessInstanceAuthorizationTest.java


示例3: testHistoryCleanupWithoutAuthorization

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/dmn/businessruletask/DmnBusinessRuleTaskTest.testDecisionRef.bpmn20.xml",
    "org/camunda/bpm/engine/test/api/history/testDmnWithPojo.dmn11.xml", "org/camunda/bpm/engine/test/api/authorization/oneTaskCase.cmmn" })
public void testHistoryCleanupWithoutAuthorization() {
  // given
  prepareInstances(5, 5, 5);

  ClockUtil.setCurrentTime(new Date());

  try {
    // when
    historyService.cleanUpHistoryAsync(true).getId();
    fail("Exception expected: It should not be possible to execute the history cleanup");
  } catch (AuthorizationException e) {
    // then
    String message = e.getMessage();
    assertTextPresent(Groups.CAMUNDA_ADMIN, message);
    assertTextPresent("Required authenticated group", message);
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:HistoryCleanupAuthorizationTest.java


示例4: prepareCaseInstances

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
private void prepareCaseInstances(String key, int daysInThePast, Integer historyTimeToLive, int instanceCount) {
  // update time to live
  List<CaseDefinition> caseDefinitions = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).list();
  assertEquals(1, caseDefinitions.size());
  repositoryService.updateCaseDefinitionHistoryTimeToLive(caseDefinitions.get(0).getId(), historyTimeToLive);

  Date oldCurrentTime = ClockUtil.getCurrentTime();
  ClockUtil.setCurrentTime(DateUtils.addDays(oldCurrentTime, daysInThePast));

  for (int i = 0; i < instanceCount; i++) {
    CaseInstance caseInstance = caseService.createCaseInstanceByKey(key);
    caseService.terminateCaseExecution(caseInstance.getId());
    caseService.closeCaseInstance(caseInstance.getId());
  }

  ClockUtil.setCurrentTime(oldCurrentTime);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:CleanableHistoricCaseInstanceReportTest.java


示例5: testJobNotExecutedAfterProcessInstanceSuspendByProcessDefinitionKey

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
@Deployment(resources = {"org/camunda/bpm/engine/test/api/runtime/ProcessInstanceSuspensionTest.testJobNotExecutedAfterProcessInstanceSuspend.bpmn20.xml"})
public void testJobNotExecutedAfterProcessInstanceSuspendByProcessDefinitionKey() {

  Date now = new Date();
  ClockUtil.setCurrentTime(now);

  // Suspending the process instance should also stop the execution of jobs for that process instance
  ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().singleResult();
  runtimeService.startProcessInstanceById(processDefinition.getId());
  assertEquals(1, managementService.createJobQuery().count());
  runtimeService.suspendProcessInstanceByProcessDefinitionKey(processDefinition.getKey());
  assertEquals(1, managementService.createJobQuery().count());

  // The jobs should not be executed now
  ClockUtil.setCurrentTime(new Date(now.getTime() + (60 * 60 * 1000))); // Timer is set to fire on 5 minutes
  assertEquals(0, managementService.createJobQuery().executable().count());

  // Activation of the process instance should now allow for job execution
  runtimeService.activateProcessInstanceByProcessDefinitionKey(processDefinition.getKey());
  assertEquals(1, managementService.createJobQuery().executable().count());
  managementService.executeJob(managementService.createJobQuery().singleResult().getId());
  assertEquals(0, managementService.createJobQuery().count());
  assertEquals(0, runtimeService.createProcessInstanceQuery().count());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:ProcessInstanceSuspensionTest.java


示例6: hintJobExecutor

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
protected void hintJobExecutor(JobEntity job) {
  JobExecutor jobExecutor = Context.getProcessEngineConfiguration().getJobExecutor();
  if (!jobExecutor.isActive()) {
    return;
  }

  JobExecutorContext jobExecutorContext = Context.getJobExecutorContext();
  TransactionListener transactionListener = null;
  if(!job.isSuspended()
          && job.isExclusive()
          && jobExecutorContext != null
          && jobExecutorContext.isExecutingExclusiveJob()
          && areInSameProcessInstance(job, jobExecutorContext.getCurrentJob())) {
    // lock job & add to the queue of the current processor
    Date currentTime = ClockUtil.getCurrentTime();
    job.setLockExpirationTime(new Date(currentTime.getTime() + jobExecutor.getLockTimeInMillis()));
    job.setLockOwner(jobExecutor.getLockOwner());
    transactionListener = new ExclusiveJobAddedNotification(job.getId(), jobExecutorContext);
  } else {
    // notify job executor:
    transactionListener = new MessageAddedNotification(jobExecutor);
  }
  Context.getCommandContext()
    .getTransactionContext()
    .addTransactionListener(TransactionState.COMMITTED, transactionListener);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:27,代码来源:JobManager.java


示例7: testHistoricProcInstExecutedActivityWithEmptyInterval

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
@Test
public void testHistoricProcInstExecutedActivityWithEmptyInterval() {
  // given
  Calendar now = Calendar.getInstance();
  ClockUtil.setCurrentTime(now.getTime());
  BpmnModelInstance model = Bpmn.createExecutableProcess("proc").startEvent().endEvent().done();
  deployment(model);

  Calendar hourBeforeNow = (Calendar) now.clone();
  hourBeforeNow.add(Calendar.HOUR, -1);

  runtimeService.startProcessInstanceByKey("proc");

  //when query historic proc inst which executes an activity an hour before and after the starting time
  HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
    .executedActivityBefore(hourBeforeNow.getTime())
    .executedActivityAfter(hourBeforeNow.getTime()).singleResult();

  //then query returns no result
  assertNull(historicProcessInstance);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:HistoricProcessInstanceTest.java


示例8: execute

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
public void execute(DelegateExecution execution) throws Exception {
  
  SimpleDateFormat sdf =  new SimpleDateFormat("dd/MM/yyyy hh:mm:ss SSS");
  // We set the time to check of the updated time is picked up in the history
  Date updatedDate = sdf.parse("01/01/2001 01:23:46 000");
  ClockUtil.setCurrentTime(updatedDate);
  
  
  execution.setVariable("aVariable", "updated value");
  execution.setVariable("bVariable", 123);
  execution.setVariable("cVariable", 12345L);
  execution.setVariable("dVariable", 1234.567);
  execution.setVariable("eVariable", (short)12);
  
  Date theDate =sdf.parse("01/01/2001 01:23:45 678");
  execution.setVariable("fVariable", theDate);
  
  execution.setVariable("gVariable", new SerializableVariable("hello hello"));
  execution.setVariable("hVariable", ";-)".getBytes());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:21,代码来源:VariableSetter.java


示例9: testIdlingWithHint

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
public void testIdlingWithHint(JobCreationInCycle jobCreationInCycle) {
  initAcquisitionAndIdleToMaxTime();

  final Date startTime = new Date();
  ProcessInstance procInstance = jobCreationInCycle.createJobAndContinueCycle();

   // After process start, there should be 1 timer created
  Task task1 = engineRule.getTaskService().createTaskQuery().singleResult();
  assertEquals("Timer Task", task1.getName());
  //and one job
  JobQuery jobQuery = engineRule.getManagementService().createJobQuery().processInstanceId(
          procInstance.getId());
  Job job = jobQuery.singleResult();
  assertNotNull(job);

  // the hint of the added job resets the idle time
  // => 0 jobs are acquired so we had to wait BASE IDLE TIME
  //after this time we can acquire the timer
  triggerReconfigurationAndNextCycle();
  assertJobExecutorWaitEvent(BASE_IDLE_WAIT_TIME);

  //time is increased so timer is found
  ClockUtil.setCurrentTime(new Date(startTime.getTime() + BASE_IDLE_WAIT_TIME));
  //now we are able to acquire the job
  cycleAcquisitionAndAssertAfterJobExecution(jobQuery);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:27,代码来源:JobAcquisitionBackoffIdleTest.java


示例10: getHistoryCleanupConfiguration

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
public HistoryCleanupConfigurationDto getHistoryCleanupConfiguration() {
  HistoryCleanupConfigurationDto configurationDto = new HistoryCleanupConfigurationDto();
  Date startTime = ((ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration())
      .getHistoryCleanupBatchWindowStartTimeAsDate();
  Date endTime = ((ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration())
      .getHistoryCleanupBatchWindowEndTimeAsDate();
  if (startTime == null || endTime == null) {
    return configurationDto;
  }
  Date now = ClockUtil.getCurrentTime();
  Date startDate = HistoryCleanupHelper.getCurrentOrNextBatchWindowStartTime(now, startTime, endTime);
  Date endDate = HistoryCleanupHelper.getNextBatchWindowEndTime(now, endTime);
  configurationDto.setBatchWindowStartTime(startDate);
  configurationDto.setBatchWindowEndTime(endDate);
  return configurationDto;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:17,代码来源:HistoryCleanupRestServiceImpl.java


示例11: testNotEnoughTimeToDeleteEverything

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
@Test
public void testNotEnoughTimeToDeleteEverything() {
  //given
  //we have something to cleanup
  prepareData(40);
  //we call history cleanup within batch window
  Date now = new Date();
  ClockUtil.setCurrentTime(now);
  processEngineConfiguration.setHistoryCleanupBatchWindowStartTime(new SimpleDateFormat("HH:mm").format(now));
  processEngineConfiguration.setHistoryCleanupBatchWindowEndTime(new SimpleDateFormat("HH:mm").format(DateUtils.addHours(now, HISTORY_TIME_TO_LIVE)));
  processEngineConfiguration.initHistoryCleanup();
  String jobId = historyService.cleanUpHistoryAsync().getId();
  //job is executed once within batch window
  managementService.executeJob(jobId);

  //when
  //time passed -> outside batch window
  ClockUtil.setCurrentTime(DateUtils.addHours(now, 6));
  //the job is called for the second time
  managementService.executeJob(jobId);

  //then
  //second execution was not able to delete rest data
  assertResult(20);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:HistoryCleanupTest.java


示例12: testHistoryCleanupNothingRemoved

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/dmn/businessruletask/DmnBusinessRuleTaskTest.testDecisionRef.bpmn20.xml",
    "org/camunda/bpm/engine/test/api/history/testDmnWithPojo.dmn11.xml", "org/camunda/bpm/engine/test/api/authorization/oneTaskCase.cmmn" })
public void testHistoryCleanupNothingRemoved() {
  // given
  prepareInstances(null, null, null);

  ClockUtil.setCurrentTime(new Date());
  // when
  String jobId = historyService.cleanUpHistoryAsync(true).getId();

  managementService.executeJob(jobId);

  // then
  assertEquals(PROCESS_INSTANCES_COUNT, historyService.createHistoricProcessInstanceQuery().count());
  assertEquals(DECISION_INSTANCES_COUNT + DECISIONS_IN_PROCESS_INSTANCES, historyService.createHistoricDecisionInstanceQuery().count());
  assertEquals(CASE_INSTANCES_COUNT, historyService.createHistoricCaseInstanceQuery().count());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:HistoryCleanupTest.java


示例13: testReportZeroTTL

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
@Test
public void testReportZeroTTL() {
  Map<String, String> map = new HashMap<String, String>();
  int modOperationsTTL = 0;
  map.put("instance-modification", "P0D");
  processEngineConfiguration.setBatchOperationsForHistoryCleanup(map);
  processEngineConfiguration.initHistoryCleanup();

  Date startDate = ClockUtil.getCurrentTime();
  int daysInThePast = -11;
  ClockUtil.setCurrentTime(DateUtils.addDays(startDate, daysInThePast));

  Batch modificationBatch = createModificationBatch();
  ClockUtil.setCurrentTime(DateUtils.addDays(startDate, -7));

  managementService.deleteBatch(modificationBatch.getId(), false);

  CleanableHistoricBatchReportResult result = historyService.createCleanableHistoricBatchReport().singleResult();
  assertNotNull(result);
  checkResultNumbers(result, 1, 1, modOperationsTTL);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:CleanableHistoricBatchReportTest.java


示例14: testHandleBpmnErrorLockExpiredTask

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/twoExternalTaskProcess.bpmn20.xml")
public void testHandleBpmnErrorLockExpiredTask() {
  //given
  runtimeService.startProcessInstanceByKey("twoExternalTaskProcess");
  // when
  List<LockedExternalTask> externalTasks = externalTaskService.fetchAndLock(1, WORKER_ID)
    .topic(TOPIC_NAME, LOCK_TIME)
    .execute();

  // and the lock expires without the task being reclaimed
  ClockUtil.setCurrentTime(new DateTime(ClockUtil.getCurrentTime()).plus(LOCK_TIME * 2).toDate());

  externalTaskService.handleBpmnError(externalTasks.get(0).getId(), WORKER_ID, "ERROR-OCCURED");

  externalTasks = externalTaskService.fetchAndLock(1, WORKER_ID)
    .topic(TOPIC_NAME, LOCK_TIME)
    .execute();

  assertEquals(0, externalTasks.size());
  assertEquals(0, externalTaskService.createExternalTaskQuery().count());
  Task afterBpmnError = taskService.createTaskQuery().singleResult();
  assertNotNull(afterBpmnError);
  assertEquals(afterBpmnError.getTaskDefinitionKey(), "afterBpmnError");
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:ExternalTaskServiceTest.java


示例15: testDeleteGroupLinkEvents

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
public void testDeleteGroupLinkEvents() {

    // initially there are no task events
    assertTrue(taskService.getTaskEvents(task.getId()).isEmpty());

    taskService.addCandidateGroup(task.getId(), ACCOUNTING);

    ClockUtil.setCurrentTime(new Date(ClockUtil.getCurrentTime().getTime() + 5000));

    taskService.deleteCandidateGroup(task.getId(), ACCOUNTING);

    // now there is a task event created
    List<Event> events = taskService.getTaskEvents(task.getId());
    assertEquals(2, events.size());
    Event event = events.get(0);
    assertEquals(ACCOUNTING, event.getMessageParts().get(0));
    assertEquals(CANDIDATE, event.getMessageParts().get(1));
    assertEquals(task.getId(), event.getTaskId());
    assertEquals(ACTION_DELETE_GROUP_LINK, event.getAction());
    assertEquals(ACCOUNTING + CommentEntity.MESSAGE_PARTS_MARKER + CANDIDATE, event.getMessage());
    assertEquals(null, event.getProcessInstanceId());
    assertNotNull(event.getTime().getTime() <= ClockUtil.getCurrentTime().getTime());

    assertNoCommentsForTask();
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:TaskEventsTest.java


示例16: createCaseInstanceCloseEvt

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
public HistoryEvent createCaseInstanceCloseEvt(DelegateCaseExecution caseExecution) {
  final CaseExecutionEntity caseExecutionEntity = (CaseExecutionEntity) caseExecution;

  // create event instance
  HistoricCaseInstanceEventEntity evt = loadCaseInstanceEventEntity(caseExecutionEntity);

  // initialize event
  initCaseInstanceEvent(evt, caseExecutionEntity, HistoryEventTypes.CASE_INSTANCE_CLOSE);

  // set end time
  evt.setEndTime(ClockUtil.getCurrentTime());

  if (evt.getStartTime() != null) {
    evt.setDurationInMillis(evt.getEndTime().getTime() - evt.getStartTime().getTime());
  }

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


示例17: testSuspendStandaloneJobById

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
public void testSuspendStandaloneJobById() {
  // given
  createGrantAuthorization(PROCESS_DEFINITION, TIMER_START_PROCESS_KEY, userId, UPDATE);

  Date startTime = new Date();
  ClockUtil.setCurrentTime(startTime);
  long oneWeekFromStartTime = startTime.getTime() + (7 * 24 * 60 * 60 * 1000);

  disableAuthorization();
  // creates a new "standalone" job
  managementService.suspendJobDefinitionByProcessDefinitionKey(TIMER_START_PROCESS_KEY, false, new Date(oneWeekFromStartTime));
  enableAuthorization();

  String jobId = managementService.createJobQuery().singleResult().getId();

  // when
  managementService.suspendJobById(jobId);

  // then
  Job job = selectJobById(jobId);
  assertNotNull(job);
  assertTrue(job.isSuspended());

  deleteJob(jobId);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:JobAuthorizationTest.java


示例18: initUserOperationLogEvent

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
protected void initUserOperationLogEvent(UserOperationLogEntryEventEntity evt, UserOperationLogContext context,
    UserOperationLogContextEntry contextEntry, PropertyChange propertyChange) {
  // init properties
  evt.setDeploymentId(contextEntry.getDeploymentId());
  evt.setEntityType(contextEntry.getEntityType());
  evt.setOperationType(contextEntry.getOperationType());
  evt.setOperationId(context.getOperationId());
  evt.setUserId(context.getUserId());
  evt.setProcessDefinitionId(contextEntry.getProcessDefinitionId());
  evt.setProcessDefinitionKey(contextEntry.getProcessDefinitionKey());
  evt.setProcessInstanceId(contextEntry.getProcessInstanceId());
  evt.setExecutionId(contextEntry.getExecutionId());
  evt.setCaseDefinitionId(contextEntry.getCaseDefinitionId());
  evt.setCaseInstanceId(contextEntry.getCaseInstanceId());
  evt.setCaseExecutionId(contextEntry.getCaseExecutionId());
  evt.setTaskId(contextEntry.getTaskId());
  evt.setJobId(contextEntry.getJobId());
  evt.setJobDefinitionId(contextEntry.getJobDefinitionId());
  evt.setBatchId(contextEntry.getBatchId());
  evt.setTimestamp(ClockUtil.getCurrentTime());

  // init property value
  evt.setProperty(propertyChange.getPropertyName());
  evt.setOrgValue(propertyChange.getOrgValueString());
  evt.setNewValue(propertyChange.getNewValueString());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:27,代码来源:DefaultHistoryEventProducer.java


示例19: testDeleteUserLinkEvents

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
public void testDeleteUserLinkEvents() {

    // initially there are no task events
    assertTrue(taskService.getTaskEvents(task.getId()).isEmpty());

    taskService.addCandidateUser(task.getId(), JONNY);

    ClockUtil.setCurrentTime(new Date(ClockUtil.getCurrentTime().getTime() + 5000));

    taskService.deleteCandidateUser(task.getId(), JONNY);

    // now there is a task event created
    List<Event> events = taskService.getTaskEvents(task.getId());
    assertEquals(2, events.size());
    Event event = events.get(0);
    assertEquals(JONNY, event.getMessageParts().get(0));
    assertEquals(CANDIDATE, event.getMessageParts().get(1));
    assertEquals(task.getId(), event.getTaskId());
    assertEquals(ACTION_DELETE_USER_LINK, event.getAction());
    assertEquals(JONNY + CommentEntity.MESSAGE_PARTS_MARKER + CANDIDATE, event.getMessage());
    assertEquals(null, event.getProcessInstanceId());
    assertNotNull(event.getTime().getTime() <= ClockUtil.getCurrentTime().getTime());

    assertNoCommentsForTask();
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:TaskEventsTest.java


示例20: createTaskInstanceCompleteEvt

import org.camunda.bpm.engine.impl.util.ClockUtil; //导入依赖的package包/类
public HistoryEvent createTaskInstanceCompleteEvt(DelegateTask task, String deleteReason) {

    // create event instance
    HistoricTaskInstanceEventEntity evt = loadTaskInstanceEvent(task);

    // initialize event
    initTaskInstanceEvent(evt, (TaskEntity) task, HistoryEventTypes.TASK_INSTANCE_COMPLETE);

    // set end time
    evt.setEndTime(ClockUtil.getCurrentTime());
    if(evt.getStartTime() != null) {
      evt.setDurationInMillis(evt.getEndTime().getTime()-evt.getStartTime().getTime());
    }

    // set delete reason
    evt.setDeleteReason(deleteReason);

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InnerClass类代码示例发布时间:2022-05-23
下一篇:
Java LdapAuthenticationException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap