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

Java ManagementService类代码示例

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

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



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

示例1: waitForJobExecutorToProcessAllJobs

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
public void waitForJobExecutorToProcessAllJobs(long maxMillisToWait, long intervalMillis, JobExecutor jobExecutor, ManagementService managementService, boolean shutdown) {

    try {
      Timer timer = new Timer();
      InteruptTask task = new InteruptTask(Thread.currentThread());
      timer.schedule(task, maxMillisToWait);
      boolean areJobsAvailable = true;
      try {
        while (areJobsAvailable && !task.isTimeLimitExceeded()) {
          Thread.sleep(intervalMillis);
          areJobsAvailable = areJobsAvailable(managementService);
        }
      } catch (InterruptedException e) {
      } finally {
        timer.cancel();
      }
      if (areJobsAvailable) {
        throw new ProcessEngineException("time limit of " + maxMillisToWait + " was exceeded");
      }

    } finally {
      if (shutdown) {
        jobExecutor.shutdown();
      }
    }
  }
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:27,代码来源:SequentialJobAcquisitionTest.java


示例2: mockServices

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
private void mockServices(ProcessEngine engine) {
  RepositoryService repoService = mock(RepositoryService.class);
  IdentityService identityService = mock(IdentityService.class);
  TaskService taskService = mock(TaskService.class);
  RuntimeService runtimeService = mock(RuntimeService.class);
  FormService formService = mock(FormService.class);
  HistoryService historyService = mock(HistoryService.class);
  ManagementService managementService = mock(ManagementService.class);
  CaseService caseService = mock(CaseService.class);
  FilterService filterService = mock(FilterService.class);
  ExternalTaskService externalTaskService = mock(ExternalTaskService.class);

  when(engine.getRepositoryService()).thenReturn(repoService);
  when(engine.getIdentityService()).thenReturn(identityService);
  when(engine.getTaskService()).thenReturn(taskService);
  when(engine.getRuntimeService()).thenReturn(runtimeService);
  when(engine.getFormService()).thenReturn(formService);
  when(engine.getHistoryService()).thenReturn(historyService);
  when(engine.getManagementService()).thenReturn(managementService);
  when(engine.getCaseService()).thenReturn(caseService);
  when(engine.getFilterService()).thenReturn(filterService);
  when(engine.getExternalTaskService()).thenReturn(externalTaskService);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:24,代码来源:MockedProcessEngineProvider.java


示例3: setUpRuntimeData

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
@Before
public void setUpRuntimeData() {
  mockManagementService = mock(ManagementService.class);

  namedProcessEngine = getProcessEngine(MockProvider.EXAMPLE_PROCESS_ENGINE_NAME);
  when(namedProcessEngine.getManagementService()).thenReturn(mockManagementService);

  List<JobDefinition> mockJobDefinitions = Collections.singletonList(MockProvider.createMockJobDefinition());
  mockQuery = setUpMockJobDefinitionQuery(mockJobDefinitions);

  mockSuspensionStateSelectBuilder = mock(UpdateJobDefinitionSuspensionStateSelectBuilder.class);
  when(mockManagementService.updateJobDefinitionSuspensionState()).thenReturn(mockSuspensionStateSelectBuilder);

  mockSuspensionStateBuilder = mock(UpdateJobDefinitionSuspensionStateTenantBuilder.class);
  when(mockSuspensionStateSelectBuilder.byJobDefinitionId(anyString())).thenReturn(mockSuspensionStateBuilder);
  when(mockSuspensionStateSelectBuilder.byProcessDefinitionId(anyString())).thenReturn(mockSuspensionStateBuilder);
  when(mockSuspensionStateSelectBuilder.byProcessDefinitionKey(anyString())).thenReturn(mockSuspensionStateBuilder);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:19,代码来源:JobDefinitionRestServiceInteractionTest.java


示例4: removeAllRunningAndHistoricBatches

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
private void removeAllRunningAndHistoricBatches() {
  HistoryService historyService = engineRule.getHistoryService();
  ManagementService managementService = engineRule.getManagementService();

  for (Batch batch : managementService.createBatchQuery().list()) {
    managementService.deleteBatch(batch.getId(), true);
  }

  // remove history of completed batches
  for (HistoricBatch historicBatch : historyService.createHistoricBatchQuery().list()) {
    historyService.deleteHistoricBatch(historicBatch.getId());
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:14,代码来源:HistoricBatchQueryAuthorizationTest.java


示例5: removeAllRunningAndHistoricBatches

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
@After
public void removeAllRunningAndHistoricBatches() {
  HistoryService historyService = rule.getHistoryService();
  ManagementService managementService = rule.getManagementService();
  for (Batch batch : managementService.createBatchQuery().list()) {
    managementService.deleteBatch(batch.getId(), true);
  }
  // remove history of completed batches
  for (HistoricBatch historicBatch : historyService.createHistoricBatchQuery().list()) {
    historyService.deleteHistoricBatch(historicBatch.getId());
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:13,代码来源:SetExternalTaskRetriesUserOperationLogTest.java


示例6: executeJob

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
protected void executeJob(Job job) {
  ManagementService managementService = rule.getManagementService();

  while (job != null && job.getRetries() > 0) {
    try {
      managementService.executeJob(job.getId());
    }
    catch (Exception e) {
      // ignore
    }

    job = managementService.createJobQuery().jobId(job.getId()).singleResult();
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:MigrationRemoveBoundaryEventsTest.java


示例7: trigger

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
@Override
public void trigger(String processInstanceId) {
  ManagementService managementService = engine.getManagementService();
  Job timerJob = managementService.createJobQuery().processInstanceId(processInstanceId).activityId(activityId).singleResult();

  if (timerJob == null) {
    throw new ProcessEngineException("No job for this event found in context of process instance " + processInstanceId);
  }

  managementService.executeJob(timerJob.getId());
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:12,代码来源:TimerEventFactory.java


示例8: setRetries

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
public void setRetries(Batch batch, int count, int retries) {
  List<Job> jobs = getExecutionJobs(batch);
  assertTrue(jobs.size() >= count);

  ManagementService managementService = getManagementService();
  for (int i = 0; i < count; i++) {
    managementService.setJobRetries(jobs.get(i).getId(), retries);
  }

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:11,代码来源:BatchHelper.java


示例9: removeAllRunningAndHistoricBatches

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
/**
 * Remove all batches and historic batches. Usually called in {@link org.junit.After} method.
 */
public void removeAllRunningAndHistoricBatches() {
  HistoryService historyService = getHistoryService();
  ManagementService managementService = getManagementService();

  for (Batch batch : managementService.createBatchQuery().list()) {
    managementService.deleteBatch(batch.getId(), true);
  }

  // remove history of completed batches
  for (HistoricBatch historicBatch : historyService.createHistoricBatchQuery().list()) {
    historyService.deleteHistoricBatch(historicBatch.getId());
  }

}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:18,代码来源:BatchHelper.java


示例10: getManagementService

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
protected ManagementService getManagementService() {
  if (engineRule != null) {
    return engineRule.getManagementService();
  }
  else {
    return testCase.getProcessEngine().getManagementService();
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:9,代码来源:BatchHelper.java


示例11: areJobsAvailable

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
public boolean areJobsAvailable(ManagementService managementService) {
  return !managementService
    .createJobQuery()
    .executable()
    .list()
    .isEmpty();
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:8,代码来源:SequentialJobAcquisitionTest.java


示例12: getActivityStatistics

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
@Override
public List<StatisticsResultDto> getActivityStatistics(Boolean includeFailedJobs, Boolean includeIncidents, String includeIncidentsForType) {
  if (includeIncidents != null && includeIncidentsForType != null) {
    throw new InvalidRequestException(Status.BAD_REQUEST, "Only one of the query parameter includeIncidents or includeIncidentsForType can be set.");
  }

  ManagementService mgmtService = engine.getManagementService();
  ActivityStatisticsQuery query = mgmtService.createActivityStatisticsQuery(processDefinitionId);

  if (includeFailedJobs != null && includeFailedJobs) {
    query.includeFailedJobs();
  }

  if (includeIncidents != null && includeIncidents) {
    query.includeIncidents();
  } else if (includeIncidentsForType != null) {
    query.includeIncidentsForType(includeIncidentsForType);
  }

  List<ActivityStatistics> queryResults = query.list();

  List<StatisticsResultDto> results = new ArrayList<StatisticsResultDto>();
  for (ActivityStatistics queryResult : queryResults) {
    StatisticsResultDto dto = ActivityStatisticsResultDto.fromActivityStatistics(queryResult);
    results.add(dto);
  }

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


示例13: getJobDefinition

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
public JobDefinitionDto getJobDefinition() {
  ManagementService managementService = engine.getManagementService();
  JobDefinition jobDefinition = managementService.createJobDefinitionQuery().jobDefinitionId(jobDefinitionId).singleResult();

  if (jobDefinition == null) {
    throw new InvalidRequestException(Status.NOT_FOUND, "Job Definition with id " + jobDefinitionId + " does not exist");
  }

  return JobDefinitionDto.fromJobDefinition(jobDefinition);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:11,代码来源:JobDefinitionResourceImpl.java


示例14: getJob

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
@Override
public JobDto getJob() {
  ManagementService managementService = engine.getManagementService();
  Job job = managementService.createJobQuery().jobId(jobId).singleResult();

  if (job == null) {
    throw new InvalidRequestException(Status.NOT_FOUND, "Job with id " + jobId + " does not exist");
  }

  return JobDto.fromJob(job);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:12,代码来源:JobResourceImpl.java


示例15: setRetriesByProcessHistoricQueryBased

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
@Override
public BatchDto setRetriesByProcessHistoricQueryBased(SetJobRetriesByProcessDto setJobRetriesDto) {
  List<String> processInstanceIds = new ArrayList<String>();

  HistoricProcessInstanceQueryDto queryDto = setJobRetriesDto.getHistoricProcessInstanceQuery();
  if (queryDto != null) {
    HistoricProcessInstanceQuery query = queryDto.toQuery(getProcessEngine());
    List<HistoricProcessInstance> historicProcessInstances = query.list();

    for (HistoricProcessInstance historicProcessInstance: historicProcessInstances) {
      processInstanceIds.add(historicProcessInstance.getId());
    }
  }

  if (setJobRetriesDto.getProcessInstances() != null) {
    processInstanceIds.addAll(setJobRetriesDto.getProcessInstances());
  }

  try {
    ManagementService managementService = getProcessEngine().getManagementService();
    Batch batch = managementService.setJobRetriesAsync(
      processInstanceIds,
      (ProcessInstanceQuery) null,
      setJobRetriesDto.getRetries());

    return BatchDto.fromBatch(batch);
  } catch (BadUserRequestException e) {
    throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:31,代码来源:ProcessInstanceRestServiceImpl.java


示例16: getStatistics

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
@Override
public List<StatisticsResultDto> getStatistics(Boolean includeFailedJobs, Boolean includeRootIncidents, Boolean includeIncidents, String includeIncidentsForType) {
  if (includeIncidents != null && includeIncidentsForType != null) {
    throw new InvalidRequestException(Status.BAD_REQUEST, "Only one of the query parameter includeIncidents or includeIncidentsForType can be set.");
  }

  if (includeIncidents != null && includeRootIncidents != null) {
    throw new InvalidRequestException(Status.BAD_REQUEST, "Only one of the query parameter includeIncidents or includeRootIncidents can be set.");
  }

  if (includeRootIncidents != null && includeIncidentsForType != null) {
    throw new InvalidRequestException(Status.BAD_REQUEST, "Only one of the query parameter includeRootIncidents or includeIncidentsForType can be set.");
  }

  ManagementService mgmtService = getProcessEngine().getManagementService();
  ProcessDefinitionStatisticsQuery query = mgmtService.createProcessDefinitionStatisticsQuery();

  if (includeFailedJobs != null && includeFailedJobs) {
    query.includeFailedJobs();
  }

  if (includeIncidents != null && includeIncidents) {
    query.includeIncidents();
  } else if (includeIncidentsForType != null) {
    query.includeIncidentsForType(includeIncidentsForType);
  } else if (includeRootIncidents != null && includeRootIncidents) {
    query.includeRootIncidents();
  }

  List<ProcessDefinitionStatistics> queryResults = query.list();

  List<StatisticsResultDto> results = new ArrayList<StatisticsResultDto>();
  for (ProcessDefinitionStatistics queryResult : queryResults) {
    StatisticsResultDto dto = ProcessDefinitionStatisticsResultDto.fromProcessDefinitionStatistics(queryResult);
    results.add(dto);
  }

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


示例17: setUpRuntimeData

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
@Before
public void setUpRuntimeData() {

  mockQuery = mock(JobQuery.class);
  Job mockedJob = new MockJobBuilder()
    .id(MockProvider.EXAMPLE_JOB_ID)
    .processInstanceId(MockProvider.EXAMPLE_PROCESS_INSTANCE_ID)
    .executionId(MockProvider.EXAMPLE_EXECUTION_ID)
    .retries(MockProvider.EXAMPLE_JOB_RETRIES)
    .exceptionMessage(MockProvider.EXAMPLE_JOB_NO_EXCEPTION_MESSAGE)
    .dueDate(new Date())
    .priority(MockProvider.EXAMPLE_JOB_PRIORITY)
    .jobDefinitionId(MockProvider.EXAMPLE_JOB_DEFINITION_ID)
    .tenantId(MockProvider.EXAMPLE_TENANT_ID)
    .build();

  when(mockQuery.singleResult()).thenReturn(mockedJob);
  when(mockQuery.jobId(MockProvider.EXAMPLE_JOB_ID)).thenReturn(mockQuery);

  mockManagementService = mock(ManagementService.class);
  when(mockManagementService.createJobQuery()).thenReturn(mockQuery);

  mockSuspensionStateSelectBuilder = mock(UpdateJobSuspensionStateSelectBuilder.class);
  when(mockManagementService.updateJobSuspensionState()).thenReturn(mockSuspensionStateSelectBuilder);

  mockSuspensionStateBuilder = mock(UpdateJobSuspensionStateTenantBuilder.class);
  when(mockSuspensionStateSelectBuilder.byJobId(anyString())).thenReturn(mockSuspensionStateBuilder);
  when(mockSuspensionStateSelectBuilder.byJobDefinitionId(anyString())).thenReturn(mockSuspensionStateBuilder);
  when(mockSuspensionStateSelectBuilder.byProcessInstanceId(anyString())).thenReturn(mockSuspensionStateBuilder);
  when(mockSuspensionStateSelectBuilder.byProcessDefinitionId(anyString())).thenReturn(mockSuspensionStateBuilder);
  when(mockSuspensionStateSelectBuilder.byProcessDefinitionKey(anyString())).thenReturn(mockSuspensionStateBuilder);

  namedProcessEngine = getProcessEngine(MockProvider.EXAMPLE_PROCESS_ENGINE_NAME);
  when(namedProcessEngine.getManagementService()).thenReturn(mockManagementService);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:36,代码来源:JobRestServiceInteractionTest.java


示例18: setUpBatchQueryMock

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
@Before
public void setUpBatchQueryMock() {
  Batch batchMock = MockProvider.createMockBatch();

  queryMock = mock(BatchQuery.class);
  when(queryMock.batchId(eq(MockProvider.EXAMPLE_BATCH_ID))).thenReturn(queryMock);
  when(queryMock.singleResult()).thenReturn(batchMock);

  managementServiceMock = mock(ManagementService.class);
  when(managementServiceMock.createBatchQuery()).thenReturn(queryMock);

  when(processEngine.getManagementService()).thenReturn(managementServiceMock);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:14,代码来源:BatchRestServiceInteractionTest.java


示例19: managementService

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
@Bean
public ManagementService managementService() throws Exception {
	return processEngine().getObject().getManagementService();
}
 
开发者ID:underscorenico,项目名称:skeleton-oms-java,代码行数:5,代码来源:TestConfiguration.java


示例20: getManagementService

import org.camunda.bpm.engine.ManagementService; //导入依赖的package包/类
public ManagementService getManagementService() {
  return processEngine.getManagementService();
}
 
开发者ID:camunda,项目名称:camunda-bpm-assert-scenario,代码行数:4,代码来源:AbstractProcessEngineServicesDelegate.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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