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


Java HistoryService类代码示例

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


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

示例1: collectInitialVariables

import org.camunda.bpm.engine.HistoryService; //导入依赖的package包/类
protected VariableMap collectInitialVariables(CommandContext commandContext, HistoricProcessInstance processInstance) {
  HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService();

  HistoricActivityInstance startActivityInstance = resolveStartActivityInstance(processInstance);

  HistoricDetailQueryImpl query = (HistoricDetailQueryImpl) historyService.createHistoricDetailQuery()
      .variableUpdates()
      .executionId(processInstance.getId())
      .activityInstanceId(startActivityInstance.getId());

  List<HistoricDetail> historicDetails = query
      .sequenceCounter(1)
      .list();

  VariableMap variables = new VariableMapImpl();
  for (HistoricDetail detail : historicDetails) {
    HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate) detail;
    variables.putValueTyped(variableUpdate.getVariableName(), variableUpdate.getTypedValue());
  }

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

示例2: resolveStartActivityInstance

import org.camunda.bpm.engine.HistoryService; //导入依赖的package包/类
protected HistoricActivityInstance resolveStartActivityInstance(HistoricProcessInstance processInstance) {
  HistoryService historyService = Context.getProcessEngineConfiguration().getHistoryService();

  String processInstanceId = processInstance.getId();
  String startActivityId = processInstance.getStartActivityId();

  ensureNotNull("startActivityId", startActivityId);

  List<HistoricActivityInstance> historicActivityInstances = historyService
      .createHistoricActivityInstanceQuery()
      .processInstanceId(processInstanceId)
      .activityId(startActivityId)
      .orderPartiallyByOccurrence()
      .asc()
      .list();

  ensureNotEmpty("historicActivityInstances", historicActivityInstances);

  HistoricActivityInstance startActivityInstance = historicActivityInstances.get(0);
  return startActivityInstance;
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:22,代码来源:RestartProcessInstancesCmd.java

示例3: getHistoricDecisionInstance

import org.camunda.bpm.engine.HistoryService; //导入依赖的package包/类
public HistoricDecisionInstanceDto getHistoricDecisionInstance(Boolean includeInputs, Boolean includeOutputs, Boolean disableBinaryFetching, Boolean disableCustomObjectDeserialization) {
  HistoryService historyService = engine.getHistoryService();

  HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery().decisionInstanceId(decisionInstanceId);
  if (includeInputs != null && includeInputs) {
    query.includeInputs();
  }
  if (includeOutputs != null && includeOutputs) {
    query.includeOutputs();
  }
  if (disableBinaryFetching != null && disableBinaryFetching) {
    query.disableBinaryFetching();
  }
  if (disableCustomObjectDeserialization != null && disableCustomObjectDeserialization) {
    query.disableCustomObjectDeserialization();
  }

  HistoricDecisionInstance instance = query.singleResult();

  if (instance == null) {
    throw new InvalidRequestException(Status.NOT_FOUND, "Historic decision instance with id '" + decisionInstanceId + "' does not exist");
  }

  return HistoricDecisionInstanceDto.fromHistoricDecisionInstance(instance);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:HistoricDecisionInstanceResourceImpl.java

示例4: deleteAsync

import org.camunda.bpm.engine.HistoryService; //导入依赖的package包/类
@Override
public BatchDto deleteAsync(DeleteHistoricProcessInstancesDto dto) {
  HistoryService historyService = processEngine.getHistoryService();

  HistoricProcessInstanceQuery historicProcessInstanceQuery = null;
  if (dto.getHistoricProcessInstanceQuery() != null) {
    historicProcessInstanceQuery = dto.getHistoricProcessInstanceQuery().toQuery(processEngine);
  }

  try {
    Batch batch = historyService.deleteHistoricProcessInstancesAsync(
        dto.getHistoricProcessInstanceIds(),
        historicProcessInstanceQuery,
        dto.getDeleteReason());
    return BatchDto.fromBatch(batch);

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

示例5: setUpRuntimeData

import org.camunda.bpm.engine.HistoryService; //导入依赖的package包/类
@Before
public void setUpRuntimeData() {
  runtimeServiceMock = mock(RuntimeService.class);
  when(processEngine.getRuntimeService()).thenReturn(runtimeServiceMock);
  
  historyServiceMock = mock(HistoryService.class);
  when(processEngine.getHistoryService()).thenReturn(historyServiceMock);

  builderMock = mock(RestartProcessInstanceBuilder.class);
  when(builderMock.startAfterActivity(anyString())).thenReturn(builderMock);
  when(builderMock.startBeforeActivity(anyString())).thenReturn(builderMock);
  when(builderMock.startTransition(anyString())).thenReturn(builderMock);
  when(builderMock.processInstanceIds(anyListOf(String.class))).thenReturn(builderMock);
  when(builderMock.historicProcessInstanceQuery(any(HistoricProcessInstanceQuery.class))).thenReturn(builderMock);
  when(builderMock.skipCustomListeners()).thenReturn(builderMock);
  when(builderMock.skipIoMappings()).thenReturn(builderMock);
  when(builderMock.initialSetOfVariables()).thenReturn(builderMock);
  when(builderMock.withoutBusinessKey()).thenReturn(builderMock);

  Batch batchMock = createMockBatch();
  when(builderMock.executeAsync()).thenReturn(batchMock);

  when(runtimeServiceMock.restartProcessInstances(anyString())).thenReturn(builderMock);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:25,代码来源:RestartProcessInstanceRestServiceTest.java

示例6: mockServices

import org.camunda.bpm.engine.HistoryService; //导入依赖的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

示例7: logActivityResults

import org.camunda.bpm.engine.HistoryService; //导入依赖的package包/类
protected void logActivityResults(PerfTestPass pass, PerfTestRun run, HistoryService historyService) {
  String processInstanceId = run.getVariable(PerfTestConstants.PROCESS_INSTANCE_ID);
  List<ActivityPerfTestResult> activityResults = new ArrayList<ActivityPerfTestResult>();

  HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
  Date startTime = processInstance.getStartTime();

  List<HistoricActivityInstance> activityInstances = historyService.createHistoricActivityInstanceQuery()
    .processInstanceId(processInstanceId)
    .orderByHistoricActivityInstanceStartTime()
    .asc()
    .list();

  for (HistoricActivityInstance activityInstance : activityInstances) {
    if (watchAllActivities || activityIds.contains(activityInstance.getActivityId())) {
      ActivityPerfTestResult result = new ActivityPerfTestResult(activityInstance);
      if (activityInstance.getActivityType().equals("startEvent")) {
        result.setStartTime(startTime);
      }
      activityResults.add(result);
    }
  }

  pass.logActivityResult(processInstanceId, activityResults);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:26,代码来源:ActivityPerfTestWatcher.java

示例8: clearUserOperationLog

import org.camunda.bpm.engine.HistoryService; //导入依赖的package包/类
public static void clearUserOperationLog(ProcessEngineConfigurationImpl processEngineConfiguration) {
  if (processEngineConfiguration.getHistoryLevel().equals(HistoryLevel.HISTORY_LEVEL_FULL)) {
    HistoryService historyService = processEngineConfiguration.getHistoryService();
    List<UserOperationLogEntry> logs = historyService.createUserOperationLogQuery().list();
    for (UserOperationLogEntry log : logs) {
      historyService.deleteUserOperationLogEntry(log.getId());
    }
  }
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:10,代码来源:TestHelper.java

示例9: collectLastVariables

import org.camunda.bpm.engine.HistoryService; //导入依赖的package包/类
protected VariableMap collectLastVariables(CommandContext commandContext, HistoricProcessInstance processInstance) {
  HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService();

  List<HistoricVariableInstance> historicVariables = historyService.createHistoricVariableInstanceQuery()
      .executionIdIn(processInstance.getId())
      .list();

  VariableMap variables = new VariableMapImpl();
  for (HistoricVariableInstance variable : historicVariables) {
    variables.putValueTyped(variable.getName(), variable.getTypedValue());
  }

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

示例10: removeAllRunningAndHistoricBatches

import org.camunda.bpm.engine.HistoryService; //导入依赖的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

示例11: removeAllRunningAndHistoricBatches

import org.camunda.bpm.engine.HistoryService; //导入依赖的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

示例12: removeAllRunningAndHistoricBatches

import org.camunda.bpm.engine.HistoryService; //导入依赖的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

示例13: getHistoryService

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

示例14: execute

import org.camunda.bpm.engine.HistoryService; //导入依赖的package包/类
public void execute(DelegateExecution execution) throws Exception {
  HistoryService historyService = execution.getProcessEngineServices().getHistoryService();

  HistoricVariableInstance variableInstance = historyService
      .createHistoricVariableInstanceQuery()
      .variableName("listVar")
      .singleResult();

  List<String> list = (List<String>) variableInstance.getValue();

  // implicit update of the list, should not trigger an update
  // of the value since we deal with historic variables
  list.add(NEW_ELEMENT);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:15,代码来源:UpdateHistoricValueDelegate.java

示例15: getHistoricActivityInstance

import org.camunda.bpm.engine.HistoryService; //导入依赖的package包/类
public HistoricActivityInstanceDto getHistoricActivityInstance() {
  HistoryService historyService = engine.getHistoryService();
  HistoricActivityInstance instance = historyService.createHistoricActivityInstanceQuery()
    .activityInstanceId(activityInstanceId).singleResult();

  if (instance == null) {
    throw new InvalidRequestException(Status.NOT_FOUND, "Historic activity instance with id '" + activityInstanceId + "' does not exist");
  }

  return HistoricActivityInstanceDto.fromHistoricActivityInstance(instance);
}
 
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:12,代码来源:HistoricActivityInstanceResourceImpl.java


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