use of org.talend.mdm.repository.core.command.impl.NOPCommand 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