Search in sources :

Example 6 with ICommand

use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.

the class DeployService method updateLastServer.

public void updateLastServer(IStatus status, IProgressMonitor monitor) {
    CommandManager manager = CommandManager.getInstance();
    Map<String, List<ICommand>> commandMap = manager.getAllCommandsByPhase(ICommand.PHASE_AFTER_DEPLOY);
    Set<String> ids = getValidUpdateIds(status);
    for (String id : commandMap.keySet()) {
        boolean canRun = false;
        if (ids == null) {
            canRun = true;
        } else {
            canRun = ids.contains(id);
        }
        if (canRun) {
            List<ICommand> cmds = commandMap.get(id);
            for (ICommand cmd : cmds) {
                cmd.execute(null, monitor);
            }
            manager.removeCommandStack(id, ICommand.PHASE_AFTER_DEPLOY);
        }
    }
}
Also used : CommandManager(org.talend.mdm.repository.core.command.CommandManager) ICommand(org.talend.mdm.repository.core.command.ICommand) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List)

Example 7 with ICommand

use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.

the class BatchDeployJobCommand method runDeleteCmds.

private void runDeleteCmds(Object params, IProgressMonitor monitor, MultiStatus ms) {
    for (ICommand cmd : subDeleteCmds) {
        if (cmd instanceof AbstractDeployCommand) {
            AbstractDeployCommand removeCmd = (AbstractDeployCommand) cmd;
            IStatus status = removeCmd.execute(params, monitor);
            ms.add(status);
        }
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) ICommand(org.talend.mdm.repository.core.command.ICommand) AbstractDeployCommand(org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)

Example 8 with ICommand

use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.

the class MDMServerDecorator method decorateModifiedObject.

private void decorateModifiedObject(IRepositoryViewObject viewObj, IDecoration decoration) {
    CommandStack stack = CommandManager.getInstance().findCommandStack(viewObj.getId());
    if (stack != null) {
        ICommand command = stack.getValidDeployCommand();
        switch(command.getCommandType()) {
            case ICommand.CMD_ADD:
                decoration.addOverlay(IMG_NEW, IDecoration.BOTTOM_RIGHT);
                return;
            case ICommand.CMD_DELETE:
                decoration.addOverlay(IMG_DELETE, IDecoration.BOTTOM_RIGHT);
                return;
            case ICommand.CMD_MODIFY:
            case ICommand.CMD_RENAME:
                // $NON-NLS-1$
                decoration.addPrefix("> ");
                decoration.addOverlay(IMG_MODIFY, IDecoration.BOTTOM_RIGHT);
                return;
        }
    }
}
Also used : CommandStack(org.talend.mdm.repository.core.command.CommandStack) ICommand(org.talend.mdm.repository.core.command.ICommand)

Example 9 with ICommand

use of org.talend.mdm.repository.core.command.ICommand 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 10 with ICommand

use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.

the class ViewMainPage2 method isReferedViewObjModified.

private boolean isReferedViewObjModified() {
    XObjectEditorInput2 editorInput2 = (XObjectEditorInput2) getEditor().getEditorInput();
    IRepositoryViewObject viewObj = editorInput2.getViewObject();
    CommandStack stack = CommandManager.getInstance().findCommandStack(viewObj.getId());
    if (stack != null) {
        ICommand command = stack.getValidDeployCommand();
        if (command.getCommandType() == ICommand.CMD_MODIFY) {
            return true;
        }
    }
    return false;
}
Also used : CommandStack(org.talend.mdm.repository.core.command.CommandStack) ICommand(org.talend.mdm.repository.core.command.ICommand) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Aggregations

ICommand (org.talend.mdm.repository.core.command.ICommand)18 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)8 CommandManager (org.talend.mdm.repository.core.command.CommandManager)8 IStatus (org.eclipse.core.runtime.IStatus)6 CommandStack (org.talend.mdm.repository.core.command.CommandStack)6 AbstractDeployCommand (org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand)6 MultiStatus (org.eclipse.core.runtime.MultiStatus)5 MDMServerDef (org.talend.mdm.repository.model.mdmmetadata.MDMServerDef)4 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)3 BatchDeployJobCommand (org.talend.mdm.repository.core.command.deploy.job.BatchDeployJobCommand)3 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 DeployStatus (org.talend.mdm.repository.core.service.DeployService.DeployStatus)2 SelectServerDefDialog (org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 HashSet (java.util.HashSet)1 List (java.util.List)1 IEditorInput (org.eclipse.ui.IEditorInput)1 IProgressService (org.eclipse.ui.progress.IProgressService)1