Search in sources :

Example 1 with WSItemPK

use of com.amalto.workbench.webservices.WSItemPK in project tmdm-studio-se by Talend.

the class TestTriggerAction method test.

protected void test() {
    try {
        String dataCluster = dialog.getDataContainer();
        String concept = dialog.getConcept();
        String[] recordIds = dialog.getRecordIds();
        if (recordIds == null || recordIds.length == 0) {
            MessageDialog.openError(getShell(), Messages._Error, Messages.RoutingRuleMainPage2_NoRecordSelected);
            return;
        }
        WSRoutingRulePKArray routeItemV2 = service.routeItemV2(new WSRouteItemV2(new WSItemPK(concept, Arrays.asList(recordIds), new WSDataClusterPK(dataCluster))));
        if (routeItemV2 == null || routeItemV2.getWsRoutingRulePKs() == null || routeItemV2.getWsRoutingRulePKs().size() == 0) {
            MessageDialog.openInformation(getShell(), Messages.RoutingRuleMainPage2_Success, Messages.RoutingRuleMainPage2_noTriggerExecuted);
            return;
        }
        List<WSRoutingRulePK> wsRoutingRulePKs = routeItemV2.getWsRoutingRulePKs();
        StringBuilder builder = new StringBuilder(wsRoutingRulePKs.get(0).getPk());
        for (int i = 1; i < wsRoutingRulePKs.size(); i++) {
            // $NON-NLS-1$
            builder.append("," + wsRoutingRulePKs.get(i).getPk());
        }
        MessageDialog.openInformation(getShell(), Messages.RoutingRuleMainPage2_Success, Messages.bind(Messages.RoutingRuleMainPage2_ExecuteTriggerSuccess, builder.toString()));
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(getShell(), Messages._Error, Messages.RoutingRuleMainPage2_ErrorTestTrigger);
    }
}
Also used : WSDataClusterPK(com.amalto.workbench.webservices.WSDataClusterPK) WSItemPK(com.amalto.workbench.webservices.WSItemPK) WSRoutingRulePKArray(com.amalto.workbench.webservices.WSRoutingRulePKArray) WSRoutingRulePK(com.amalto.workbench.webservices.WSRoutingRulePK) WSRouteItemV2(com.amalto.workbench.webservices.WSRouteItemV2)

Example 2 with WSItemPK

use of com.amalto.workbench.webservices.WSItemPK in project tmdm-studio-se by Talend.

the class DataClusterDialog method showInTextWidget.

private void showInTextWidget(LineItem lineItem) {
    if (lineItem == null) {
        // $NON-NLS-1$
        textViewer.setText("");
        // $NON-NLS-1$
        recordContent = "";
        return;
    }
    try {
        final TMDMService service = Util.getMDMService(model);
        final WSItem wsItem = service.getItem(new WSGetItem(new WSItemPK(lineItem.getConcept().trim(), Arrays.asList(lineItem.getIds()), (WSDataClusterPK) model.getWsKey())));
        recordContent = Util.formatXsdSource(wsItem.getContent());
        textViewer.setText(recordContent);
    } catch (WebServiceException e) {
        log.error(e.getMessage(), e);
    } catch (XtentisException e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(getShell(), Messages._Error, Messages.bind(Messages.DataClusterBrowserMainPage_36, e.getLocalizedMessage()));
    }
}
Also used : WSGetItem(com.amalto.workbench.webservices.WSGetItem) WebServiceException(javax.xml.ws.WebServiceException) TMDMService(com.amalto.workbench.webservices.TMDMService) WSItem(com.amalto.workbench.webservices.WSItem) WSItemPK(com.amalto.workbench.webservices.WSItemPK) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 3 with WSItemPK

use of com.amalto.workbench.webservices.WSItemPK in project tmdm-studio-se by Talend.

the class ItemsTrashBrowserMainPage method getResults.

protected LineItem[] getResults(boolean showResultInfo) {
    Cursor waitCursor = null;
    try {
        Display display = getEditor().getSite().getPage().getWorkbenchWindow().getWorkbench().getDisplay();
        waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
        this.getSite().getShell().setCursor(waitCursor);
        TMDMService service = Util.getMDMService(getXObject());
        String search = searchText.getText();
        List<WSDroppedItemPK> results = null;
        if (search != null && search.length() > 0) {
            results = service.findAllDroppedItemsPKs(new WSFindAllDroppedItemsPKs(search)).getWsDroppedItemPK();
        }
        if ((results == null) || (results.isEmpty())) {
            if (showResultInfo) {
                MessageDialog.openInformation(this.getSite().getShell(), Messages.ItemsTrashBrowserMainPage_15, Messages.ItemsTrashBrowserMainPage_16);
                return new LineItem[0];
            }
        } else {
            LineItem[] res = new LineItem[results.size()];
            for (int i = 0; i < results.size(); i++) {
                WSDroppedItemPK wsDroppedItemPK = results.get(i);
                WSItemPK refWSItemPK = wsDroppedItemPK.getWsItemPK();
                // if(revison==null||revison.equals(""))revison="head";
                res[i] = new LineItem(refWSItemPK.getWsDataClusterPK().getPk(), refWSItemPK.getConceptName(), refWSItemPK.getIds().toArray(new String[0]), null, wsDroppedItemPK.getPartPath());
            }
            return res;
        }
        return new LineItem[0];
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        if ((e.getLocalizedMessage() != null) && e.getLocalizedMessage().contains("10000")) {
            MessageDialog.openError(this.getSite().getShell(), Messages.ItemsTrashBrowserMainPage_17, Messages.ItemsTrashBrowserMainPage_18);
        } else {
            if (!Util.handleConnectionException(this, e, null)) {
                MessageDialog.openError(this.getSite().getShell(), Messages.ItemsTrashBrowserMainPage_19, e.getLocalizedMessage());
            }
        }
        return null;
    } finally {
        try {
            this.getSite().getShell().setCursor(null);
            waitCursor.dispose();
        } catch (Exception e) {
        }
    }
}
Also used : WSFindAllDroppedItemsPKs(com.amalto.workbench.webservices.WSFindAllDroppedItemsPKs) TMDMService(com.amalto.workbench.webservices.TMDMService) WSItemPK(com.amalto.workbench.webservices.WSItemPK) WSDroppedItemPK(com.amalto.workbench.webservices.WSDroppedItemPK) Cursor(org.eclipse.swt.graphics.Cursor) Display(org.eclipse.swt.widgets.Display)

Aggregations

WSItemPK (com.amalto.workbench.webservices.WSItemPK)3 TMDMService (com.amalto.workbench.webservices.TMDMService)2 XtentisException (com.amalto.workbench.utils.XtentisException)1 WSDataClusterPK (com.amalto.workbench.webservices.WSDataClusterPK)1 WSDroppedItemPK (com.amalto.workbench.webservices.WSDroppedItemPK)1 WSFindAllDroppedItemsPKs (com.amalto.workbench.webservices.WSFindAllDroppedItemsPKs)1 WSGetItem (com.amalto.workbench.webservices.WSGetItem)1 WSItem (com.amalto.workbench.webservices.WSItem)1 WSRouteItemV2 (com.amalto.workbench.webservices.WSRouteItemV2)1 WSRoutingRulePK (com.amalto.workbench.webservices.WSRoutingRulePK)1 WSRoutingRulePKArray (com.amalto.workbench.webservices.WSRoutingRulePKArray)1 WebServiceException (javax.xml.ws.WebServiceException)1 Cursor (org.eclipse.swt.graphics.Cursor)1 Display (org.eclipse.swt.widgets.Display)1