use of org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable in project tdi-studio-se by Talend.
the class OutputXmlTreeEditPart method setModel.
/*
* (non-Javadoc)
*
* @see org.eclipse.gef.editparts.AbstractEditPart#setModel(java.lang.Object)
*/
@Override
public void setModel(Object model) {
super.setModel(model);
OutputXmlTree outputTree = (OutputXmlTree) getModel();
manager = new XmlMapTableManager(outputTree, this);
for (InputLoopNodesTable sourceLoopTable : outputTree.getInputLoopNodesTables()) {
addListenerForInputLoopNodeTable(sourceLoopTable);
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable in project tdi-studio-se by Talend.
the class OutputTreeNodeImpl method setInputLoopNodesTable.
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setInputLoopNodesTable(InputLoopNodesTable newInputLoopNodesTable) {
InputLoopNodesTable oldInputLoopNodesTable = inputLoopNodesTable;
inputLoopNodesTable = newInputLoopNodesTable;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, XmlmapPackage.OUTPUT_TREE_NODE__INPUT_LOOP_NODES_TABLE, oldInputLoopNodesTable, inputLoopNodesTable));
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable in project tdi-studio-se by Talend.
the class ProblemsAnalyser method checkInputLoopTablesProblem.
private void checkInputLoopTablesProblem(OutputXmlTree outputTree, InputXmlTree mainInputTree) {
if (mainInputTree == null) {
return;
}
if (mainInputTree.isMultiLoops()) {
if (!XmlMapUtil.hasDocument(outputTree)) {
if (outputTree.getInputLoopNodesTables().isEmpty() || outputTree.getInputLoopNodesTables().get(0).getInputloopnodes().isEmpty()) {
String message = outputTree.getName() + " have no source loop";
addProblem(outputTree, new Problem(null, message, ProblemStatus.ERROR));
}
} else {
List<TreeNode> loopNodes = new ArrayList<TreeNode>();
XmlMapUtil.getChildLoops(loopNodes, outputTree.getNodes());
if (!loopNodes.isEmpty()) {
for (TreeNode node : loopNodes) {
InputLoopNodesTable inutLoopTable = ((OutputTreeNode) node).getInputLoopNodesTable();
if (inutLoopTable == null || inutLoopTable.getInputloopnodes().isEmpty()) {
String message = node.getXpath() + " have no source loop";
addProblem(outputTree, new Problem(null, message, ProblemStatus.ERROR));
}
}
}
}
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable in project tdi-studio-se by Talend.
the class InputLoopTableUtil method addSourceLoopToInputLoopTable.
public static void addSourceLoopToInputLoopTable(TreeNode connectionSource, OutputTreeNode targetOutputNode, InputXmlTree mainInputTree) {
// create InputLoopTable nodes only when main table is multiloops
if (mainInputTree == null || !mainInputTree.isMultiLoops()) {
return;
}
InputLoopNodesTable inputLoopNodesTable = null;
AbstractInOutTree abstractTree = XmlMapUtil.getAbstractInOutTree(targetOutputNode);
List<InputLoopNodesTable> listInputLoopNodesTablesEntry = ((OutputXmlTree) abstractTree).getInputLoopNodesTables();
if (!XmlMapUtil.hasDocument(abstractTree)) {
if (listInputLoopNodesTablesEntry.size() == 0) {
inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
} else if (listInputLoopNodesTablesEntry != null && listInputLoopNodesTablesEntry.size() == 1) {
inputLoopNodesTable = listInputLoopNodesTablesEntry.get(0);
}
} else {
OutputTreeNode loopParentOutputTreeNode = (OutputTreeNode) XmlMapUtil.getLoopParentNode(targetOutputNode);
if (loopParentOutputTreeNode != null) {
inputLoopNodesTable = loopParentOutputTreeNode.getInputLoopNodesTable();
if (inputLoopNodesTable == null) {
inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
loopParentOutputTreeNode.setInputLoopNodesTable(inputLoopNodesTable);
listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
}
}
}
if (inputLoopNodesTable == null) {
return;
}
List<TreeNode> soruceLoops = new ArrayList<TreeNode>();
getSourceLoopsFromConnectionSource(connectionSource, soruceLoops, mainInputTree);
for (TreeNode sourceLoop : soruceLoops) {
if (!inputLoopNodesTable.getInputloopnodes().contains(sourceLoop)) {
inputLoopNodesTable.getInputloopnodes().add(sourceLoop);
}
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.InputLoopNodesTable in project tdi-studio-se by Talend.
the class InputLoopTableUtil method removeSourceLoopFromInputLoopTable.
public static void removeSourceLoopFromInputLoopTable(List removedConnections, OutputTreeNode outputNode, InputXmlTree mainInputTree) {
if (mainInputTree == null || !mainInputTree.isMultiLoops()) {
return;
}
List<TreeNode> neededSource = new ArrayList<TreeNode>();
InputLoopNodesTable inputLoopNodesTable = null;
AbstractInOutTree abstractTree = XmlMapUtil.getAbstractInOutTree(outputNode);
List<InputLoopNodesTable> listInputLoopNodesTablesEntry = ((OutputXmlTree) abstractTree).getInputLoopNodesTables();
if (!XmlMapUtil.hasDocument(abstractTree)) {
if (listInputLoopNodesTablesEntry.size() == 0) {
inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
} else if (listInputLoopNodesTablesEntry != null && listInputLoopNodesTablesEntry.size() == 1) {
inputLoopNodesTable = listInputLoopNodesTablesEntry.get(0);
}
OutputXmlTree outputTree = (OutputXmlTree) abstractTree;
getSourceLoop(neededSource, outputTree.getNodes(), mainInputTree);
} else {
OutputTreeNode loopParentOutputTreeNode = (OutputTreeNode) XmlMapUtil.getLoopParentNode(outputNode);
if (loopParentOutputTreeNode != null) {
inputLoopNodesTable = loopParentOutputTreeNode.getInputLoopNodesTable();
if (inputLoopNodesTable == null) {
inputLoopNodesTable = XmlmapFactory.eINSTANCE.createInputLoopNodesTable();
loopParentOutputTreeNode.setInputLoopNodesTable(inputLoopNodesTable);
listInputLoopNodesTablesEntry.add(inputLoopNodesTable);
}
List<OutputTreeNode> nodes = new ArrayList<OutputTreeNode>();
nodes.add(loopParentOutputTreeNode);
getSourceLoop(neededSource, nodes, mainInputTree);
}
}
if (inputLoopNodesTable == null) {
return;
}
List<TreeNode> sourceLoopsToRemove = new ArrayList<TreeNode>();
for (Object object : removedConnections) {
if (object instanceof Connection) {
Connection connection = (Connection) object;
if (connection.getSource() instanceof TreeNode) {
getSourceLoopsFromConnectionSource((TreeNode) connection.getSource(), sourceLoopsToRemove, mainInputTree);
}
}
}
for (TreeNode sourceToRemove : sourceLoopsToRemove) {
if (!neededSource.contains(sourceToRemove)) {
inputLoopNodesTable.getInputloopnodes().remove(sourceToRemove);
}
}
}
Aggregations