Search in sources :

Example 1 with WSServicesListItem

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

the class ServiceConfigrationMainPage method setForServiceNameCombo.

protected void setForServiceNameCombo() {
    try {
        service = Util.getMDMService(getXObject());
        // $NON-NLS-1$
        WSServicesList list = service.getServicesList(new WSGetServicesList(""));
        List<WSServicesListItem> items = list.getItem();
        if (items != null) {
            String[] sortedList = new String[items.size()];
            for (int i = 0; i < items.size(); i++) {
                sortedList[i] = items.get(i).getJndiName();
            }
            Arrays.sort(sortedList);
            for (String element : sortedList) {
                WSServiceGetDocument doc = service.getServiceDocument(new WSString(element.trim()));
                if (doc.getConfigureSchema() == null || doc.getConfigureSchema().length() == 0) {
                    continue;
                }
                serviceNameCombo.add(element);
            }
        }
    } catch (Exception e) {
        if (!Util.handleConnectionException(getSite().getShell(), e, Messages.EditXObjectAction_ErrorMsg2)) {
            MessageDialog.openError(getSite().getShell(), Messages._Error, Messages.bind(Messages.EditXObjectAction_ErrorMsg2, e.getLocalizedMessage()));
        }
    }
}
Also used : WSServicesListItem(com.amalto.workbench.webservices.WSServicesListItem) WSServiceGetDocument(com.amalto.workbench.webservices.WSServiceGetDocument) WSString(com.amalto.workbench.webservices.WSString) WSServicesList(com.amalto.workbench.webservices.WSServicesList) WSString(com.amalto.workbench.webservices.WSString) WSGetServicesList(com.amalto.workbench.webservices.WSGetServicesList) DocumentException(org.dom4j.DocumentException) IOException(java.io.IOException) WebServiceException(javax.xml.ws.WebServiceException)

Example 2 with WSServicesListItem

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

the class RoutingEngineV2BrowserMainPage method createFormContent.

