use of org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand 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.deploy.AbstractDeployCommand in project tmdm-studio-se by Talend.
the class DeployService method removeInvalidCommands.
public void removeInvalidCommands(List<IRepositoryViewObject> invalidObjects, List<AbstractDeployCommand> selectededCommands) {
if (invalidObjects == null || invalidObjects.isEmpty()) {
return;
}
for (Iterator<AbstractDeployCommand> il = selectededCommands.iterator(); il.hasNext(); ) {
AbstractDeployCommand cmd = il.next();
IRepositoryViewObject viewObject = cmd.getViewObject();
if (viewObject != null && invalidObjects.contains(viewObject)) {
il.remove();
}
}
}
use of org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand 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.deploy.AbstractDeployCommand in project tmdm-studio-se by Talend.
the class DeployService method deployAnotherVersion.
public IStatus deployAnotherVersion(MDMServerDef serverDef, List<IRepositoryViewObject> viewObjs) {
CommandManager manager = CommandManager.getInstance();
List<AbstractDeployCommand> commands = manager.getDeployCommandsWithoutHistory(viewObjs);
try {
// insert impact dialog
Map<IRepositoryViewObject, ImpactOperation> analyzeModelImpact = ModelImpactAnalyseService.analyzeCommandImpact(serverDef, commands);
Map<IRepositoryViewObject, ICommandParameter> paramMap = null;
if (analyzeModelImpact != null) {
ModelImpactAnalyseService.shrinkDeployCommands(analyzeModelImpact, commands);
paramMap = ModelImpactAnalyseService.convertToParameters(analyzeModelImpact);
manager.attachParameterToCommand(commands, paramMap);
}
} catch (InterruptedException ex) {
return Status.CANCEL_STATUS;
}
return runCommands(commands, serverDef);
}
use of org.talend.mdm.repository.core.command.deploy.AbstractDeployCommand in project tmdm-studio-se by Talend.
the class CommandManager method getDeployCommands.
/**
* DOC hbhong Comment method "getDeployCommands".
*
* @param viewObjs
* @param defaultCmdType if none then assign -1
* @return
*/
public List<AbstractDeployCommand> getDeployCommands(List<IRepositoryViewObject> viewObjs, int defaultCmdType, Map<IRepositoryViewObject, ICommandParameter> paramMap) {
List<AbstractDeployCommand> cmds = new LinkedList<AbstractDeployCommand>();
for (IRepositoryViewObject viewObj : viewObjs) {
CommandStack stack = findCommandStack(viewObj.getId());
if (stack == null) {
stack = new CommandStack();
ICommand cmd = getNewCommand(viewObj, defaultCmdType);
cmd.init(viewObj);
stack.pushCommand(cmd);
}
ICommand validCommand = stack.getValidDeployCommand();
if (validCommand != null) {
if (validCommand instanceof AbstractDeployCommand) {
fillViewObjectToCommand(validCommand);
AbstractDeployCommand deployCommand = (AbstractDeployCommand) validCommand;
if (paramMap != null) {
ICommandParameter param = paramMap.get(viewObj);
deployCommand.setParameter(param);
}
cmds.add(deployCommand);
} else if (validCommand instanceof NOPCommand && defaultCmdType > 0) {
ICommand cmd = getNewCommand(defaultCmdType);
if (cmd instanceof AbstractDeployCommand) {
cmd.init(viewObj);
cmds.add((AbstractDeployCommand) cmd);
}
}
}
}
return cmds;
}
Aggregations