Search in sources :

Example 11 with MDMServerDef

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

the class TransformerMainPage2 method getLastServerDef.

private MDMServerDef getLastServerDef() {
    XObjectEditorInput2 input = (XObjectEditorInput2) editor2.getEditorInput();
    Item item = input.getInputItem();
    MDMServerDef lastServerDef = RepositoryResourceUtil.getLastServerDef(item);
    return lastServerDef;
}
Also used : Item(org.talend.core.model.properties.Item) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 12 with MDMServerDef

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

the class RepositoryWebServiceAdapter method getMDMService.

public static TMDMService getMDMService(Shell shell, MDMServerDef lastserverDef) {
    if (lastserverDef == null) {
        MessageDialog.openWarning(null, Messages.Warning_text, Messages.RepositoryWebServiceAdapter_DeployFirst);
        return null;
    }
    SelectServerDefDialog dialog = new SelectServerDefDialog(shell);
    dialog.create();
    dialog.setSelectServer(lastserverDef);
    try {
        if (dialog.open() == IDialogConstants.OK_ID) {
            MDMServerDef serverDef = dialog.getSelectedServerDef();
            TMDMService port = RepositoryWebServiceAdapter.getMDMService(serverDef);
            return port;
        }
    } catch (XtentisException e) {
        log.error(e.getMessage(), e);
    }
    return null;
}
Also used : TMDMService(com.amalto.workbench.webservices.TMDMService) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 13 with MDMServerDef

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

the class OpenObjectAction method doSelectServer.

public boolean doSelectServer(Item item, IRepositoryViewEditorInput editorInput) {
    MDMServerObject serverObject = ((MDMServerObjectItem) item).getMDMServerObject();
    if (serverObject.getType() == TreeObject.DATA_CLUSTER) {
        // Data Cluster
        MDMServerDef lastServerDef = RepositoryResourceUtil.getLastServerDef(item);
        MDMServerDef serverDef = openServerDialog(lastServerDef);
        if (serverDef != null) {
            XObjectBrowserInput input = (XObjectBrowserInput) editorInput;
            TreeObject xobject = (TreeObject) input.getModel();
            if (xobject != null && xobject.getWsKey() != null) {
                TreeParent serverRoot = getServerRoot(serverDef);
                xobject.setWsKey(new WSDataClusterPK(xobject.getWsKey().toString()));
                xobject.setServerRoot(serverRoot);
                return true;
            }
        }
        return false;
    }
    return true;
}
Also used : WSDataClusterPK(com.amalto.workbench.webservices.WSDataClusterPK) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) TreeParent(com.amalto.workbench.models.TreeParent) XObjectBrowserInput(com.amalto.workbench.providers.XObjectBrowserInput) TreeObject(com.amalto.workbench.models.TreeObject) MDMServerObject(org.talend.mdm.repository.model.mdmserverobject.MDMServerObject) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 14 with MDMServerDef

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

the class OpenObjectAction method openServerDialog.

/**
 * return a decrypted server def
 *
 * @param serverObject
 * @return a decrypted server def
 */
public MDMServerDef openServerDialog(MDMServerDef serverObject) {
    SelectServerDefDialog dlg = new SelectServerDefDialog(getShell());
    dlg.create();
    dlg.setSelectServer(serverObject);
    if (dlg.open() == IDialogConstants.OK_ID) {
        MDMServerDef serverDef = dlg.getSelectedServerDef();
        return serverDef;
    }
    return null;
}
Also used : SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 15 with MDMServerDef

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

the class DeployService method autoDeploy.

public void autoDeploy(Shell shell, IRepositoryViewObject viewObj) {
    if (shell == null || viewObj == null) {
        throw new IllegalArgumentException();
    }
    MDMServerDef serverDef = RepositoryResourceUtil.getLastServerDef(viewObj);
    if (serverDef != null) {
        if (!serverDef.isEnabled()) {
            MessageDialog.openWarning(shell, null, Messages.DeployService_CanNotDeployToDisabledServer);
            return;
        }
        List<IRepositoryViewObject> viewObjs = getAssociatedObjects(viewObj);
        viewObjs.add(0, viewObj);
        IStatus status = deploy(serverDef, viewObjs, ICommand.CMD_MODIFY, false);
        if (!status.isOK()) {
            return;
        }
        updateAutoStatus(status);
        if (status.isMultiStatus()) {
            showDeployStatus(shell, status);
        }
    } else {
        boolean warnUser = PlatformUI.getPreferenceStore().getBoolean(PreferenceConstants.P_WARN_USER_AUTO_DEPLOY);
        if (warnUser) {
            MessageDialog.openWarning(shell, Messages.Warning_text, Messages.NeverDeploy_text);
        }
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) 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