Search in sources :

Example 11 with MetadataColumnExt

use of org.talend.designer.rowgenerator.ui.editor.MetadataColumnExt in project tdi-studio-se by Talend.

the class UIManager method convert.

/**
     * qzhang Comment method "convert".
     * 
     * @param outputMetaTable2
     * @return TODO
     */
public void convert(RowGeneratorComponent externalNode, IMetadataTable outputMetaTable2, FunctionManagerExt functionManager) {
    List<IMetadataColumn> exts = new ArrayList<IMetadataColumn>();
    for (int j = 0; j < outputMetaTable2.getListColumns().size(); j++) {
        IMetadataColumn column = outputMetaTable2.getListColumns().get(j);
        if (column instanceof MetadataColumnExt) {
            exts.add(column.clone());
        } else if (column instanceof MetadataColumn) {
            MetadataColumnExt ext = new MetadataColumnExt((MetadataColumn) column);
            List<Function> funs = functionManager.getFunctionsByType(ext.getTalendType());
            ext.setArrayFunctions(functionManager.getFunctionArrays(funs));
            if (!funs.isEmpty()) {
                Function funtion = functionManager.getFunctionFromColumn(ext);
                if (funtion == null) {
                    funtion = functionManager.getFuntionFromArray(ext, externalNode, j);
                }
                ext.setFunction(funtion);
            }
            exts.add(ext);
        }
    }
    outputMetaTable2.setListColumns(exts);
}
Also used : IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumn(org.talend.core.model.metadata.MetadataColumn) Function(org.talend.designer.rowgenerator.data.Function) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) MetadataColumnExt(org.talend.designer.rowgenerator.ui.editor.MetadataColumnExt)

Aggregations

MetadataColumnExt (org.talend.designer.rowgenerator.ui.editor.MetadataColumnExt)11 ArrayList (java.util.ArrayList)7 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)6 MetadataColumn (org.talend.core.model.metadata.MetadataColumn)6 Test (org.junit.Test)5 HashMap (java.util.HashMap)2 Map (java.util.Map)2 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)2 MetadataTable (org.talend.core.model.metadata.MetadataTable)2 Function (org.talend.designer.rowgenerator.data.Function)2 Method (java.lang.reflect.Method)1 List (java.util.List)1 Element (org.dom4j.Element)1