use of org.camunda.bpm.engine.history.HistoricDecisionInputInstance 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.HistoricDecisionInputInstance in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricDecisionInput.
public static HistoricDecisionInputInstance createMockHistoricDecisionInput(TypedValue typedValue) {
HistoricDecisionInputInstance input = mock(HistoricDecisionInputInstance.class);
when(input.getId()).thenReturn(EXAMPLE_HISTORIC_DECISION_INPUT_INSTANCE_ID);
when(input.getDecisionInstanceId()).thenReturn(EXAMPLE_HISTORIC_DECISION_INSTANCE_ID);
when(input.getClauseId()).thenReturn(EXAMPLE_HISTORIC_DECISION_INPUT_INSTANCE_CLAUSE_ID);
when(input.getClauseName()).thenReturn(EXAMPLE_HISTORIC_DECISION_INPUT_INSTANCE_CLAUSE_NAME);
when(input.getTypedValue()).thenReturn(typedValue);
when(input.getErrorMessage()).thenReturn(null);
return input;
}
use of org.camunda.bpm.engine.history.HistoricDecisionInputInstance 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.HistoricDecisionInputInstance in project camunda-bpm-platform by camunda.
the class DefaultDmnHistoryEventProducer method createHistoricDecisionInputInstances.
protected List<HistoricDecisionInputInstance> createHistoricDecisionInputInstances(DmnDecisionTableEvaluationEvent evaluationEvent) {
List<HistoricDecisionInputInstance> inputInstances = new ArrayList<HistoricDecisionInputInstance>();
for (DmnEvaluatedInput inputClause : evaluationEvent.getInputs()) {
HistoricDecisionInputInstanceEntity inputInstance = new HistoricDecisionInputInstanceEntity();
inputInstance.setClauseId(inputClause.getId());
inputInstance.setClauseName(inputClause.getName());
TypedValue typedValue = Variables.untypedValue(inputClause.getValue());
inputInstance.setValue(typedValue);
inputInstances.add(inputInstance);
}
return inputInstances;
}
use of org.camunda.bpm.engine.history.HistoricDecisionInputInstance in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceManager method insertHistoricDecisionInputInstances.
protected void insertHistoricDecisionInputInstances(List<HistoricDecisionInputInstance> inputs, String decisionInstanceId) {
for (HistoricDecisionInputInstance input : inputs) {
HistoricDecisionInputInstanceEntity inputEntity = (HistoricDecisionInputInstanceEntity) input;
inputEntity.setDecisionInstanceId(decisionInstanceId);
getDbEntityManager().insert(inputEntity);
}
}
Aggregations