Search in sources :

Example 26 with HistoricDecisionInstance

use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.

the class TenantIdProviderTest method setNullTenantIdForHistoricDecisionInstance_BusinessRuleTask.

@Test
public void setNullTenantIdForHistoricDecisionInstance_BusinessRuleTask() {
    String tenantId = null;
    SetValueOnHistoricDecisionInstanceTenantIdProvider tenantIdProvider = new SetValueOnHistoricDecisionInstanceTenantIdProvider(tenantId);
    TestTenantIdProvider.delegate = tenantIdProvider;
    BpmnModelInstance process = Bpmn.createExecutableProcess(PROCESS_DEFINITION_KEY).startEvent().businessRuleTask().camundaDecisionRef(DECISION_DEFINITION_KEY).camundaAsyncAfter().endEvent().done();
    testRule.deploy(process, DMN_FILE);
    // if a process instance is started
    engineRule.getRuntimeService().createProcessInstanceByKey(PROCESS_DEFINITION_KEY).setVariables(createVariables()).execute();
    // then the tenant id provider can set the tenant id to a value
    HistoricDecisionInstance historicDecisionInstance = engineRule.getHistoryService().createHistoricDecisionInstanceQuery().decisionDefinitionKey(DECISION_DEFINITION_KEY).singleResult();
    assertThat(historicDecisionInstance.getTenantId(), is(nullValue()));
}
Also used : HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) Test(org.junit.Test)

Example 27 with HistoricDecisionInstance

use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.

the class DeleteHistoricDecisionInstancesBatchCmd method collectHistoricDecisionInstanceIds.

protected List<String> collectHistoricDecisionInstanceIds() {
    Set<String> collectedDecisionInstanceIds = new HashSet<String>();
    List<String> decisionInstanceIds = getHistoricDecisionInstanceIds();
    if (decisionInstanceIds != null) {
        collectedDecisionInstanceIds.addAll(decisionInstanceIds);
    }
    final HistoricDecisionInstanceQueryImpl decisionInstanceQuery = (HistoricDecisionInstanceQueryImpl) historicDecisionInstanceQuery;
    if (decisionInstanceQuery != null) {
        for (HistoricDecisionInstance hdi : decisionInstanceQuery.list()) {
            collectedDecisionInstanceIds.add(hdi.getId());
        }
    }
    return new ArrayList<String>(collectedDecisionInstanceIds);
}
Also used : HistoricDecisionInstanceQueryImpl(org.camunda.bpm.engine.impl.HistoricDecisionInstanceQueryImpl) ArrayList(java.util.ArrayList) HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) HashSet(java.util.HashSet)

Example 28 with HistoricDecisionInstance

use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.

the class BatchHistoricDecisionInstanceDeletionAuthorizationTest method executeDecisionInstances.

@Before
public void executeDecisionInstances() {
    testRule.deploy("org/camunda/bpm/engine/test/api/dmn/Example.dmn");
    VariableMap variables = Variables.createVariables().putValue("status", "silver").putValue("sum", 723);
    for (int i = 0; i < 10; i++) {
        decisionService.evaluateDecisionByKey(DECISION).variables(variables).evaluate();
    }
    List<HistoricDecisionInstance> decisionInstances = historyService.createHistoricDecisionInstanceQuery().list();
    for (HistoricDecisionInstance decisionInstance : decisionInstances) {
        decisionInstanceIds.add(decisionInstance.getId());
    }
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) Before(org.junit.Before)

Example 29 with HistoricDecisionInstance

use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.

the class BatchHistoricDecisionInstanceDeletionUserOperationTest method evaluateDecisionInstances.

@Before
public void evaluateDecisionInstances() {
    testRule.deploy("org/camunda/bpm/engine/test/api/dmn/Example.dmn");
    VariableMap variables = Variables.createVariables().putValue("status", "silver").putValue("sum", 723);
    for (int i = 0; i < 10; i++) {
        decisionService.evaluateDecisionByKey(DECISION).variables(variables).evaluate();
    }
    List<HistoricDecisionInstance> decisionInstances = historyService.createHistoricDecisionInstanceQuery().list();
    for (HistoricDecisionInstance decisionInstance : decisionInstances) {
        decisionInstanceIds.add(decisionInstance.getId());
    }
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) Before(org.junit.Before)

Example 30 with HistoricDecisionInstance

use of org.camunda.bpm.engine.history.HistoricDecisionInstance in project camunda-bpm-platform by camunda.

the class BatchHistoricDecisionInstanceDeletionTest method executeDecisionInstances.

@Before
public void executeDecisionInstances() {
    testRule.deploy("org/camunda/bpm/engine/test/api/dmn/Example.dmn");
    VariableMap variables = Variables.createVariables().putValue("status", "silver").putValue("sum", 723);
    for (int i = 0; i < 10; i++) {
        decisionService.evaluateDecisionByKey(DECISION).variables(variables).evaluate();
    }
    List<HistoricDecisionInstance> decisionInstances = historyService.createHistoricDecisionInstanceQuery().list();
    for (HistoricDecisionInstance decisionInstance : decisionInstances) {
        decisionInstanceIds.add(decisionInstance.getId());
    }
}
Also used : VariableMap(org.camunda.bpm.engine.variable.VariableMap) HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) Before(org.junit.Before)

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