11-11-2016 06:56 PM
@Component("agileIntegrationDelegate")
@Transactional
public class AgileIntegrationOutBoundService implements JavaDelegate {
public Expression entity;
public Expression itemNumber;
public Expression className;
public Expression recipient;
@Autowired
@Qualifier("dataSource")
private DataSource dataSource;
@Override
public void execute(DelegateExecution execution) throws Exception {
try {
execution.getVariables();
String _class = (String) className.getValue(execution);
String item = (String) itemNumber.getValue(execution);
String to = (String) recipient.getValue(execution);
AbstractEntity _entity = (AbstractEntity)entity.getValue(execution);
/*String _class = (String) execution.getVariable("className");
String item = (String) execution.getVariable("itemNumber");
String to = (String) execution.getVariable("recipient");
AbstractEntity _entity = (AbstractEntity)execution.getVariable("entity");
*/
switch(_class)
{
case "TECHNOLOGY":
Technology tech = (Technology) _entity;
System.out.println(tech);
break;
default:
break;
}
System.out.println(_class + item + to);
} catch (Exception e) {
e.printStackTrace();
//throw new BpmnError("BusinessExceptionOccurred");
}
}
}
<process id="agileIntegration" name="Agile Out Bound integration" isExecutable="true">
<startEvent id="startevent1" name="Start"></startEvent>
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1" />
<serviceTask id="servicetask1" name="Java Service to send data" activiti:delegateExpression="${agileIntegrationDelegate}">
<extensionElements>
<activiti:field name="className">
<activiti:string>${className}</activiti:string>
</activiti:field>
<activiti:field name="itemNumber">
<activiti:string>${itemNumber}</activiti:string>
</activiti:field>
<activiti:field name="recipient">
<activiti:string>${recipient}</activiti:string>
</activiti:field>
<activiti:field name="entity">
<activiti:expression>${entity}</activiti:expression>
</activiti:field>
</extensionElements>
</serviceTask>
<sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
</process>
String process = "agileIntegration";
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("itemNumber", itemNumber);
variables.put("className", className);
variables.put("entity", entity);
variables.put("recipient", "nuthankumar.mallavaram@globalfoundries.com");
//variables.put("owner", SecurityUtils.getCurrentLogin());
//variables.put("variables", new String[] {"1234"});
runtimeService.startProcessInstanceByKey(process, variables);
11-26-2016 06:57 PM
11-26-2016 06:57 PM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.