use of org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE in project tmdm-studio-se by Talend.
the class WSRoutingRuleItemImpl method getWsRoutingRule.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public WSRoutingRuleE getWsRoutingRule() {
if (wsRoutingRule != null && wsRoutingRule.eIsProxy()) {
InternalEObject oldWsRoutingRule = (InternalEObject) wsRoutingRule;
wsRoutingRule = (WSRoutingRuleE) eResolveProxy(oldWsRoutingRule);
if (wsRoutingRule.eResource() == null && eResource() != null) {
URI uri = EcoreUtil.getURI(wsRoutingRule);
if (uri.hasFragment()) {
uri = uri.trimFragment();
}
Resource resource = eResource().getResourceSet().getResource(uri, true);
for (EObject object : resource.getContents()) {
if (object instanceof WSRoutingRuleE) {
wsRoutingRule = (WSRoutingRuleE) object;
break;
}
}
}
if (wsRoutingRule != oldWsRoutingRule) {
if (eNotificationRequired()) {
eNotify(new ENotificationImpl(this, Notification.RESOLVE, MdmpropertiesPackage.WS_ROUTING_RULE_ITEM__WS_ROUTING_RULE, oldWsRoutingRule, wsRoutingRule));
}
}
}
return wsRoutingRule;
}
use of org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE in project tmdm-studio-se by Talend.
the class NewTriggerAction method createServerObject.
@Override
protected Item createServerObject(String key) {
WSRoutingRuleItem item = MdmpropertiesFactory.eINSTANCE.createWSRoutingRuleItem();
ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
item.setState(itemState);
WSRoutingRuleE routingRule = newRoutingRule(key);
item.setWsRoutingRule(routingRule);
if (parentItem != null) {
item.getState().setPath(parentItem.getState().getPath());
RepositoryResourceUtil.createItem(item, key);
}
return item;
}
use of org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE in project tmdm-studio-se by Talend.
the class GenerateJobTriggerAction method doRun.
@Override
protected void doRun() {
selectObj = getSelectedObject().get(0);
JobOptionsDialog dialog = new JobOptionsDialog(getShell(), Messages.JobProcesssDialogTiggerTitle_title, Execution.EMBEDDED);
dialog.setBlockOnOpen(true);
int ret = dialog.open();
if (ret == Dialog.CANCEL) {
return;
}
// $NON-NLS-1$
String jobName = "";
// $NON-NLS-1$
String jobVersion = "";
if (selectObj instanceof IRepositoryViewObject) {
jobName = ((IRepositoryViewObject) selectObj).getProperty().getLabel();
jobVersion = ((IRepositoryViewObject) selectObj).getProperty().getVersion();
}
// check exist
IValidateService validateService = (IValidateService) GlobalServiceRegister.getDefault().getService(IValidateService.class);
if (validateService != null) {
boolean result = validateService.validateAndAlertObjectExistence(IServerObjectRepositoryType.TYPE_ROUTINGRULE, getNewTriggerName(jobName), null);
if (!result) {
return;
}
}
//
WSRoutingRuleE routingRule = createTrigger(jobName, jobVersion, dialog);
// if the new objectect is opened ,than close it before regenerating
IRepositoryViewObject toDelete = RepositoryResourceUtil.findViewObjectByName(IServerObjectRepositoryType.TYPE_ROUTINGRULE, PREFIX + jobName);
if (toDelete != null) {
IEditorPart openedEditor = UIUtil.findOpenedEditor(toDelete);
if (openedEditor != null) {
UIUtil.closeEditor(openedEditor, false);
}
// delete directly
RepositoryResourceUtil.removeViewObjectPhysically(toDelete, jobVersion);
}
AttachToTriggerView(jobName, routingRule);
}
use of org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE in project tmdm-studio-se by Talend.
the class RoutingRuleTest method testHash.
@Test
public void testHash() {
IHashValueCalculator wsCalculator = new WSRoutingRuleHVCalculator();
IHashValueCalculator eobjCalculator = new EObjRoutingRuleHVCalculator();
WSRoutingRule wsRule = initWSObject();
WSRoutingRuleE eobjRule = initEObjRule();
long wsHash = wsCalculator.calculateHash(wsRule);
long eobjHash = eobjCalculator.calculateHash(eobjRule);
assertEquals(wsHash, eobjHash);
}
use of org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE 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;
}
Aggregations