use of org.activiti.engine.impl.bpmn.data.FieldBaseStructureInstance in project Activiti by Activiti.
the class MessageImplicitDataInputAssociation method evaluate.
@Override
public void evaluate(ActivityExecution execution) {
if (StringUtils.isNotEmpty(this.source)) {
Object value = execution.getVariable(this.source);
MessageInstance message = (MessageInstance) execution.getVariable(WebServiceActivityBehavior.CURRENT_MESSAGE);
if (message.getStructureInstance() instanceof FieldBaseStructureInstance) {
FieldBaseStructureInstance structure = (FieldBaseStructureInstance) message.getStructureInstance();
structure.setFieldValue(this.target, value);
}
}
}
use of org.activiti.engine.impl.bpmn.data.FieldBaseStructureInstance in project Activiti by Activiti.
the class WebServiceUELTest method testWebServiceInvocationWithDataFlowUEL.
@Deployment
public void testWebServiceInvocationWithDataFlowUEL() throws Exception {
ProcessDefinitionEntity processDefinition = processEngineConfiguration.getCommandExecutor().execute(new Command<ProcessDefinitionEntity>() {
public ProcessDefinitionEntity execute(CommandContext commandContext) {
return Context.getProcessEngineConfiguration().getDeploymentManager().findDeployedLatestProcessDefinitionByKey("webServiceInvocationWithDataFlowUEL");
}
});
ItemDefinition itemDefinition = processDefinition.getIoSpecification().getDataInputs().get(0).getDefinition();
ItemInstance itemInstance = itemDefinition.createInstance();
FieldBaseStructureInstance structureInstance = (FieldBaseStructureInstance) itemInstance.getStructureInstance();
structureInstance.setFieldValue("prefix", "The counter has the value ");
structureInstance.setFieldValue("suffix", ". Good news");
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("dataInputOfProcess", itemInstance);
ProcessInstance instance = processEngine.getRuntimeService().startProcessInstanceByKey("webServiceInvocationWithDataFlowUEL", variables);
waitForJobExecutorToProcessAllJobs(10000L, 250L);
String response = (String) processEngine.getRuntimeService().getVariable(instance.getId(), "dataOutputOfProcess");
assertEquals("The counter has the value -1. Good news", response);
}
use of org.activiti.engine.impl.bpmn.data.FieldBaseStructureInstance in project Activiti by Activiti.
the class WebServiceUELTest method testAsyncInvocationWithDataFlowUEL.
@Deployment
public void testAsyncInvocationWithDataFlowUEL() throws Exception {
assertEquals(-1, webServiceMock.getCount());
ProcessDefinitionEntity processDefinition = processEngineConfiguration.getCommandExecutor().execute(new Command<ProcessDefinitionEntity>() {
public ProcessDefinitionEntity execute(CommandContext commandContext) {
return Context.getProcessEngineConfiguration().getDeploymentManager().findDeployedLatestProcessDefinitionByKey("asyncWebServiceInvocationWithDataFlowUEL");
}
});
ItemDefinition itemDefinition = processDefinition.getIoSpecification().getDataInputs().get(0).getDefinition();
ItemInstance itemInstance = itemDefinition.createInstance();
FieldBaseStructureInstance structureInstance = (FieldBaseStructureInstance) itemInstance.getStructureInstance();
structureInstance.setFieldValue("newCounterValue", 23);
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("dataInputOfProcess", itemInstance);
processEngine.getRuntimeService().startProcessInstanceByKey("asyncWebServiceInvocationWithDataFlowUEL", variables);
waitForJobExecutorToProcessAllJobs(10000L, 250L);
assertEquals(23, webServiceMock.getCount());
}
use of org.activiti.engine.impl.bpmn.data.FieldBaseStructureInstance in project Activiti by Activiti.
the class MessageImplicitDataOutputAssociation method evaluate.
@Override
public void evaluate(ActivityExecution execution) {
MessageInstance message = (MessageInstance) execution.getVariable(WebServiceActivityBehavior.CURRENT_MESSAGE);
if (message.getStructureInstance() instanceof FieldBaseStructureInstance) {
FieldBaseStructureInstance structure = (FieldBaseStructureInstance) message.getStructureInstance();
execution.setVariable(this.getTarget(), structure.getFieldValue(this.getSource()));
}
}
Aggregations