use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.
the class RestoreAction method executeRestoreCommand.
protected void executeRestoreCommand(IRepositoryViewObject viewObj) {
CommandManager manager = CommandManager.getInstance();
String id = viewObj.getId();
CommandStack stack = manager.findCommandStack(id);
if (stack != null) {
List<ICommand> deployCommands = stack.getCommands(ICommand.PHASE_DEPLOY);
if (deployCommands.size() > 0) {
manager.pushCommand(ICommand.CMD_RESTORE, viewObj);
}
IProgressMonitor monitor = new NullProgressMonitor();
List<ICommand> commands = stack.getCommands(ICommand.PHASE_RESTORE);
for (ICommand cmd : commands) {
cmd.updateViewObject(viewObj);
cmd.execute(null, monitor);
}
manager.removeCommandStack(id, ICommand.PHASE_RESTORE);
}
}
use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.
the class WaitToDeployDialog method needShowObject.
private boolean needShowObject(IRepositoryViewObject viewObj) {
String id = viewObj.getId();
CommandStack commandStack = CommandManager.getInstance().findCommandStack(id);
if (commandStack != null) {
ICommand validCommand = commandStack.getValidDeployCommand();
if (validCommand instanceof AbstractDeployCommand) {
if (validCommand.getCommandType() == ICommand.CMD_DELETE) {
return RepositoryResourceUtil.getLastServerDef(viewObj) != null;
}
return true;
}
}
return false;
}
use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.
the class DeployService method updateServerConsistencyStatus.
public void updateServerConsistencyStatus(MDMServerDef serverDef, IStatus mainStatus) throws XtentisException, WebServiceException {
if (!UIUtil.isWorkInUI()) {
return;
}
if (mainStatus.isMultiStatus()) {
Set<IRepositoryViewObject> viewObjs = new HashSet<IRepositoryViewObject>();
for (IStatus childStatus : mainStatus.getChildren()) {
DeployStatus deployStatus = null;
if (childStatus instanceof DeployStatus) {
deployStatus = (DeployStatus) childStatus;
if (deployStatus.isOK()) {
AbstractDeployCommand command = (AbstractDeployCommand) deployStatus.getCommand();
if (command instanceof BatchDeployJobCommand) {
for (ICommand subCmd : ((BatchDeployJobCommand) command).getSubCmds()) {
if (subCmd instanceof AbstractDeployCommand) {
IRepositoryViewObject viewObj = ((AbstractDeployCommand) subCmd).getViewObject();
if (viewObj != null) {
viewObjs.add(viewObj);
}
}
}
} else {
if (command != null) {
IRepositoryViewObject viewObj = command.getViewObject();
if (viewObj != null) {
viewObjs.add(viewObj);
}
}
}
}
} else if (childStatus instanceof MultiStatus) {
updateServerConsistencyStatus(serverDef, childStatus);
}
}
updateServerConsistencyStatus(serverDef, viewObjs);
}
}
use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.
the class DeployService method updateAutoStatus.
protected void updateAutoStatus(IStatus status) {
if (status.isMultiStatus()) {
for (IStatus childStatus : status.getChildren()) {
DeployStatus deployStatus = null;
if (childStatus instanceof DeployStatus) {
deployStatus = (DeployStatus) childStatus;
} else if (childStatus instanceof MultiStatus) {
deployStatus = (DeployStatus) ((MultiStatus) childStatus).getChildren()[0];
}
ICommand command = deployStatus.getCommand();
CommandManager manager = CommandManager.getInstance();
manager.removeCommandStack(command, ICommand.PHASE_DEPLOY);
}
}
}
use of org.talend.mdm.repository.core.command.ICommand in project tmdm-studio-se by Talend.
the class DeployService method generateConsistencyCancelDeployStatus.
public void generateConsistencyCancelDeployStatus(IStatus mainStatus, IRepositoryViewObject... cancelViewObjs) {
if (cancelViewObjs != null) {
for (IRepositoryViewObject viewObj : cancelViewObjs) {
ICommand cancelCmd = CommandManager.getInstance().getNewCommand(ICommand.CMD_NOP);
cancelCmd.updateViewObject(viewObj);
DeployStatus cancelStatus = DeployStatus.getInfoStatus(cancelCmd, Messages.DeployService_conflictCancelStatus + viewObj.getLabel());
((MultiStatus) mainStatus).add(cancelStatus);
}
}
}
Aggregations