use of org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree in project tdi-studio-se by Talend.
the class DropContextAnalyzer method checkDropInputValid.
private boolean checkDropInputValid(Object target) {
if (objects.getType() == TransferdType.INPUT) {
for (Object obj : objects.getToTransfer()) {
TreeNodeEditPart part = (TreeNodeEditPart) obj;
AbstractInOutTree srouceTree = XmlMapUtil.getAbstractInOutTree((TreeNode) part.getModel());
AbstractInOutTree targetTree = null;
if (target instanceof InputXmlTree) {
targetTree = (InputXmlTree) target;
} else {
targetTree = XmlMapUtil.getAbstractInOutTree((TreeNode) target);
}
if (srouceTree == targetTree) {
return false;
}
if (srouceTree.eContainer() instanceof XmlMapData) {
XmlMapData mapdata = ((XmlMapData) srouceTree.eContainer());
int indexSource = mapdata.getInputTrees().indexOf(srouceTree);
int indexTarget = mapdata.getInputTrees().indexOf(targetTree);
if (indexTarget < indexSource) {
return false;
}
}
}
}
return true;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree in project tdi-studio-se by Talend.
the class XmlMapUtil method checkMultiLoopsStatus.
public static boolean checkMultiLoopsStatus(AbstractInOutTree tree) {
// set multiloops to true only if one doc schema have more then one loops , if a table have two doc schema but
// each one only have one loop,multiloops should be false
List<? extends TreeNode> children = new ArrayList<TreeNode>();
if (tree instanceof InputXmlTree) {
children = ((InputXmlTree) tree).getNodes();
} else if (tree instanceof OutputXmlTree) {
children = ((OutputXmlTree) tree).getNodes();
}
List<TreeNode> docChildren = new ArrayList<TreeNode>();
for (TreeNode child : children) {
if (DOCUMENT.equals(child.getType())) {
docChildren.add(child);
}
}
List<TreeNode> loopNodes = new ArrayList<TreeNode>();
for (TreeNode doc : docChildren) {
getChildLoops(loopNodes, doc.getChildren());
if (loopNodes.size() > 1) {
return true;
}
}
return false;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree in project tdi-studio-se by Talend.
the class ProblemsAnalyser method checkProblems.
public void checkProblems(AbstractInOutTree abstractTree) {
// clear problems for the tree before recheck it
if (treeAndProblems.get(abstractTree) != null) {
treeAndProblems.get(abstractTree).clear();
}
// check problems for InputLoopTable in output
final XmlMapData copyOfMapData = mapperManager.getExternalData();
// check problems for InputLoopTable in output
InputXmlTree mainInputTree = mapperManager.getMainInputTree();
if (abstractTree instanceof OutputXmlTree) {
checkInputLoopTablesProblem((OutputXmlTree) abstractTree, mainInputTree);
}
isMultipleDocType = false;
List<? extends TreeNode> nodes = null;
if (abstractTree instanceof InputXmlTree) {
nodes = ((InputXmlTree) abstractTree).getNodes();
} else if (abstractTree instanceof OutputXmlTree) {
nodes = ((OutputXmlTree) abstractTree).getNodes();
}
if (nodes != null) {
checkTreeNodesProblem(abstractTree, nodes);
}
if (treeAndProblems.get(abstractTree) == null || treeAndProblems.get(abstractTree).isEmpty()) {
treeAndProblems.remove(abstractTree);
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree in project tdi-studio-se by Talend.
the class XmlMapConnectionBuilder method rebuildLink.
private void rebuildLink(int inputTreeIndex, List<TreeNode> children, XmlMapData mapData) {
for (TreeNode treeNode : children) {
if (XmlMapUtil.isDragable(treeNode)) {
String expression = XmlMapUtil.convertToExpression(treeNode.getXpath());
XmlMapExpressionManager expressionManager = new XmlMapExpressionManager();
TableEntryLocation sourceLocation = expressionManager.parseTableEntryLocation(expression).get(0);
// LOOKUP ,FILTER
for (int i = inputTreeIndex; i < mapData.getInputTrees().size(); i++) {
InputXmlTree treeTarget = mapData.getInputTrees().get(i);
if (hasMaptchedLocation(expressionManager, sourceLocation, treeTarget, ExpressionType.EXPRESSION_FILTER)) {
createFilterConnection(treeNode, treeTarget, mapData);
}
checkTargetChildren(expressionManager, treeTarget.getNodes(), treeNode, sourceLocation, mapData);
}
// VAR
for (VarNode varNode : mapData.getVarTables().get(0).getNodes()) {
if (hasMaptchedLocation(expressionManager, sourceLocation, varNode, ExpressionType.EXPRESSION)) {
createConnection(treeNode, varNode, mapData);
}
}
// OUTPUT,FILTER
for (int i = 0; i < mapData.getOutputTrees().size(); i++) {
OutputXmlTree outputTree = mapData.getOutputTrees().get(i);
if (hasMaptchedLocation(expressionManager, sourceLocation, outputTree, ExpressionType.EXPRESSION_FILTER)) {
createFilterConnection(treeNode, outputTree, mapData);
}
checkTargetChildren(expressionManager, outputTree.getNodes(), treeNode, sourceLocation, mapData);
}
}
if (!treeNode.getChildren().isEmpty()) {
rebuildLink(inputTreeIndex, treeNode.getChildren(), mapData);
}
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree in project tdi-studio-se by Talend.
the class ProblemsAnalyser method checkNodeInputLookTableProblem.
private boolean checkNodeInputLookTableProblem(OutputTreeNode outputNode, InputXmlTree mainInputTree, boolean checkChildren) {
for (Connection connection : outputNode.getIncomingConnections()) {
if (connection.getSource() instanceof TreeNode) {
TreeNode source = (TreeNode) connection.getSource();
InputXmlTree abstractInOutTree = (InputXmlTree) XmlMapUtil.getAbstractInOutTree(source);
if (abstractInOutTree == mainInputTree) {
return true;
} else {
EList<LookupConnection> lookupIncomingConnections = source.getLookupIncomingConnections();
for (LookupConnection lookupConn : lookupIncomingConnections) {
TreeNode sourceNode = (TreeNode) lookupConn.getSource();
AbstractInOutTree abstractInOutTree2 = XmlMapUtil.getAbstractInOutTree(sourceNode);
if (abstractInOutTree2 == mainInputTree) {
return true;
}
}
}
if (checkChildren && !outputNode.getChildren().isEmpty()) {
for (TreeNode child : outputNode.getChildren()) {
if (checkNodeInputLookTableProblem((OutputTreeNode) child, mainInputTree, checkChildren)) {
return true;
}
}
}
}
}
return false;
}
Aggregations