org.camunda.bpm.engine.HistoryService Java Examples

The following examples show how to use org.camunda.bpm.engine.HistoryService. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HostnameProviderTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void closeProcessEngine() {
  final HistoryService historyService = engine.getHistoryService();
  configuration.getCommandExecutorTxRequired().execute((Command<Void>) commandContext -> {

    List<Job> jobs = historyService.findHistoryCleanupJobs();
    for (Job job: jobs) {
      commandContext.getJobManager().deleteJob((JobEntity) job);
      commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(job.getId());
    }

    //cleanup "detached" historic job logs
    final List<HistoricJobLog> list = historyService.createHistoricJobLogQuery().list();
    for (HistoricJobLog jobLog: list) {
      commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobLog.getJobId());
    }

    commandContext.getMeterLogManager().deleteAll();

    return null;
  });

  engine.close();
  engine = null;
}
 
Example #2
Source File: MockedProcessEngineProvider.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #3
Source File: HistoricProcessInstanceRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@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;
    batch = historyService.deleteHistoricProcessInstancesAsync(dto.getHistoricProcessInstanceIds(), historicProcessInstanceQuery, dto.getDeleteReason());
    return BatchDto.fromBatch(batch);

  } catch (BadUserRequestException e) {
    throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
  }
}
 
Example #4
Source File: RestartProcessInstanceRestServiceTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example #5
Source File: DeleteHistoricProcessInstancesJobHandler.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(BatchJobConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
  ByteArrayEntity configurationEntity = commandContext
      .getDbEntityManager()
      .selectById(ByteArrayEntity.class, configuration.getConfigurationByteArrayId());

  BatchConfiguration batchConfiguration = readConfiguration(configurationEntity.getBytes());

  boolean initialLegacyRestrictions = commandContext.isRestrictUserOperationLogToAuthenticatedUsers();
  commandContext.disableUserOperationLog();
  commandContext.setRestrictUserOperationLogToAuthenticatedUsers(true);
  try {
    HistoryService historyService = commandContext.getProcessEngineConfiguration().getHistoryService();
    if(batchConfiguration.isFailIfNotExists()) {
      historyService.deleteHistoricProcessInstances(batchConfiguration.getIds());
    }else {
      historyService.deleteHistoricProcessInstancesIfExists(batchConfiguration.getIds());
    }
  } finally {
    commandContext.enableUserOperationLog();
    commandContext.setRestrictUserOperationLogToAuthenticatedUsers(initialLegacyRestrictions);
  }

  commandContext.getByteArrayManager().delete(configurationEntity);
}
 
Example #6
Source File: HistoricCaseDefinitionRestServiceImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public List<HistoricCaseActivityStatisticsDto> getHistoricCaseActivityStatistics(String caseDefinitionId) {
  HistoryService historyService = processEngine.getHistoryService();

  HistoricCaseActivityStatisticsQuery historicCaseActivityStatisticsQuery =
      historyService.createHistoricCaseActivityStatisticsQuery(caseDefinitionId);

  List<HistoricCaseActivityStatistics> statistics =
      historicCaseActivityStatisticsQuery.unlimitedList();

  List<HistoricCaseActivityStatisticsDto> result = new ArrayList<HistoricCaseActivityStatisticsDto>();
  for (HistoricCaseActivityStatistics currentStatistics : statistics) {
    result.add(HistoricCaseActivityStatisticsDto.fromHistoricCaseActivityStatistics(currentStatistics));
  }

  return result;
}
 
Example #7
Source File: RestartProcessInstancesCmd.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #8
Source File: RestartProcessInstancesCmd.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
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;
}
 
Example #9
Source File: HistoryCleanupOnEngineBootstrapTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void closeProcessEngine(ProcessEngine processEngine) {
  ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
  final HistoryService historyService = processEngine.getHistoryService();
  configuration.getCommandExecutorTxRequired().execute((Command<Void>) commandContext -> {

    List<Job> jobs = historyService.findHistoryCleanupJobs();
    for (Job job: jobs) {
      commandContext.getJobManager().deleteJob((JobEntity) job);
      commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(job.getId());
    }

    //cleanup "detached" historic job logs
    final List<HistoricJobLog> list = historyService.createHistoricJobLogQuery().list();
    for (HistoricJobLog jobLog: list) {
      commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(jobLog.getJobId());
    }

    commandContext.getMeterLogManager().deleteAll();

    return null;
  });

  processEngine.close();
}
 
Example #10
Source File: MockedProcessEngineProvider.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #11
Source File: HistoricDecisionInstanceResourceImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #12
Source File: ActivityPerfTestWatcher.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #13
Source File: HistoricBatchQueryAuthorizationTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
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());
  }
}
 
Example #14
Source File: HistoricProcessInstanceRestServiceInteractionTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Before
public void setUpRuntimeData() {
  historyServiceMock = mock(HistoryService.class);

  // runtime service
  when(processEngine.getHistoryService()).thenReturn(historyServiceMock);
}
 
Example #15
Source File: HistoricJobLogRestServiceInteractionTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Before
public void setUpRuntimeData() {
  mockQuery = mock(HistoricJobLogQuery.class);

  HistoricJobLog mockedHistoricJobLog = MockProvider.createMockHistoricJobLog();

  when(mockQuery.singleResult()).thenReturn(mockedHistoricJobLog);
  when(mockQuery.logId(MockProvider.EXAMPLE_HISTORIC_JOB_LOG_ID)).thenReturn(mockQuery);

  mockHistoryService = mock(HistoryService.class);
  when(mockHistoryService.createHistoricJobLogQuery()).thenReturn(mockQuery);

  namedProcessEngine = getProcessEngine(MockProvider.EXAMPLE_PROCESS_ENGINE_NAME);
  when(namedProcessEngine.getHistoryService()).thenReturn(mockHistoryService);
}
 
