use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.
the class TreeNodeEditPart method createFigure.
@Override
protected IFigure createFigure() {
TreeNode model = (TreeNode) getModel();
boolean isRoot = false;
if (model.eContainer() instanceof AbstractInOutTree) {
isRoot = true;
}
XmlmapTreeNodeFigure treeNodeFigure = new XmlmapTreeNodeFigure(entityManger, isRoot);
return treeNodeFigure;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.
the class XmlMapComponent method getHashConfiguration.
@Override
public IHashConfiguration getHashConfiguration(String connectionName) {
IHashConfiguration hashConfigurationForMapper = null;
XmlMapData externalData = (XmlMapData) getExternalEmfData();
List<InputXmlTree> inputTables = externalData.getInputTrees();
List<IHashableColumn> hashableColumns = new ArrayList<IHashableColumn>();
for (InputXmlTree inputTable : inputTables) {
if (inputTable.getName().equals(connectionName)) {
List<TreeNode> metadataTableEntries = inputTable.getNodes();
if (metadataTableEntries != null) {
int metadataTableEntriesListSize = metadataTableEntries.size();
for (int i = 0; i < metadataTableEntriesListSize; i++) {
TreeNode entry = metadataTableEntries.get(i);
if (entry.getExpression() != null && !entry.getExpression().trim().equals("")) {
//$NON-NLS-1$
hashableColumns.add(new HashableColumn(entry.getName(), i));
}
}
}
IMatchingMode matchingMode = MATCHING_MODE.parse(inputTable.getMatchingMode());
if (matchingMode == null) {
matchingMode = MATCHING_MODE.UNIQUE_MATCH;
}
ILookupMode lookupMode = org.talend.designer.xmlmap.model.tree.LOOKUP_MODE.parse(inputTable.getLookupMode());
if (lookupMode == null) {
lookupMode = org.talend.designer.xmlmap.model.tree.LOOKUP_MODE.LOAD_ONCE;
}
//$NON-NLS-1$
IElementParameter tempFolderElem = getElementParameter("TEMPORARY_DATA_DIRECTORY");
String tempFolder = null;
if (tempFolderElem != null) {
tempFolder = (String) tempFolderElem.getValue();
}
if (("").equals(tempFolder)) {
//$NON-NLS-1$ //$NON-NLS-2$
tempFolder = (String) this.getProcess().getElementParameter("COMP_DEFAULT_FILE_DIR").getValue() + "/temp";
tempFolder = TalendTextUtils.addQuotes(tempFolder);
}
//$NON-NLS-1$
IElementParameter rowsBufferSizeElem = getElementParameter("ROWS_BUFFER_SIZE");
String rowsBufferSize = null;
if (rowsBufferSizeElem != null) {
rowsBufferSize = (String) rowsBufferSizeElem.getValue();
}
hashConfigurationForMapper = new HashConfiguration(hashableColumns, matchingMode, inputTable.isPersistent(), tempFolder, rowsBufferSize);
break;
}
}
return hashConfigurationForMapper;
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.
the class XmlMapComponent method removeInput.
/*
* (non-Javadoc)
*
* @see org.talend.core.model.process.AbstractNode#removeInput(org.talend.core.model.process.IConnection)
*/
@Override
public void removeInput(IConnection connection) {
XmlMapData externalEmfData = (XmlMapData) getExternalEmfData();
InputXmlTree toRemove = null;
for (InputXmlTree inputTree : externalEmfData.getInputTrees()) {
if (inputTree.getName() != null && inputTree.getName().equals(connection.getUniqueName())) {
toRemove = inputTree;
break;
}
}
if (toRemove != null) {
if (!toRemove.isLookup() && toRemove.isMultiLoops()) {
// clean InputLoopTable in putput tree
XmlMapUtil.removeloopInOutputTree(externalEmfData, null, null);
}
for (TreeNode treeNode : toRemove.getNodes()) {
XmlMapUtil.detachNodeConnections(treeNode, externalEmfData, true);
}
XmlMapUtil.detachFilterSource(toRemove, externalEmfData);
externalEmfData.getInputTrees().remove(toRemove);
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.
the class XmlMapComponent method renameMetadataColumnName.
@Override
protected void renameMetadataColumnName(String conectionName, String oldColumnName, String newColumnName) {
List<AbstractInOutTree> abstractTrees = new ArrayList<AbstractInOutTree>();
XmlMapData externalEmfData = (XmlMapData) getExternalEmfData();
abstractTrees.addAll(externalEmfData.getInputTrees());
abstractTrees.addAll(externalEmfData.getOutputTrees());
for (AbstractInOutTree abstractTree : abstractTrees) {
if (abstractTree.getName() != null && abstractTree.getName().equals(conectionName)) {
List<TreeNode> children = new ArrayList<TreeNode>();
if (abstractTree instanceof InputXmlTree) {
children.addAll(((InputXmlTree) abstractTree).getNodes());
} else {
children.addAll(((OutputXmlTree) abstractTree).getNodes());
}
for (TreeNode treeNode : children) {
if (treeNode.getName() != null && treeNode.getName().equals(oldColumnName) && !oldColumnName.equals(newColumnName)) {
treeNode.setName(newColumnName);
XmlMapUtil.updateXPathAndExpression(externalEmfData, expressionManager, treeNode, newColumnName, 2, true);
}
}
}
}
}
use of org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode in project tdi-studio-se by Talend.
the class XmlMapComponent method checkNeededRoutines.
@Override
public List<String> checkNeededRoutines(List<String> possibleRoutines, String additionalString) {
List<String> routinesToAdd = new ArrayList<String>();
XmlMapData xmlMapData = (XmlMapData) getExternalEmfData();
for (String routine : possibleRoutines) {
List<OutputXmlTree> listOutput = xmlMapData.getOutputTrees();
for (OutputXmlTree outTable : listOutput) {
List<OutputTreeNode> listOutEntry = outTable.getNodes();
if (listOutEntry != null && !listOutEntry.isEmpty()) {
for (OutputTreeNode outEntry : listOutEntry) {
String expression = outEntry.getExpression();
if (expression != null && !routinesToAdd.contains(routine) && expression.contains(routine + additionalString)) {
routinesToAdd.add(routine);
}
}
}
String filter = outTable.getExpressionFilter();
if (filter != null && !routinesToAdd.contains(routine) && filter.contains(routine + additionalString)) {
routinesToAdd.add(routine);
}
}
List<InputXmlTree> listInput = xmlMapData.getInputTrees();
for (InputXmlTree inputTable : listInput) {
List<TreeNode> listInEntry = inputTable.getNodes();
if (listInEntry != null && !listInEntry.isEmpty()) {
for (TreeNode inEntry : listInEntry) {
String expression = inEntry.getExpression();
if (expression != null && !routinesToAdd.contains(routine) && expression.contains(routine + additionalString)) {
routinesToAdd.add(routine);
}
}
}
String filter = inputTable.getExpressionFilter();
if (filter != null && !routinesToAdd.contains(routine) && filter.contains(routine + additionalString)) {
routinesToAdd.add(routine);
}
}
List<VarTable> listVar = xmlMapData.getVarTables();
for (VarTable varTable : listVar) {
List<VarNode> listVarEntry = varTable.getNodes();
if (listVarEntry != null && !listVarEntry.isEmpty()) {
for (VarNode varEntry : listVarEntry) {
String expression = varEntry.getExpression();
if (expression != null && !routinesToAdd.contains(routine) && expression.contains(routine + additionalString)) {
routinesToAdd.add(routine);
}
}
}
}
}
return routinesToAdd;
}
Aggregations