@Override
protected void createFormContent(IManagedForm managedForm) {
    try {
        // sets the title
        managedForm.getForm().setText(this.getTitle());
        // get the toolkit
        FormToolkit toolkit = managedForm.getToolkit();
        // get the body
        Composite composite = managedForm.getForm().getBody();
        composite.setLayout(new GridLayout(1, false));
        // Create a Router status holder
        Composite statusComposite = toolkit.createComposite(composite, SWT.NONE);
        statusComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        statusComposite.setLayout(new GridLayout(5, false));
        // status
        Label descriptionLabel = toolkit.createLabel(statusComposite, Messages.RoutingEngineV2BrowserMainPage_EventManagerStatus, SWT.NULL);
        descriptionLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
        // $NON-NLS-1$
        statusLabel = toolkit.createLabel(statusComposite, "                                           ", SWT.NULL);
        statusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
        startButton = toolkit.createButton(statusComposite, BLANK, SWT.PUSH);
        startButton.setImage(ImageCache.getCreatedImage(EImage.RUN_EXC.getPath()));
        startButton.setToolTipText(Messages.RoutingEngineV2BrowserMainPage_Start);
        startButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
        startButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                startSubscriptionEngine();
                updateButtons();
            }
        });
        stopButton = toolkit.createButton(statusComposite, BLANK, SWT.PUSH);
        stopButton.setImage(ImageCache.getCreatedImage(EImage.STOP.getPath()));
        stopButton.setToolTipText(Messages.RoutingEngineV2BrowserMainPage_Stop);
        stopButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
        stopButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                stopSubscriptionEngine();
                updateButtons();
            }
        });
        suspendButton = toolkit.createButton(statusComposite, BLANK, SWT.PUSH);
        suspendButton.setImage(ImageCache.getCreatedImage(EImage.SUSPEND.getPath()));
        suspendButton.setToolTipText(Messages.RoutingEngineV2BrowserMainPage_Suspend);
        suspendButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true, 1, 1));
        suspendButton.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                suspendSubscriptionEngine();
                updateButtons();
            }
        });
        Composite separator = toolkit.createCompositeSeparator(composite);
        separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        ((GridData) separator.getLayoutData()).heightHint = 2;
        // first Line of routing Orders
        Composite firstLineComposite = toolkit.createComposite(composite);
        firstLineComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
        firstLineComposite.setLayout(new GridLayout(9, false));
        // Routing Orders Label
        Label routingOrdersLabel = toolkit.createLabel(firstLineComposite, Messages.RoutingEngineV2BrowserMainPage_RoutingOrders, SWT.NULL);
        routingOrdersLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 9, 1));
        // from
        Label fromLabel = toolkit.createLabel(firstLineComposite, Messages.RoutingEngineV2BrowserMainPage_From, SWT.NULL);
        fromLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        CalendarSelectWidget fromCalendar = new CalendarSelectWidget(toolkit, firstLineComposite, true);
        fromText = fromCalendar.getText();
        // to
        Label toLabel = toolkit.createLabel(firstLineComposite, Messages.RoutingEngineV2BrowserMainPage_To, SWT.NULL);
        toLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        CalendarSelectWidget toCalendar = new CalendarSelectWidget(toolkit, firstLineComposite, false);
        toText = toCalendar.getText();
        Label statusLab = toolkit.createLabel(firstLineComposite, Messages.RoutingEngineV2BrowserMainPage_Status, SWT.NULL);
        statusLab.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        statusCombo = new Combo(firstLineComposite, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.MULTI);
        statusCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        statusCombo.addKeyListener(new KeyAdapter() {

            @Override
            public void keyReleased(KeyEvent e) {
                if ((e.stateMask == 0) && (e.character == SWT.CR)) {
                    doSearch();
                }
            }
        });
        // $NON-NLS-1$
        statusCombo.add("FAILED");
        // $NON-NLS-1$
        statusCombo.add("COMPLETED");
        statusCombo.select(0);
        // to
        Button bSearch = toolkit.createButton(firstLineComposite, BLANK, SWT.CENTER);
        bSearch.setImage(ImageCache.getCreatedImage(EImage.BROWSE.getPath()));
        bSearch.setToolTipText(Messages.RoutingEngineV2BrowserMainPage_Search);
        bSearch.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        bSearch.addListener(SWT.Selection, new Listener() {

            public void handleEvent(Event event) {
                pageToolBar.reset();
                doSearch();
            }
        });
        // Second Line of routing Orders
        Composite searchLineComposite = toolkit.createComposite(composite);
        searchLineComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
        searchLineComposite.setLayout(new GridLayout(4, false));
        // document type
        Label documentTypeLabel = toolkit.createLabel(searchLineComposite, Messages.RoutingEngineV2BrowserMainPage_DocumentType, SWT.NULL);
        documentTypeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        // DocumentType
        documentTypeText = toolkit.createText(searchLineComposite, BLANK, SWT.BORDER);
        documentTypeText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
        ((GridData) documentTypeText.getLayoutData()).widthHint = 120;
        documentTypeText.addKeyListener(new KeyAdapter() {

            @Override
            public void keyReleased(KeyEvent e) {
                if ((e.stateMask == 0) && (e.character == SWT.CR)) {
                    doSearch();
                }
            }
        });
        // ID
        Label idLabel = toolkit.createLabel(searchLineComposite, Messages.RoutingEngineV2BrowserMainPage_ItemIDs, SWT.NULL);
        idLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        // ID
        idText = toolkit.createText(searchLineComposite, BLANK, SWT.BORDER);
        idText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
        idText.addKeyListener(new KeyAdapter() {

            @Override
            public void keyReleased(KeyEvent e) {
                if ((e.stateMask == 0) && (e.character == SWT.CR)) {
                    doSearch();
                }
            }
        });
        // service
        Label serviceLabel = toolkit.createLabel(searchLineComposite, Messages.RoutingEngineV2BrowserMainPage_Service, SWT.NULL);
        serviceLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        // service
        serviceCombo = new Combo(searchLineComposite, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.MULTI);
        serviceCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        serviceCombo.addKeyListener(new KeyAdapter() {

            @Override
            public void keyReleased(KeyEvent e) {
                if ((e.stateMask == 0) && (e.character == SWT.CR)) {
                    doSearch();
                }
            }
        });
        serviceCombo.add(BLANK);
        // WSServicesListItem[] servicesList = Util.getPort(getXObject()).getServicesList(new
        // WSGetServicesList("en")).getItem();
        // $NON-NLS-1$
        List<WSServicesListItem> servicesList = getMDMService().getServicesList(new WSGetServicesList("en")).getItem();
        if ((servicesList != null) && (servicesList.size() > 0)) {
            String[] services = new String[servicesList.size()];
            for (int i = 0; i < servicesList.size(); i++) {
                // $NON-NLS-1$
                services[i] = servicesList.get(i).getJndiName().replaceFirst("amalto/local/service/", BLANK);
            }
            Arrays.sort(services);
            for (String service : services) {
                serviceCombo.add(service);
            }
        }
        serviceCombo.select(0);
        // any Field
        Label anyFieldLabel = toolkit.createLabel(searchLineComposite, Messages.RoutingEngineV2BrowserMainPage_AnyField, SWT.NULL);
        anyFieldLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
        // anyField
        anyFieldText = toolkit.createText(searchLineComposite, BLANK, SWT.BORDER);
        anyFieldText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
        anyFieldText.addKeyListener(new KeyAdapter() {

            @Override
            public void keyReleased(KeyEvent e) {
                if ((e.stateMask == 0) && (e.character == SWT.CR)) {
                    doSearch();
                }
            }
        });
        // pageToolBar
        pageToolBar = new PageingToolBar(composite);
        pageToolBar.getComposite().setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 9, 1));
        pageToolBar.getComposite().setVisible(false);
        pageToolBar.setPageingListener(this);
        final Table table = createTable(composite);
        resultsViewer = new TableViewer(table);
        resultsViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        // ((GridData) resultsViewer.getControl().getLayoutData()).heightHint = 500;
        resultsViewer.setContentProvider(new ArrayContentProvider());
        resultsViewer.setLabelProvider(new ClusterTableLabelProvider());
        resultsViewer.addDoubleClickListener(new IDoubleClickListener() {

            public void doubleClick(DoubleClickEvent event) {
                resultsViewer.setSelection(event.getSelection());
                try {
                    new EditItemAction(RoutingEngineV2BrowserMainPage.this.getSite().getShell(), resultsViewer).run();
                } catch (Exception e) {
                    MessageDialog.openError(RoutingEngineV2BrowserMainPage.this.getSite().getShell(), Messages._Error, Messages.bind(Messages.RoutingEngineV2BrowserMainPage_ErrorMsg, e.getClass().getName(), e.getLocalizedMessage()));
                }
            }
        });
        hookContextMenu();
        // nothing will show on the form if not called
        managedForm.reflow(true);
        // adapt body add mouse/focus listener for child
        WidgetFactory factory = WidgetFactory.getWidgetFactory();
        factory.adapt(managedForm.getForm().getBody());
        updateButtons();
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }
}
Also used : IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) ILabelProviderListener(org.eclipse.jface.viewers.ILabelProviderListener) IXObjectModelListener(com.amalto.workbench.models.IXObjectModelListener) IMenuListener(org.eclipse.jface.action.IMenuListener) SelectionListener(org.eclipse.swt.events.SelectionListener) Listener(org.eclipse.swt.widgets.Listener) IPagingListener(com.amalto.workbench.widgets.IPagingListener) FormToolkit(org.eclipse.ui.forms.widgets.FormToolkit) PageingToolBar(com.amalto.workbench.widgets.PageingToolBar) KeyAdapter(org.eclipse.swt.events.KeyAdapter) Label(org.eclipse.swt.widgets.Label) Combo(org.eclipse.swt.widgets.Combo) KeyEvent(org.eclipse.swt.events.KeyEvent) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) SelectionEvent(org.eclipse.swt.events.SelectionEvent) WSGetServicesList(com.amalto.workbench.webservices.WSGetServicesList) Table(org.eclipse.swt.widgets.Table) Composite(org.eclipse.swt.widgets.Composite) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) EditItemAction(com.amalto.workbench.editors.actions.EditItemAction) XtentisException(com.amalto.workbench.utils.XtentisException) ParseException(java.text.ParseException) WSServicesListItem(com.amalto.workbench.webservices.WSServicesListItem) WidgetFactory(com.amalto.workbench.widgets.WidgetFactory) GridData(org.eclipse.swt.layout.GridData) ArrayContentProvider(org.eclipse.jface.viewers.ArrayContentProvider) KeyEvent(org.eclipse.swt.events.KeyEvent) Event(org.eclipse.swt.widgets.Event) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TableViewer(org.eclipse.jface.viewers.TableViewer) CalendarSelectWidget(com.amalto.workbench.widgets.CalendarSelectWidget)

