use of org.activiti.engine.impl.bpmn.data.ItemDefinition in project Activiti by Activiti.
the class BpmnParse method createMessages.
public void createMessages() {
for (Message messageElement : bpmnModel.getMessages()) {
MessageDefinition messageDefinition = new MessageDefinition(messageElement.getId(), name);
if (StringUtils.isNotEmpty(messageElement.getItemRef())) {
if (this.itemDefinitions.containsKey(messageElement.getItemRef())) {
ItemDefinition itemDefinition = this.itemDefinitions.get(messageElement.getItemRef());
messageDefinition.setItemDefinition(itemDefinition);
}
}
this.messages.put(messageDefinition.getId(), messageDefinition);
}
}
use of org.activiti.engine.impl.bpmn.data.ItemDefinition in project Activiti by Activiti.
the class BpmnParse method createItemDefinitions.
protected void createItemDefinitions() {
for (org.activiti.bpmn.model.ItemDefinition itemDefinitionElement : bpmnModel.getItemDefinitions().values()) {
StructureDefinition structure = null;
try {
// it is a class
Class<?> classStructure = ReflectUtil.loadClass(itemDefinitionElement.getStructureRef());
structure = new ClassStructureDefinition(classStructure);
} catch (ActivitiException e) {
// it is a reference to a different structure
structure = this.structures.get(itemDefinitionElement.getStructureRef());
}
ItemDefinition itemDefinition = new ItemDefinition(itemDefinitionElement.getId(), structure);
if (StringUtils.isNotEmpty(itemDefinitionElement.getItemKind())) {
itemDefinition.setItemKind(ItemKind.valueOf(itemDefinitionElement.getItemKind()));
}
itemDefinitions.put(itemDefinition.getId(), itemDefinition);
}
}
use of org.activiti.engine.impl.bpmn.data.ItemDefinition in project Activiti by Activiti.
the class AbstractBpmnParseHandler method createIOSpecification.
protected IOSpecification createIOSpecification(BpmnParse bpmnParse, org.activiti.bpmn.model.IOSpecification specificationModel) {
IOSpecification ioSpecification = new IOSpecification();
for (DataSpec dataInputElement : specificationModel.getDataInputs()) {
ItemDefinition itemDefinition = bpmnParse.getItemDefinitions().get(dataInputElement.getItemSubjectRef());
Data dataInput = new Data(bpmnParse.getTargetNamespace() + ":" + dataInputElement.getId(), dataInputElement.getId(), itemDefinition);
ioSpecification.addInput(dataInput);
}
for (DataSpec dataOutputElement : specificationModel.getDataOutputs()) {
ItemDefinition itemDefinition = bpmnParse.getItemDefinitions().get(dataOutputElement.getItemSubjectRef());
Data dataOutput = new Data(bpmnParse.getTargetNamespace() + ":" + dataOutputElement.getId(), dataOutputElement.getId(), itemDefinition);
ioSpecification.addOutput(dataOutput);
}
for (String dataInputRef : specificationModel.getDataInputRefs()) {
DataRef dataRef = new DataRef(dataInputRef);
ioSpecification.addInputRef(dataRef);
}
for (String dataOutputRef : specificationModel.getDataOutputRefs()) {
DataRef dataRef = new DataRef(dataOutputRef);
ioSpecification.addOutputRef(dataRef);
}
return ioSpecification;
}
use of org.activiti.engine.impl.bpmn.data.ItemDefinition 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.ItemDefinition 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());
}
Aggregations