Search in sources :

Example 1 with HistoricDecisionOutputInstance

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

the class HistoricDecisionInstanceDto method fromHistoricDecisionInstance.

public static HistoricDecisionInstanceDto fromHistoricDecisionInstance(HistoricDecisionInstance historicDecisionInstance) {
    HistoricDecisionInstanceDto dto = new HistoricDecisionInstanceDto();
    dto.id = historicDecisionInstance.getId();
    dto.decisionDefinitionId = historicDecisionInstance.getDecisionDefinitionId();
    dto.decisionDefinitionKey = historicDecisionInstance.getDecisionDefinitionKey();
    dto.decisionDefinitionName = historicDecisionInstance.getDecisionDefinitionName();
    dto.evaluationTime = historicDecisionInstance.getEvaluationTime();
    dto.processDefinitionId = historicDecisionInstance.getProcessDefinitionId();
    dto.processDefinitionKey = historicDecisionInstance.getProcessDefinitionKey();
    dto.processInstanceId = historicDecisionInstance.getProcessInstanceId();
    dto.caseDefinitionId = historicDecisionInstance.getCaseDefinitionId();
    dto.caseDefinitionKey = historicDecisionInstance.getCaseDefinitionKey();
    dto.caseInstanceId = historicDecisionInstance.getCaseInstanceId();
    dto.activityId = historicDecisionInstance.getActivityId();
    dto.activityInstanceId = historicDecisionInstance.getActivityInstanceId();
    dto.userId = historicDecisionInstance.getUserId();
    dto.collectResultValue = historicDecisionInstance.getCollectResultValue();
    dto.rootDecisionInstanceId = historicDecisionInstance.getRootDecisionInstanceId();
    dto.decisionRequirementsDefinitionId = historicDecisionInstance.getDecisionRequirementsDefinitionId();
    dto.decisionRequirementsDefinitionKey = historicDecisionInstance.getDecisionRequirementsDefinitionKey();
    dto.tenantId = historicDecisionInstance.getTenantId();
    try {
        List<HistoricDecisionInputInstanceDto> inputs = new ArrayList<HistoricDecisionInputInstanceDto>();
        for (HistoricDecisionInputInstance input : historicDecisionInstance.getInputs()) {
            HistoricDecisionInputInstanceDto inputDto = HistoricDecisionInputInstanceDto.fromHistoricDecisionInputInstance(input);
            inputs.add(inputDto);
        }
        dto.inputs = inputs;
    } catch (ProcessEngineException e) {
    // no inputs fetched
    }
    try {
        List<HistoricDecisionOutputInstanceDto> outputs = new ArrayList<HistoricDecisionOutputInstanceDto>();
        for (HistoricDecisionOutputInstance output : historicDecisionInstance.getOutputs()) {
            HistoricDecisionOutputInstanceDto outputDto = HistoricDecisionOutputInstanceDto.fromHistoricDecisionOutputInstance(output);
            outputs.add(outputDto);
        }
        dto.outputs = outputs;
    } catch (ProcessEngineException e) {
    // no outputs fetched
    }
    return dto;
}
Also used : HistoricDecisionInputInstance(org.camunda.bpm.engine.history.HistoricDecisionInputInstance) ArrayList(java.util.ArrayList) HistoricDecisionOutputInstance(org.camunda.bpm.engine.history.HistoricDecisionOutputInstance) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 2 with HistoricDecisionOutputInstance

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

the class MockProvider method createMockHistoricDecisionInstanceWithOutputs.

public static HistoricDecisionInstance createMockHistoricDecisionInstanceWithOutputs() {
    List<HistoricDecisionOutputInstance> outputs = createMockHistoricDecisionOutputInstances();
    HistoricDecisionInstance mock = createMockHistoricDecisionInstanceBase();
    when(mock.getInputs()).thenThrow(new ProcessEngineException("ENGINE-03060 The input instances for the historic decision instance are not fetched. You must call 'includeInputs()' on the query to enable fetching."));
    when(mock.getOutputs()).thenReturn(outputs);
    return mock;
}
Also used : HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) HistoricDecisionOutputInstance(org.camunda.bpm.engine.history.HistoricDecisionOutputInstance) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 3 with HistoricDecisionOutputInstance

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

the class MockProvider method createMockHistoricDecisionOutput.

public static HistoricDecisionOutputInstance createMockHistoricDecisionOutput(TypedValue typedValue) {
    HistoricDecisionOutputInstance output = mock(HistoricDecisionOutputInstance.class);
    when(output.getId()).thenReturn(EXAMPLE_HISTORIC_DECISION_OUTPUT_INSTANCE_ID);
    when(output.getDecisionInstanceId()).thenReturn(EXAMPLE_HISTORIC_DECISION_INSTANCE_ID);
    when(output.getClauseId()).thenReturn(EXAMPLE_HISTORIC_DECISION_OUTPUT_INSTANCE_CLAUSE_ID);
    when(output.getClauseName()).thenReturn(EXAMPLE_HISTORIC_DECISION_OUTPUT_INSTANCE_CLAUSE_NAME);
    when(output.getRuleId()).thenReturn(EXAMPLE_HISTORIC_DECISION_OUTPUT_INSTANCE_RULE_ID);
    when(output.getRuleOrder()).thenReturn(EXAMPLE_HISTORIC_DECISION_OUTPUT_INSTANCE_RULE_ORDER);
    when(output.getVariableName()).thenReturn(EXAMPLE_HISTORIC_DECISION_OUTPUT_INSTANCE_VARIABLE_NAME);
    when(output.getTypedValue()).thenReturn(typedValue);
    when(output.getErrorMessage()).thenReturn(null);
    return output;
}
Also used : HistoricDecisionOutputInstance(org.camunda.bpm.engine.history.HistoricDecisionOutputInstance)

