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;
}
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;
}
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;
}
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());
}
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());
}
Aggregations