Search in sources :

Example 6 with MDMServerDefItem

use of org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem in project tmdm-studio-se by Talend.

the class ServerDefService method getAllServerDefs.

public static List<MDMServerDef> getAllServerDefs(boolean includeDisabledServer) {
    List<IRepositoryViewObject> viewObjects = getAllServerDefViewObjects(includeDisabledServer);
    if (viewObjects != null) {
        List<MDMServerDef> serverDefs = new ArrayList<MDMServerDef>(viewObjects.size());
        for (IRepositoryViewObject viewObj : viewObjects) {
            Item item = viewObj.getProperty().getItem();
            MDMServerDef serverDef = ((MDMServerDefItem) item).getServerDef();
            if (serverDef != null && (includeDisabledServer || serverDef.isEnabled())) {
                serverDefs.add(serverDef.getDecryptedServerDef());
            }
        }
        return serverDefs;
    }
    return null;
}
Also used : MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) Item(org.talend.core.model.properties.Item) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ArrayList(java.util.ArrayList) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 7 with MDMServerDefItem

use of org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem in project tmdm-studio-se by Talend.

the class ShowServerConsoleAction method run.

@Override
public void run() {
    IRepositoryViewObject viewObject = getSelectedViewObject();
    if (viewObject != null) {
        MDMServerDefItem serverDefItem = getMDMItem(viewObject);
        MDMServerDef selectedServerDef = serverDefItem.getServerDef();
        if (selectedServerDef != null) {
            showMDMServerConsole(selectedServerDef);
        }
    }
}
Also used : IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 8 with MDMServerDefItem

use of org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem in project tmdm-studio-se by Talend.

the class SelectServerDefDialog method createDialogArea.

/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    setTitle(Messages.SelectServerDefDialog_selectServerLocation);
    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new FillLayout(SWT.HORIZONTAL));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    treeViewer = new TreeViewer(container, SWT.BORDER);
    treeViewer.setSorter(new ServerSorter());
    treeViewer.setContentProvider(new TreeContentProvider());
    treeViewer.setLabelProvider(new ViewerLabelProvider());
    // 
    treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            IRepositoryViewObject viewObject = getCurSelectedViewObject();
            if (viewObject == null)
                return;
            MDMServerDefItem item = (MDMServerDefItem) viewObject.getProperty().getItem();
            serverDef = item.getServerDef();
            okBun.setEnabled(serverDef != null);
        }
    });
    treeViewer.addDoubleClickListener(new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            okPressed();
        }
    });
    // 
    initServerDefList();
    return area;
}
Also used : ViewerLabelProvider(org.talend.mdm.workbench.serverexplorer.ui.providers.ViewerLabelProvider) Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) ISelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) SelectionChangedEvent(org.eclipse.jface.viewers.SelectionChangedEvent) DoubleClickEvent(org.eclipse.jface.viewers.DoubleClickEvent) FillLayout(org.eclipse.swt.layout.FillLayout) ServerSorter(org.talend.mdm.workbench.serverexplorer.ui.providers.ServerSorter) TreeContentProvider(org.talend.mdm.workbench.serverexplorer.ui.providers.TreeContentProvider) IDoubleClickListener(org.eclipse.jface.viewers.IDoubleClickListener) GridData(org.eclipse.swt.layout.GridData) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem)

Example 9 with MDMServerDefItem

use of org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem in project tmdm-studio-se by Talend.

the class ServerExplorer method editServerDef.

private void editServerDef() {
    IRepositoryViewObject viewObject = getCurSelectedViewObject();
    if (viewObject != null) {
        MDMServerDefItem mdmItem = getMDMItem(viewObject);
        if (mdmItem != null) {
            MDMServerDef serverDef = mdmItem.getServerDef();
            ServerDefDialog dialog = new ServerDefDialog(getViewSite().getShell(), serverDef);
            if (dialog.open() == IDialogConstants.OK_ID) {
                String tempPasswd = serverDef.getTempPasswd();
                ServerDefService.updateTempPassword(viewObject.getId(), tempPasswd);
                boolean result = ServerDefService.saveServeDef(mdmItem);
                if (result) {
                    refreshServerDefs();
                }
            }
        }
    }
}
Also used : ServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.ServerDefDialog) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 10 with MDMServerDefItem

use of org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem in project tmdm-studio-se by Talend.

the class ServerExplorer method editServerDef.

private void editServerDef(IRepositoryViewObject viewObject) {
    if (viewObject != null) {
        MDMServerDefItem mdmItem = getMDMItem(viewObject);
        if (mdmItem != null) {
            MDMServerDef serverDef = mdmItem.getServerDef();
            ServerDefDialog dialog = new ServerDefDialog(getViewSite().getShell(), serverDef);
            if (dialog.open() == IDialogConstants.OK_ID) {
                String tempPasswd = serverDef.getTempPasswd();
                ServerDefService.updateTempPassword(viewObject.getId(), tempPasswd);
                boolean result = ServerDefService.saveServeDef(mdmItem);
                if (result) {
                    refreshServerDefs();
                }
            }
        }
    }
}
Also used : ServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.ServerDefDialog) MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Aggregations

MDMServerDefItem (org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem)15 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)10 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)9 ArrayList (java.util.ArrayList)2 Resource (org.eclipse.emf.ecore.resource.Resource)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 FillLayout (org.eclipse.swt.layout.FillLayout)2 Composite (org.eclipse.swt.widgets.Composite)2 PersistenceException (org.talend.commons.exception.PersistenceException)2 Item (org.talend.core.model.properties.Item)2 ServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.ServerDefDialog)2 ServerSorter (org.talend.mdm.workbench.serverexplorer.ui.providers.ServerSorter)2 TreeContentProvider (org.talend.mdm.workbench.serverexplorer.ui.providers.TreeContentProvider)2 ViewerLabelProvider (org.talend.mdm.workbench.serverexplorer.ui.providers.ViewerLabelProvider)2 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)2 List (java.util.List)1 Path (org.eclipse.core.runtime.Path)1 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 Separator (org.eclipse.jface.action.Separator)1