Search in sources :

Example 1 with WSDroppedItemPK

use of com.amalto.workbench.webservices.WSDroppedItemPK 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

TMDMService (com.amalto.workbench.webservices.TMDMService)1 WSDroppedItemPK (com.amalto.workbench.webservices.WSDroppedItemPK)1 WSFindAllDroppedItemsPKs (com.amalto.workbench.webservices.WSFindAllDroppedItemsPKs)1 WSItemPK (com.amalto.workbench.webservices.WSItemPK)1 Cursor (org.eclipse.swt.graphics.Cursor)1 Display (org.eclipse.swt.widgets.Display)1