Search in sources :

Example 66 with MDMServerDef

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

the class ServerSorter method compare.

@Override
public int compare(Viewer viewer, Object e1, Object e2) {
    MDMServerDefItem mdmItem1 = getMDMItem((IRepositoryViewObject) e1);
    MDMServerDefItem mdmItem2 = getMDMItem((IRepositoryViewObject) e2);
    if (mdmItem1 != null && mdmItem2 != null) {
        MDMServerDef serverDef1 = mdmItem1.getServerDef();
        MDMServerDef serverDef2 = mdmItem2.getServerDef();
        boolean enabled1 = serverDef1.isEnabled();
        boolean enabled2 = serverDef2.isEnabled();
        if (enabled1 == enabled2) {
            return serverDef1.getName().toLowerCase().compareTo(serverDef2.getName().toLowerCase());
        } else {
            return enabled1 ? -1 : 1;
        }
    }
    return 0;
}
Also used : MDMServerDefItem(org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Aggregations

MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)66 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)36 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)15 Item (org.talend.core.model.properties.Item)11 MDMServerDefItem (org.talend.mdm.repository.model.mdmproperties.MDMServerDefItem)10 MDMServerObjectItem (org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem)10 IStatus (org.eclipse.core.runtime.IStatus)8 MDMServerObject (org.talend.mdm.repository.model.mdmserverobject.MDMServerObject)8 PersistenceException (org.talend.commons.exception.PersistenceException)7 AbstractDeployCommand (org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)7 TMDMService (com.amalto.workbench.webservices.TMDMService)6 CommandManager (org.talend.mdm.repository.core.command.CommandManager)6 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)6 TreeObject (com.amalto.workbench.models.TreeObject)5 XtentisException (com.amalto.workbench.utils.XtentisException)5 ArrayList (java.util.ArrayList)5 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)5 Test (org.junit.Test)5 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)5 LinkedList (java.util.LinkedList)4