Search in sources :

Example 1 with WSRoutingRuleE

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;
}
Also used : ENotificationImpl(org.eclipse.emf.ecore.impl.ENotificationImpl) EObject(org.eclipse.emf.ecore.EObject) InternalEObject(org.eclipse.emf.ecore.InternalEObject) Resource(org.eclipse.emf.ecore.resource.Resource) WSRoutingRuleE(org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE) URI(org.eclipse.emf.common.util.URI) InternalEObject(org.eclipse.emf.ecore.InternalEObject)

Example 2 with WSRoutingRuleE

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;
}
Also used : ItemState(org.talend.core.model.properties.ItemState) WSRoutingRuleE(org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE) WSRoutingRuleItem(org.talend.mdm.repository.model.mdmproperties.WSRoutingRuleItem)

Example 3 with WSRoutingRuleE

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);
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) WSRoutingRuleE(org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE) IEditorPart(org.eclipse.ui.IEditorPart) JobOptionsDialog(org.talend.mdm.repository.ui.dialogs.job.JobOptionsDialog) IValidateService(com.amalto.workbench.service.IValidateService)

Example 4 with WSRoutingRuleE

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);
}
Also used : WSRoutingRuleHVCalculator(org.talend.mdm.repository.core.hash.routingrule.WSRoutingRuleHVCalculator) IHashValueCalculator(org.talend.mdm.commmon.util.hash.IHashValueCalculator) EObjRoutingRuleHVCalculator(org.talend.mdm.repository.core.hash.routingrule.EObjRoutingRuleHVCalculator) WSRoutingRule(com.amalto.workbench.webservices.WSRoutingRule) WSRoutingRuleE(org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE) Test(org.junit.Test)

Example 5 with WSRoutingRuleE

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;
}
Also used : WSRoutingRuleExpressionE(org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleExpressionE) WSRoutingRuleOperatorE(org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleOperatorE) WSRoutingRuleE(org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE)

Aggregations

WSRoutingRuleE (org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleE)9 ENotificationImpl (org.eclipse.emf.ecore.impl.ENotificationImpl)2 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)2 WSRoutingRuleItem (org.talend.mdm.repository.model.mdmproperties.WSRoutingRuleItem)2 WSRoutingRuleExpressionE (org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleExpressionE)2 IValidateService (com.amalto.workbench.service.IValidateService)1 WSRoutingRule (com.amalto.workbench.webservices.WSRoutingRule)1 URI (org.eclipse.emf.common.util.URI)1 EObject (org.eclipse.emf.ecore.EObject)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 IEditorPart (org.eclipse.ui.IEditorPart)1 Test (org.junit.Test)1 Item (org.talend.core.model.properties.Item)1 ItemState (org.talend.core.model.properties.ItemState)1 IHashValueCalculator (org.talend.mdm.commmon.util.hash.IHashValueCalculator)1 EObjRoutingRuleHVCalculator (org.talend.mdm.repository.core.hash.routingrule.EObjRoutingRuleHVCalculator)1 WSRoutingRuleHVCalculator (org.talend.mdm.repository.core.hash.routingrule.WSRoutingRuleHVCalculator)1 WSRoutingRuleOperatorE (org.talend.mdm.repository.model.mdmserverobject.WSRoutingRuleOperatorE)1 JobOptionsDialog (org.talend.mdm.repository.ui.dialogs.job.JobOptionsDialog)1