use of org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleExpressionE in project tmdm-studio-se by Talend.
the class RoutingRuleTest method initEObjRule.
private WSRoutingRuleE initEObjRule() {
WSRoutingRuleE rule = MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleE();
// $NON-NLS-1$
rule.setName("ruleNameA");
// $NON-NLS-1$
rule.setConcept("concept");
// $NON-NLS-1$
rule.setCondition("condition");
rule.setDeactive(true);
// $NON-NLS-1$
rule.setDescription("description");
// $NON-NLS-1$
rule.setParameters("parameters");
// $NON-NLS-1$
rule.setServiceJNDI("serviceJNDI");
rule.setSynchronous(false);
for (int i = 0; i < operators.size(); i++) {
WSRoutingRuleExpressionE exp = MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleExpressionE();
// $NON-NLS-1$
exp.setName("expression" + i);
// $NON-NLS-1$
exp.setValue("value" + i);
// $NON-NLS-1$
exp.setXpath("xpath" + i);
//
WSRoutingRuleOperatorE o1 = MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleOperatorE();
o1.setValue(operators.get(i));
exp.setWsOperator(o1);
rule.getWsRoutingRuleExpressions().add(exp);
}
return rule;
}
use of org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleExpressionE in project tmdm-studio-se by Talend.
the class GenerateJobTriggerAction method createTrigger.
/**
* DOC jsxie Comment method "createTrigger".
*
* @param dialog
* @param jobVersion2
*/
private WSRoutingRuleE createTrigger(String jobName, String jobVersion, JobOptionsDialog dialog) {
WSRoutingRuleE routingRule = MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleE();
try {
// $NON-NLS-1$
String server = "http://localhost:8180";
Execution execution = dialog.getExecution();
// $NON-NLS-1$
String url = "";
switch(execution) {
case EMBEDDED:
// $NON-NLS-1$ //$NON-NLS-2$
url = "ltj://" + jobName + "/" + jobVersion;
break;
case WEB_SERVICE:
url = Messages.bind(Messages.GenerateJobXX_UrlString, server, jobName, jobVersion, jobName);
break;
}
Parameter executionParameter = dialog.getParameter();
// $NON-NLS-1$
String parameter = "";
switch(executionParameter) {
case CONTEXT_VARIABLE:
parameter = // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"<configuration>\n" + "<url>" + url + "</url><contextParam>\n" + "<name>xmlInput</name>\n" + "<value>{exchange_data}</value>\n" + // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"</contextParam>\n" + // $NON-NLS-1$
"</configuration>\n";
break;
case INTEGRATED:
parameter = // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
"<configuration>\n" + "<url>" + url + "</url>" + // $NON-NLS-1$
"</configuration>\n";
break;
}
// Generate the job call
// create default CREATE operation express
WSRoutingRuleExpressionE expression1 = MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleExpressionE();
// $NON-NLS-1$
expression1.setName("C1");
// $NON-NLS-1$
expression1.setXpath("Update/OperationType");
expression1.setWsOperator(newContainRoutingRuleOperator());
// $NON-NLS-1$
expression1.setValue("CREATE");
WSRoutingRuleExpressionE expression2 = MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleExpressionE();
// $NON-NLS-1$
expression2.setName("C2");
// $NON-NLS-1$
expression2.setXpath("Update/OperationType");
expression2.setWsOperator(newContainRoutingRuleOperator());
// $NON-NLS-1$
expression2.setValue("UPDATE");
WSRoutingRuleExpressionE expression3 = MdmserverobjectFactory.eINSTANCE.createWSRoutingRuleExpressionE();
// $NON-NLS-1$
expression3.setName("C3");
// $NON-NLS-1$
expression3.setXpath("Update/OperationType");
expression3.setWsOperator(newContainRoutingRuleOperator());
// $NON-NLS-1$
expression3.setValue("DELETE");
routingRule.setName(getNewTriggerName(jobName));
// $NON-NLS-1$
routingRule.setDescription("Trigger that calls the Talend Job: " + jobName);
routingRule.setSynchronous(false);
// $NON-NLS-1$
routingRule.setConcept("Update");
// $NON-NLS-1$
routingRule.setServiceJNDI("amalto/local/service/callJob");
routingRule.setParameters(parameter);
routingRule.setCondition(null);
routingRule.setDeactive(false);
routingRule.getWsRoutingRuleExpressions().add(expression1);
routingRule.getWsRoutingRuleExpressions().add(expression2);
routingRule.getWsRoutingRuleExpressions().add(expression3);
// $NON-NLS-1$
routingRule.setCondition("C1 Or C2 Or C3");
routingRule.setDeactive(false);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
return routingRule;
}
Aggregations