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


Java ManagementService类代码示例

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


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


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