Search in sources :

Example 21 with HistoricDecisionInstance

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;
}
Also used : HistoricDecisionInputInstance(org.camunda.bpm.engine.history.HistoricDecisionInputInstance) HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 22 with HistoricDecisionInstance

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;
}
Also used : HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance)

Example 23 with HistoricDecisionInstance

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;
}
Also used : HistoricDecisionInstanceDto(org.camunda.bpm.engine.rest.dto.history.HistoricDecisionInstanceDto) ArrayList(java.util.ArrayList) HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)

Example 24 with HistoricDecisionInstance

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);
}
Also used : HistoryService(org.camunda.bpm.engine.HistoryService) HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) HistoricDecisionInstanceQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)

Example 25 with HistoricDecisionInstance

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()));
}
Also used : HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) Test(org.junit.Test)

Aggregations

HistoricDecisionInstance (org.camunda.bpm.engine.history.HistoricDecisionInstance)51 Deployment (org.camunda.bpm.engine.test.Deployment)23 HistoricDecisionOutputInstance (org.camunda.bpm.engine.history.HistoricDecisionOutputInstance)9 Test (org.junit.Test)9 HistoricDecisionInputInstance (org.camunda.bpm.engine.history.HistoricDecisionInputInstance)8 ArrayList (java.util.ArrayList)7 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)7 VariableMap (org.camunda.bpm.engine.variable.VariableMap)6 List (java.util.List)4 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)4 CommandContext (org.camunda.bpm.engine.impl.interceptor.CommandContext)4 JobEntity (org.camunda.bpm.engine.impl.persistence.entity.JobEntity)4 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)4 CaseInstance (org.camunda.bpm.engine.runtime.CaseInstance)4 HashMap (java.util.HashMap)3 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)3 HistoricCaseInstance (org.camunda.bpm.engine.history.HistoricCaseInstance)3 HistoricIncident (org.camunda.bpm.engine.history.HistoricIncident)3 HistoricIncidentEntity (org.camunda.bpm.engine.impl.persistence.entity.HistoricIncidentEntity)3 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)3