use of org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData in project tdi-studio-se by Talend.
the class XmlMapFiguresManager method getInputTables.
/*
* (non-Javadoc)
*
* @see org.talend.designer.newabstractmap.figures.manager.FiguresManager#getInputTables()
*/
@Override
protected List<MapperTable> getInputTables() {
List<MapperTable> inputTables = new ArrayList<MapperTable>();
XmlMapData mapData = (XmlMapData) getRootEditPart().getModel();
inputTables.addAll(mapData.getInputTrees());
return inputTables;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData in project tdi-studio-se by Talend.
the class VarToolBarFigure method removeVar.
@Override
protected void removeVar() {
CommandStack commandStack = getTableManager().getGraphicalViewer().getEditDomain().getCommandStack();
commandStack.execute(new Command() {
@Override
public void execute() {
List selectedEditParts = getTableManager().getGraphicalViewer().getSelectedEditParts();
final List<VarNode> toRemove = new ArrayList<VarNode>();
int minIndex = parentTable.getNodes().size() - 1;
for (Object obj : selectedEditParts) {
if (obj instanceof VarNodeEditPart) {
VarNode model = (VarNode) ((VarNodeEditPart) obj).getModel();
toRemove.add(model);
XmlMapUtil.detachNodeConnections(model, (XmlMapData) parentTable.eContainer(), true);
int index = parentTable.getNodes().indexOf(model);
if (index < minIndex) {
minIndex = index;
}
}
}
parentTable.getNodes().removeAll(toRemove);
if (!tablePart.getChildren().isEmpty()) {
if (minIndex > tablePart.getChildren().size() - 1) {
minIndex = tablePart.getChildren().size() - 1;
}
tablePart.getViewer().select((EditPart) tablePart.getChildren().get(minIndex));
} else {
remove.setEnabled(false);
}
}
});
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData in project tdi-studio-se by Talend.
the class XmlMapFiguresManager method getOutputTables.
/*
* (non-Javadoc)
*
* @see org.talend.designer.newabstractmap.figures.manager.FiguresManager#getOutputTables()
*/
@Override
protected List<MapperTable> getOutputTables() {
List<MapperTable> outputTables = new ArrayList<MapperTable>();
XmlMapData mapData = (XmlMapData) getRootEditPart().getModel();
outputTables.addAll(mapData.getOutputTrees());
return outputTables;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData in project tdi-studio-se by Talend.
the class XmlMapComponent method isRunRefSubProcessAtStart.
@Override
public boolean isRunRefSubProcessAtStart(String connectionName) {
XmlMapData externalEmfData = (XmlMapData) getExternalEmfData();
List<InputXmlTree> inputTrees = new ArrayList<InputXmlTree>(externalEmfData.getInputTrees());
for (InputXmlTree table : inputTrees) {
if (table.getName().equals(connectionName)) {
String lookupMode = table.getLookupMode();
if (XML_MAP_LOOKUP_MODE.RELOAD.name().equals(lookupMode) || XML_MAP_LOOKUP_MODE.CACHE_OR_RELOAD.name().equals(lookupMode)) {
return false;
}
}
}
return true;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData in project tdi-studio-se by Talend.
the class XmlMapService method checkXMLMapDifferents.
/*
* (non-Javadoc)
*
* @see org.talend.core.service.IXmlMapService#checkXMLMapDifferents(org.talend.core.model.process.INode,
* org.talend.core.model.process.INode)
*/
@Override
public boolean checkXMLMapDifferents(INode testNode, INode originalNode) {
AbstractExternalData oriExternalData = originalNode.getExternalNode().getExternalEmfData();
AbstractExternalData testExternalData = testNode.getExternalNode().getExternalEmfData();
if (oriExternalData == null && testExternalData == null) {
return false;
}
if (oriExternalData == null || testExternalData == null) {
return true;
}
if (!(oriExternalData instanceof XmlMapData) || !(testExternalData instanceof XmlMapData)) {
return false;
}
Map<String, String> inputConnNameMap = getInputConnectionNameMap(testNode);
XmlMapData oriXmlData = (XmlMapData) oriExternalData;
XmlMapData testXmlData = (XmlMapData) testExternalData;
EList<InputXmlTree> oriInputs = oriXmlData.getInputTrees();
EList<OutputXmlTree> oriOutputs = oriXmlData.getOutputTrees();
EList<VarTable> oriVars = oriXmlData.getVarTables();
EList<InputXmlTree> testInputs = testXmlData.getInputTrees();
EList<OutputXmlTree> testOutputs = testXmlData.getOutputTrees();
EList<VarTable> testVars = testXmlData.getVarTables();
if (oriInputs.size() != testInputs.size()) {
return true;
}
if (oriOutputs.size() != testOutputs.size()) {
return true;
}
if (oriVars.size() != testVars.size()) {
return true;
}
for (InputXmlTree oriInput : oriInputs) {
String oriName = oriInput.getName();
InputXmlTree testInput = null;
for (InputXmlTree input : testInputs) {
if (input.getName().equals(oriName)) {
testInput = input;
break;
}
}
if (testInput == null) {
testInput = getInputXmlTree(testNode, testInputs, oriName);
}
if (testInput == null) {
return true;
}
if (oriInput.isActivateExpressionFilter() != testInput.isActivateExpressionFilter()) {
return true;
}
if (oriInput.getExpressionFilter() != testInput.getExpressionFilter()) {
return true;
}
if (oriInput.isMinimized() != testInput.isMinimized()) {
return true;
}
if (oriInput.isActivateCondensedTool() != testInput.isActivateCondensedTool()) {
return true;
}
EList<TreeNode> oriEntrys = oriInput.getNodes();
EList<TreeNode> testEntrys = testInput.getNodes();
if (oriEntrys.size() != testEntrys.size()) {
return true;
}
for (TreeNode oriEntry : oriEntrys) {
String oriEntryName = oriEntry.getName();
boolean found = false;
for (TreeNode testEntry : testEntrys) {
if (oriEntryName.equals(testEntry.getName())) {
found = true;
if (checkExpression(oriEntry.getExpression(), testEntry.getExpression(), inputConnNameMap)) {
return true;
}
break;
}
}
if (!found) {
return true;
}
}
}
for (OutputXmlTree oriOutput : oriOutputs) {
String oriName = oriOutput.getName();
OutputXmlTree testOutput = null;
for (OutputXmlTree output : testOutputs) {
if (output.getName().equals(oriName)) {
testOutput = output;
break;
}
}
if (testOutput == null) {
testOutput = getOutputXmlTree(testNode, testOutputs, oriName);
}
if (testOutput == null) {
return true;
}
if (oriOutput.isActivateExpressionFilter() != testOutput.isActivateExpressionFilter()) {
return true;
}
if (oriOutput.getExpressionFilter() != testOutput.getExpressionFilter()) {
return true;
}
if (oriOutput.isMinimized() != testOutput.isMinimized()) {
return true;
}
if (oriOutput.isActivateCondensedTool() != testOutput.isActivateCondensedTool()) {
return true;
}
EList<OutputTreeNode> oriEntrys = oriOutput.getNodes();
EList<OutputTreeNode> testEntrys = testOutput.getNodes();
if (oriEntrys.size() != testEntrys.size()) {
return true;
}
for (OutputTreeNode oriEntry : oriEntrys) {
String oriEntryName = oriEntry.getName();
boolean found = false;
for (OutputTreeNode testEntry : testEntrys) {
if (oriEntryName.equals(testEntry.getName())) {
found = true;
if (found) {
if (checkChildOutputTreeNode(oriEntry, testEntry, inputConnNameMap)) {
return true;
}
}
break;
}
}
if (!found) {
return true;
}
}
}
for (VarTable oriVar : oriVars) {
String oriName = oriVar.getName();
VarTable testVar = null;
for (VarTable var : testVars) {
if (var.getName().equals(oriName)) {
testVar = var;
break;
}
}
if (testVar == null) {
return true;
}
if (oriVar.isMinimized() != testVar.isMinimized()) {
return true;
}
EList<VarNode> oriEntrys = oriVar.getNodes();
EList<VarNode> testEntrys = testVar.getNodes();
if (oriEntrys.size() != testEntrys.size()) {
return true;
}
for (VarNode oriEntry : oriEntrys) {
String oriEntryName = oriEntry.getName();
boolean found = false;
for (VarNode testEntry : testEntrys) {
if (oriEntryName.equals(testEntry.getName())) {
found = true;
if (checkExpression(oriEntry.getExpression(), testEntry.getExpression(), inputConnNameMap)) {
return true;
}
}
}
if (!found) {
return true;
}
}
}
return false;
}
Aggregations