Search in sources :

Example 1 with DeployStatus

use of org.talend.mdm.repository.core.service.DeployService.DeployStatus in project tmdm-studio-se by Talend.

the class DeployStatusDialog method getType.

private ERepositoryObjectType getType(IStatus status) {
    IStatus queryStatus = status;
    if (status.isMultiStatus()) {
        IStatus[] childrenStatus = status.getChildren();
        if (childrenStatus != null && childrenStatus.length > 0) {
            queryStatus = childrenStatus[0];
        }
    }
    if (queryStatus != null && queryStatus instanceof DeployStatus) {
        ICommand command = ((DeployStatus) queryStatus).getCommand();
        IRepositoryViewObject viewObject = null;
        if (command != null) {
            if (command instanceof BatchDeployJobCommand) {
                return ERepositoryObjectType.PROCESS;
            } else {
                viewObject = command.getViewObject();
            }
        }
        if (viewObject == null) {
            return null;
        }
        return viewObject.getRepositoryObjectType();
    }
    return null;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) ICommand(org.talend.mdm.repository.core.command.ICommand) BatchDeployJobCommand(org.talend.mdm.repository.core.command.deploy.job.BatchDeployJobCommand) DeployStatus(org.talend.mdm.repository.core.service.DeployService.DeployStatus) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Example 2 with DeployStatus

use of org.talend.mdm.repository.core.service.DeployService.DeployStatus in project tmdm-studio-se by Talend.

the class UpdateLastServerService method updateLastServerDefInfo.

public void updateLastServerDefInfo(Object serverDef, IRepositoryViewObject ViewObject) {
    if (serverDef == null || ViewObject == null || !(serverDef instanceof MDMServerDef)) {
        return;
    }
    CommandManager cmdManager = CommandManager.getInstance();
    DeployService deployService = DeployService.getInstance();
    ICommand deployCmd = cmdManager.getNewCommand(ICommand.CMD_MODIFY);
    deployCmd.init(ViewObject);
    // $NON-NLS-1$ //$NON-NLS-2$
    MultiStatus mStatus = new MultiStatus("PLUGIN_ID", Status.OK, "", null);
    // $NON-NLS-1$
    DeployStatus deployStatus = DeployStatus.getOKStatus(deployCmd, "");
    mStatus.add(deployStatus);
    cmdManager.removeCommandStack(deployCmd, ICommand.PHASE_DEPLOY);
    deployService.pushRestoreCommand(cmdManager, deployCmd, (MDMServerDef) serverDef);
    deployService.updateLastServer(mStatus, new NullProgressMonitor());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) CommandManager(org.talend.mdm.repository.core.command.CommandManager) ICommand(org.talend.mdm.repository.core.command.ICommand) DeployStatus(org.talend.mdm.repository.core.service.DeployService.DeployStatus) MultiStatus(org.eclipse.core.runtime.MultiStatus) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)

Example 3 with DeployStatus

use of org.talend.mdm.repository.core.service.DeployService.DeployStatus in project tmdm-studio-se by Talend.

the class AbstractDeployCommand method buildErrorStatus.

private IStatus buildErrorStatus(String bindMsg, String typeLabel, String objectName, Exception e) {
    String msg = e.getMessage();
    String[] exceptionMsgs = UserExceptionStackFilter.filterExceptionMsg(msg);
    IStatus status = null;
    if (exceptionMsgs.length == 0) {
        String errorMsg = msg != null && !msg.trim().isEmpty() ? msg : Messages.bind(Messages.Deploy_fail_text, typeLabel, objectName);
        status = DeployStatus.getErrorStatus(this, errorMsg, null);
    } else if (exceptionMsgs.length == 1) {
        status = DeployStatus.getErrorStatus(this, Messages.bind(bindMsg, typeLabel, objectName, exceptionMsgs[0]), e);
    } else {
        status = new MultiStatus(RepositoryPlugin.PLUGIN_ID, Status.ERROR, exceptionMsgs[0], null);
        for (int i = 1; i < exceptionMsgs.length; i++) {
            DeployStatus errorStatus = DeployStatus.getErrorStatus(this, exceptionMsgs[i]);
            ((MultiStatus) status).add(errorStatus);
        }
    }
    return status;
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) DeployStatus(org.talend.mdm.repository.core.service.DeployService.DeployStatus) MultiStatus(org.eclipse.core.runtime.MultiStatus)

Aggregations

DeployStatus (org.talend.mdm.repository.core.service.DeployService.DeployStatus)3 IStatus (org.eclipse.core.runtime.IStatus)2 MultiStatus (org.eclipse.core.runtime.MultiStatus)2 ICommand (org.talend.mdm.repository.core.command.ICommand)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 CommandManager (org.talend.mdm.repository.core.command.CommandManager)1 BatchDeployJobCommand (org.talend.mdm.repository.core.command.deploy.job.BatchDeployJobCommand)1 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)1