Example #16
Source File: HistoricVariableInstanceRestServiceInteractionTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Before
public void setupTestData() {
  historyServiceMock = mock(HistoryService.class);
  variableInstanceQueryMock = mock(HistoricVariableInstanceQuery.class);

  // mock engine service.
  when(processEngine.getHistoryService()).thenReturn(historyServiceMock);
  when(historyServiceMock.createHistoricVariableInstanceQuery()).thenReturn(variableInstanceQueryMock);
}
 
Example #17
Source File: HistoricDecisionInstanceRestServiceInteractionTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Before
public void setUpRuntimeData() {
  historyServiceMock = mock(HistoryService.class);

  // runtime service
  when(processEngine.getHistoryService()).thenReturn(historyServiceMock);

  historicInstanceMock = MockProvider.createMockHistoricDecisionInstance();
  historicQueryMock = mock(HistoricDecisionInstanceQuery.class, RETURNS_DEEP_STUBS);

  when(historyServiceMock.createHistoricDecisionInstanceQuery()).thenReturn(historicQueryMock);
  when(historicQueryMock.decisionInstanceId(anyString())).thenReturn(historicQueryMock);
  when(historicQueryMock.singleResult()).thenReturn(historicInstanceMock);
}
 
Example #18
Source File: HistoricBatchRestServiceInteractionTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Before
public void setUpHistoricBatchQueryMock() {
  HistoricBatch historicBatchMock = MockProvider.createMockHistoricBatch();

  queryMock = mock(HistoricBatchQuery.class);
  when(queryMock.batchId(eq(MockProvider.EXAMPLE_BATCH_ID))).thenReturn(queryMock);
  when(queryMock.singleResult()).thenReturn(historicBatchMock);

  historyServiceMock = mock(HistoryService.class);
  when(historyServiceMock.createHistoricBatchQuery()).thenReturn(queryMock);

  when(processEngine.getHistoryService()).thenReturn(historyServiceMock);
}
 
Example #19
Source File: HistoricActivityInstanceRestServiceInteractionTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Before
public void setUpRuntimeData() {
  historyServiceMock = mock(HistoryService.class);

  // runtime service
  when(processEngine.getHistoryService()).thenReturn(historyServiceMock);

  historicInstanceMock = MockProvider.createMockHistoricActivityInstance();
  historicQueryMock = mock(HistoricActivityInstanceQuery.class);

  when(historyServiceMock.createHistoricActivityInstanceQuery()).thenReturn(historicQueryMock);
  when(historicQueryMock.activityInstanceId(anyString())).thenReturn(historicQueryMock);
  when(historicQueryMock.singleResult()).thenReturn(historicInstanceMock);
}
 
Example #20
Source File: HistoricJobLogResourceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public HistoricJobLogDto getHistoricJobLog() {
  HistoryService historyService = engine.getHistoryService();
  HistoricJobLog historicJobLog = historyService
      .createHistoricJobLogQuery()
      .logId(id)
      .singleResult();

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

  return HistoricJobLogDto.fromHistoricJobLog(historicJobLog);
}
 
Example #21
Source File: TestHelper.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
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());
    }
  }
}
 
Example #22
Source File: ExternalTaskUserOperationLogTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@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());
  }
}
 
Example #23
Source File: BatchHelper.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * 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());
  }

}
 
Example #24
Source File: BatchHelper.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected HistoryService getHistoryService() {
  if (engineRule != null) {
    return engineRule.getHistoryService();
  }
  else {
    return testCase.getProcessEngine().getHistoryService();
  }
}
 
Example #25
Source File: UpdateHistoricValueDelegate.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #26
Source File: HistoricActivityInstanceResourceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
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");
  }

  final HistoricActivityInstanceDto historicActivityInstanceDto = new HistoricActivityInstanceDto();
  HistoricActivityInstanceDto.fromHistoricActivityInstance(historicActivityInstanceDto, instance);
  return historicActivityInstanceDto;
}
 
Example #27
Source File: HistoricCaseInstanceResourceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public HistoricCaseInstanceDto getHistoricCaseInstance() {
  HistoryService historyService = engine.getHistoryService();
  HistoricCaseInstance instance = historyService.createHistoricCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();

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

  return HistoricCaseInstanceDto.fromHistoricCaseInstance(instance);
}
 
Example #28
Source File: HistoricProcessInstanceResourceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public HistoricProcessInstanceDto getHistoricProcessInstance() {
  HistoryService historyService = engine.getHistoryService();
  HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();

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

  return HistoricProcessInstanceDto.fromHistoricProcessInstance(instance);
}
 
Example #29
Source File: HistoricExternalTaskLogResourceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
public HistoricExternalTaskLogDto getHistoricExternalTaskLog() {
  HistoryService historyService = engine.getHistoryService();
  HistoricExternalTaskLog historicExternalTaskLog = historyService
    .createHistoricExternalTaskLogQuery()
    .logId(id)
    .singleResult();

  if (historicExternalTaskLog == null) {
    throw new InvalidRequestException(Status.NOT_FOUND, "Historic external task log with id " + id + " does not exist");
  }

  return HistoricExternalTaskLogDto.fromHistoricExternalTaskLog(historicExternalTaskLog);
}
 
Example #30
Source File: HistoricCaseActivityInstanceResourceImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public HistoricCaseActivityInstanceDto getHistoricCaseActivityInstance() {
  HistoryService historyService = engine.getHistoryService();
  HistoricCaseActivityInstance instance = historyService.createHistoricCaseActivityInstanceQuery()
    .caseActivityInstanceId(caseActivityInstanceId).singleResult();

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

  return HistoricCaseActivityInstanceDto.fromHistoricCaseActivityInstance(instance);
}