use of org.talend.designer.xmlmap.ui.expressionutil.TableEntryLocation in project tdi-studio-se by Talend.
the class XmlMapUtil method updateTargetExpression.
public static void updateTargetExpression(AbstractNode renamedNode, String oldExpression, String newExpression, XmlMapExpressionManager expressionManager) {
TableEntryLocation previousLocation = expressionManager.parseTableEntryLocation(oldExpression).get(0);
TableEntryLocation newLocation = expressionManager.parseTableEntryLocation(newExpression).get(0);
List<INodeConnection> connections = new ArrayList<INodeConnection>();
connections.addAll(renamedNode.getOutgoingConnections());
if (renamedNode instanceof TreeNode) {
connections.addAll(((TreeNode) renamedNode).getLookupOutgoingConnections());
}
for (INodeConnection connection : connections) {
AbstractNode target = connection.getTarget();
List<TableEntryLocation> targetLocaitons = expressionManager.parseTableEntryLocation(target.getExpression());
for (TableEntryLocation current : targetLocaitons) {
if (current.equals(previousLocation)) {
String replaced = expressionManager.replaceExpression(target.getExpression(), current, newLocation);
target.setExpression(replaced);
}
}
}
for (FilterConnection connection : renamedNode.getFilterOutGoingConnections()) {
AbstractInOutTree target = connection.getTarget();
List<TableEntryLocation> targetLocaitons = expressionManager.parseTableEntryLocation(target.getExpressionFilter());
for (TableEntryLocation current : targetLocaitons) {
if (current.equals(previousLocation)) {
String replaced = expressionManager.replaceExpression(target.getExpressionFilter(), current, newLocation);
target.setExpressionFilter(replaced);
}
}
}
}
Aggregations