Search in sources :

Example 6 with TreeNode

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;
}
Also used : OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) XmlmapTreeNodeFigure(org.talend.designer.xmlmap.figures.treeNode.XmlmapTreeNodeFigure)

Example 7 with TreeNode

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;
}
Also used : HashConfiguration(org.talend.core.model.process.HashConfiguration) IHashConfiguration(org.talend.core.model.process.IHashConfiguration) IHashableColumn(org.talend.core.model.process.IHashableColumn) HashableColumn(org.talend.core.model.process.HashableColumn) ILookupMode(org.talend.core.model.process.ILookupMode) ArrayList(java.util.ArrayList) IHashableColumn(org.talend.core.model.process.IHashableColumn) InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) IMatchingMode(org.talend.core.model.process.IMatchingMode) IElementParameter(org.talend.core.model.process.IElementParameter) IHashConfiguration(org.talend.core.model.process.IHashConfiguration) XmlMapData(org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)

Example 8 with TreeNode

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);
    }
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) XmlMapData(org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)

Example 9 with TreeNode

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);
                }
            }
        }
    }
}
Also used : InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) ArrayList(java.util.ArrayList) AbstractInOutTree(org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree) XmlMapData(org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)

Example 10 with TreeNode

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;
}
Also used : VarNode(org.talend.designer.xmlmap.model.emf.xmlmap.VarNode) ArrayList(java.util.ArrayList) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) InputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree) VarTable(org.talend.designer.xmlmap.model.emf.xmlmap.VarTable) OutputTreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode) TreeNode(org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode) OutputXmlTree(org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree) XmlMapData(org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)

Aggregations

TreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.TreeNode)119 OutputTreeNode (org.talend.designer.xmlmap.model.emf.xmlmap.OutputTreeNode)88 ArrayList (java.util.ArrayList)39 InputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.InputXmlTree)34 OutputXmlTree (org.talend.designer.xmlmap.model.emf.xmlmap.OutputXmlTree)26 AbstractInOutTree (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractInOutTree)25 TreeNodeEditPart (org.talend.designer.xmlmap.parts.TreeNodeEditPart)22 List (java.util.List)21 VarNode (org.talend.designer.xmlmap.model.emf.xmlmap.VarNode)19 XmlMapData (org.talend.designer.xmlmap.model.emf.xmlmap.XmlMapData)17 EList (org.eclipse.emf.common.util.EList)15 LookupConnection (org.talend.designer.xmlmap.model.emf.xmlmap.LookupConnection)14 AbstractNode (org.talend.designer.xmlmap.model.emf.xmlmap.AbstractNode)13 Connection (org.talend.designer.xmlmap.model.emf.xmlmap.Connection)12 VarTable (org.talend.designer.xmlmap.model.emf.xmlmap.VarTable)12 FilterConnection (org.talend.designer.xmlmap.model.emf.xmlmap.FilterConnection)11 FOXTreeNode (org.talend.metadata.managment.ui.wizard.metadata.xml.node.FOXTreeNode)10 TransferedObject (org.talend.designer.gefabstractmap.dnd.TransferedObject)9 VarNodeEditPart (org.talend.designer.xmlmap.parts.VarNodeEditPart)9 OutputTreeNodeEditPart (org.talend.designer.xmlmap.parts.OutputTreeNodeEditPart)8