Example 4 with HistoricDecisionOutputInstance

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

the class HistoricDecisionInstanceSerializationTest method testListJsonProperty.

@Deployment(resources = { "org/camunda/spin/plugin/DecisionSingleOutput.dmn11.xml" })
public void testListJsonProperty() {
    JsonListSerializable<String> list = new JsonListSerializable<String>();
    list.addElement("foo");
    ObjectValue objectValue = Variables.objectValue(list).serializationDataFormat(DataFormats.JSON_DATAFORMAT_NAME).create();
    VariableMap variables = Variables.createVariables().putValueTyped("input1", objectValue);
    decisionService.evaluateDecisionTableByKey("testDecision", variables);
    HistoricDecisionInstance testDecision = historyService.createHistoricDecisionInstanceQuery().decisionDefinitionKey("testDecision").includeInputs().includeOutputs().singleResult();
    assertNotNull(testDecision);
    List<HistoricDecisionInputInstance> inputs = testDecision.getInputs();
    assertEquals(1, inputs.size());
    HistoricDecisionInputInstance inputInstance = inputs.get(0);
    assertEquals(list.getListProperty(), inputInstance.getValue());
    List<HistoricDecisionOutputInstance> outputs = testDecision.getOutputs();
    assertEquals(1, outputs.size());
    HistoricDecisionOutputInstance outputInstance = outputs.get(0);
    assertEquals(list.getListProperty(), outputInstance.getValue());
}
Also used : HistoricDecisionInputInstance(org.camunda.bpm.engine.history.HistoricDecisionInputInstance) ObjectValue(org.camunda.bpm.engine.variable.value.ObjectValue) VariableMap(org.camunda.bpm.engine.variable.VariableMap) HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) HistoricDecisionOutputInstance(org.camunda.bpm.engine.history.HistoricDecisionOutputInstance) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 5 with HistoricDecisionOutputInstance

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

the class BulkHistoryDeleteTest method collectHistoricDecisionOutputIds.

private void collectHistoricDecisionOutputIds(List<HistoricDecisionInstance> historicDecisionInstances, List<String> historicDecisionOutputIds, List<String> outputByteArrayId) {
    for (HistoricDecisionInstance historicDecisionInstance : historicDecisionInstances) {
        for (HistoricDecisionOutputInstance outputInstanceEntity : historicDecisionInstance.getOutputs()) {
            historicDecisionOutputIds.add(outputInstanceEntity.getId());
            final String byteArrayValueId = ((HistoricDecisionOutputInstanceEntity) outputInstanceEntity).getByteArrayValueId();
            if (byteArrayValueId != null) {
                outputByteArrayId.add(byteArrayValueId);
            }
        }
    }
    assertEquals(PROCESS_INSTANCE_COUNT, historicDecisionOutputIds.size());
}
Also used : HistoricDecisionOutputInstanceEntity(org.camunda.bpm.engine.impl.history.event.HistoricDecisionOutputInstanceEntity) HistoricDecisionInstance(org.camunda.bpm.engine.history.HistoricDecisionInstance) HistoricDecisionOutputInstance(org.camunda.bpm.engine.history.HistoricDecisionOutputInstance)

Aggregations

HistoricDecisionOutputInstance (org.camunda.bpm.engine.history.HistoricDecisionOutputInstance)14 HistoricDecisionInstance (org.camunda.bpm.engine.history.HistoricDecisionInstance)9 Deployment (org.camunda.bpm.engine.test.Deployment)6 HistoricDecisionInputInstance (org.camunda.bpm.engine.history.HistoricDecisionInputInstance)4 ArrayList (java.util.ArrayList)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 HistoricDecisionOutputInstanceEntity (org.camunda.bpm.engine.impl.history.event.HistoricDecisionOutputInstanceEntity)2 DecisionDefinition (org.camunda.bpm.engine.repository.DecisionDefinition)2 DmnDecisionLiteralExpressionEvaluationEvent (org.camunda.bpm.dmn.engine.delegate.DmnDecisionLiteralExpressionEvaluationEvent)1 DmnDecisionTableEvaluationEvent (org.camunda.bpm.dmn.engine.delegate.DmnDecisionTableEvaluationEvent)1 DmnEvaluatedDecisionRule (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedDecisionRule)1 DmnEvaluatedOutput (org.camunda.bpm.dmn.engine.delegate.DmnEvaluatedOutput)1 HistoricDecisionInstanceQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery)1 VariableMap (org.camunda.bpm.engine.variable.VariableMap)1 ObjectValue (org.camunda.bpm.engine.variable.value.ObjectValue)1 Test (org.junit.Test)1