use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricDecisionInstanceWithInputs.
public static HistoricDecisionInstance createMockHistoricDecisionInstanceWithInputs() {
List<HistoricDecisionInputInstance> inputs = createMockHistoricDecisionInputInstances();
HistoricDecisionInstance mock = createMockHistoricDecisionInstanceBase();
when(mock.getInputs()).thenReturn(inputs);
when(mock.getOutputs()).thenThrow(new ProcessEngineException("ENGINE-03061 The output instances for the historic decision instance are not fetched. You must call 'includeOutputs()' on the query to enable fetching."));
return mock;
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricDecisionInstanceBase.
public static HistoricDecisionInstance createMockHistoricDecisionInstanceBase(String tenantId) {
HistoricDecisionInstance mock = mock(HistoricDecisionInstance.class);
when(mock.getId()).thenReturn(EXAMPLE_HISTORIC_DECISION_INSTANCE_ID);
when(mock.getDecisionDefinitionId()).thenReturn(EXAMPLE_DECISION_DEFINITION_ID);
when(mock.getDecisionDefinitionKey()).thenReturn(EXAMPLE_DECISION_DEFINITION_KEY);
when(mock.getDecisionDefinitionName()).thenReturn(EXAMPLE_DECISION_DEFINITION_NAME);
when(mock.getProcessDefinitionId()).thenReturn(EXAMPLE_PROCESS_DEFINITION_ID);
when(mock.getProcessDefinitionKey()).thenReturn(EXAMPLE_PROCESS_DEFINITION_KEY);
when(mock.getProcessInstanceId()).thenReturn(EXAMPLE_PROCESS_INSTANCE_ID);
when(mock.getCaseDefinitionId()).thenReturn(EXAMPLE_CASE_DEFINITION_ID);
when(mock.getCaseDefinitionKey()).thenReturn(EXAMPLE_CASE_DEFINITION_KEY);
when(mock.getCaseInstanceId()).thenReturn(EXAMPLE_CASE_INSTANCE_ID);
when(mock.getActivityId()).thenReturn(EXAMPLE_HISTORIC_DECISION_INSTANCE_ACTIVITY_ID);
when(mock.getActivityInstanceId()).thenReturn(EXAMPLE_HISTORIC_DECISION_INSTANCE_ACTIVITY_INSTANCE_ID);
when(mock.getEvaluationTime()).thenReturn(DateTimeUtil.parseDate(EXAMPLE_HISTORIC_DECISION_INSTANCE_EVALUATION_TIME));
when(mock.getUserId()).thenReturn(EXAMPLE_HISTORIC_DECISION_INSTANCE_USER_ID);
when(mock.getCollectResultValue()).thenReturn(EXAMPLE_HISTORIC_DECISION_INSTANCE_COLLECT_RESULT_VALUE);
when(mock.getRootDecisionInstanceId()).thenReturn(EXAMPLE_HISTORIC_DECISION_INSTANCE_ID);
when(mock.getDecisionRequirementsDefinitionId()).thenReturn(EXAMPLE_DECISION_REQUIREMENTS_DEFINITION_ID);
when(mock.getDecisionRequirementsDefinitionKey()).thenReturn(EXAMPLE_DECISION_REQUIREMENTS_DEFINITION_KEY);
when(mock.getTenantId()).thenReturn(tenantId);
return mock;
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceRestServiceImpl method queryHistoricDecisionInstances.
public List<HistoricDecisionInstanceDto> queryHistoricDecisionInstances(HistoricDecisionInstanceQueryDto queryDto, Integer firstResult, Integer maxResults) {
HistoricDecisionInstanceQuery query = queryDto.toQuery(processEngine);
List<HistoricDecisionInstance> matchingHistoricDecisionInstances;
if (firstResult != null || maxResults != null) {
matchingHistoricDecisionInstances = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingHistoricDecisionInstances = query.list();
}
List<HistoricDecisionInstanceDto> historicDecisionInstanceDtoResults = new ArrayList<HistoricDecisionInstanceDto>();
for (HistoricDecisionInstance historicDecisionInstance : matchingHistoricDecisionInstances) {
HistoricDecisionInstanceDto resultHistoricDecisionInstanceDto = HistoricDecisionInstanceDto.fromHistoricDecisionInstance(historicDecisionInstance);
historicDecisionInstanceDtoResults.add(resultHistoricDecisionInstanceDto);
}
return historicDecisionInstanceDtoResults;
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceResourceImpl method getHistoricDecisionInstance.
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);
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.
the class TenantIdProviderTest method setNullTenantIdForHistoricDecisionInstance.
@Test
public void setNullTenantIdForHistoricDecisionInstance() {
String tenantId = null;
StaticTenantIdTestProvider tenantIdProvider = new StaticTenantIdTestProvider(tenantId);
TestTenantIdProvider.delegate = tenantIdProvider;
testRule.deploy(DMN_FILE);
// if a decision definition is evaluated
engineRule.getDecisionService().evaluateDecisionTableByKey(DECISION_DEFINITION_KEY).variables(createVariables()).evaluate();
// then the tenant id provider can set the tenant id to null
HistoricDecisionInstance historicDecisionInstance = engineRule.getHistoryService().createHistoricDecisionInstanceQuery().singleResult();
assertThat(historicDecisionInstance.getTenantId(), is(nullValue()));
}
Aggregations