Example 3 with WSServicesListItem

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

the class RoutingRuleMainPage method initServiceNameCombo.

/**
 * DOC hbhong Comment method "initServiceNameCombo".
 *
 * @throws XtentisException
 */
protected void initServiceNameCombo() throws XtentisException {
    // $NON-NLS-1$
    WSServicesList list = Util.getMDMService(getXObject()).getServicesList(new WSGetServicesList(""));
    List<WSServicesListItem> items = list.getItem();
    if (items != null) {
        String[] sortedList = new String[items.size()];
        for (int i = 0; i < items.size(); i++) {
            sortedList[i] = items.get(i).getJndiName();
        }
        Arrays.sort(sortedList);
        for (String element : sortedList) {
            serviceNameCombo.add(element);
        }
    // serviceNameCombo.add("");
    }
}
Also used : WSServicesListItem(com.amalto.workbench.webservices.WSServicesListItem) WSServicesList(com.amalto.workbench.webservices.WSServicesList) WSString(com.amalto.workbench.webservices.WSString) WSGetServicesList(com.amalto.workbench.webservices.WSGetServicesList) Point(org.eclipse.swt.graphics.Point)

Aggregations

WSGetServicesList (com.amalto.workbench.webservices.WSGetServicesList)3 WSServicesListItem (com.amalto.workbench.webservices.WSServicesListItem)3 WSServicesList (com.amalto.workbench.webservices.WSServicesList)2 WSString (com.amalto.workbench.webservices.WSString)2 EditItemAction (com.amalto.workbench.editors.actions.EditItemAction)1 IXObjectModelListener (com.amalto.workbench.models.IXObjectModelListener)1 XtentisException (com.amalto.workbench.utils.XtentisException)1 WSServiceGetDocument (com.amalto.workbench.webservices.WSServiceGetDocument)1 CalendarSelectWidget (com.amalto.workbench.widgets.CalendarSelectWidget)1 IPagingListener (com.amalto.workbench.widgets.IPagingListener)1 PageingToolBar (com.amalto.workbench.widgets.PageingToolBar)1 WidgetFactory (com.amalto.workbench.widgets.WidgetFactory)1 IOException (java.io.IOException)1 ParseException (java.text.ParseException)1 WebServiceException (javax.xml.ws.WebServiceException)1 DocumentException (org.dom4j.DocumentException)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)1 DoubleClickEvent (org.eclipse.jface.viewers.DoubleClickEvent)1 IDoubleClickListener (org.eclipse.jface.viewers.IDoubleClickListener)1