Search in sources :

Example 61 with MetadataColumn

use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdq-studio-se by Talend.

the class DFColumnFolderRepNode method createMdcolumnsNode.

/**
 * DOC qiongli Comment method "createTdcolumnsNode".
 *
 * @param tdcolumns
 * @param repsNodes
 */
private void createMdcolumnsNode(List<MetadataColumn> mdColumns, List<IRepositoryNode> repsNodes) {
    for (MetadataColumn mdColumn : mdColumns) {
        MetadataColumnRepositoryObject metadataColumn = new MetadataColumnRepositoryObject(object, mdColumn);
        metadataColumn.setId(mdColumn.getLabel());
        metadataColumn.setLabel(mdColumn.getLabel());
        DFColumnRepNode columnNode = new DFColumnRepNode(metadataColumn, this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
        columnNode.setProperties(EProperties.LABEL, ERepositoryObjectType.METADATA_CON_COLUMN);
        columnNode.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_CON_COLUMN);
        metadataColumn.setRepositoryNode(columnNode);
        repsNodes.add(columnNode);
    }
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)

Example 62 with MetadataColumn

use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdq-studio-se by Talend.

the class DFColumnFolderRepNode method getChildren.

@Override
public List<IRepositoryNode> getChildren() {
    List<IRepositoryNode> repsNodes = new ArrayList<IRepositoryNode>();
    List<MetadataColumn> mdColumns = new ArrayList<MetadataColumn>();
    IRepositoryViewObject meataColumnSetObject = this.getObject();
    if (meataColumnSetObject instanceof MetadataTableRepositoryObject) {
        MetadataTableRepositoryObject mTableRepositoryObject = (MetadataTableRepositoryObject) meataColumnSetObject;
        object = mTableRepositoryObject;
        mTable = mTableRepositoryObject.getTable();
        columns = mTable.getColumns();
    }
    if (columns != null && columns.size() > 0) {
        for (MetadataColumn mec : columns) {
            mdColumns.add(mec);
        }
    }
    createMdcolumnsNode(mdColumns, repsNodes);
    // MOD msjian 2011-7-13 feature 22206 : fix note 0091973 issue3
    return filterResultsIfAny(repsNodes);
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) MetadataTableRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject)

Example 63 with MetadataColumn

use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdq-studio-se by Talend.

the class DBColumnFolderRepNode method getChildren.

@Override
public List<IRepositoryNode> getChildren() {
    if (!this.isReload() && !children.isEmpty()) {
        // MOD gdbu 2011-6-29 bug : 22204
        return filterResultsIfAny(children);
    }
    children.clear();
    String filterCharater = null;
    IRepositoryViewObject meataColumnSetObject = this.getParent().getObject();
    EList<MetadataColumn> columns = null;
    if (meataColumnSetObject instanceof TdTableRepositoryObject) {
        TdTableRepositoryObject tdTableRepositoryObject = (TdTableRepositoryObject) meataColumnSetObject;
        // MOD klliu 2011-09-06 bug TDQ-3414
        setItem((ConnectionItem) tdTableRepositoryObject.getViewObject().getProperty().getItem());
        if (tdTableRepositoryObject.getTdTable().eIsProxy()) {
            // reload the connection to make sure the connection(and all it's owned elements) is not proxy
            reloadConnectionViewObject();
        }
        tdTable = tdTableRepositoryObject.getTdTable();
        columns = tdTable.getColumns();
        filterCharater = ColumnHelper.getColumnFilter(tdTable);
    } else if (meataColumnSetObject instanceof TdViewRepositoryObject) {
        TdViewRepositoryObject tdViewRepositoryObject = (TdViewRepositoryObject) meataColumnSetObject;
        // MOD klliu 2011-09-06 bug TDQ-3414
        setItem((ConnectionItem) tdViewRepositoryObject.getViewObject().getProperty().getItem());
        if (tdViewRepositoryObject.getTdView().eIsProxy()) {
            // reload the connection to make sure the connection(and all it's owned elements) is not proxy
            reloadConnectionViewObject();
        }
        tdView = tdViewRepositoryObject.getTdView();
        columns = tdView.getColumns();
        filterCharater = ColumnHelper.getColumnFilter(tdView);
    }
    setConnection(getItem().getConnection());
    // MOD TDQ-8718 20140430 the repository view cares about if use the filter or not, the column select dialog
    // cares about if connect to DB or not.
    List<TdColumn> tdcolumns = null;
    if (columns.size() <= 0) {
        if (isCallingFromColumnDialog()) {
            tdcolumns = loadColumns(isLoadDBFromDialog());
        } else if (!isOnFilterring()) {
            // MOD gdbu 2011-6-28 bug : 22204
            tdcolumns = loadColumns(true);
        }
    } else {
        tdcolumns = new ArrayList<TdColumn>();
        for (MetadataColumn mec : columns) {
            tdcolumns.add((TdColumn) mec);
        }
    }
    if (tdcolumns != null && filterCharater != null && !filterCharater.equals("")) {
        // $NON-NLS-1$
        tdcolumns = RepositoryNodeHelper.filterColumns(tdcolumns, filterCharater);
    }
    createTdcolumnsNode(tdcolumns, children);
    this.setReload(false);
    // MOD gdbu 2011-6-28 bug : 22204
    return filterResultsIfAny(children);
// return children;
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) TdColumn(org.talend.cwm.relational.TdColumn) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) TdTableRepositoryObject(org.talend.core.repository.model.repositoryObject.TdTableRepositoryObject) TdViewRepositoryObject(org.talend.core.repository.model.repositoryObject.TdViewRepositoryObject)

Example 64 with MetadataColumn

use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdq-studio-se by Talend.

the class ModelElementIndicatorHelper method getColumns.

/**
 * Get columns from modelElementIndicators
 *
 * @param modelElementIndicators
 * @return
 */
public static final List<MetadataColumn> getColumns(ModelElementIndicator[] modelElementIndicators) {
    List<MetadataColumn> columns = new ArrayList<MetadataColumn>();
    for (ModelElementIndicator modelElementIndicator : modelElementIndicators) {
        ColumnIndicator switchColumnIndicator = switchColumnIndicator(modelElementIndicator);
        if (switchColumnIndicator == null) {
            continue;
        }
        columns.add(switchColumnIndicator.getTdColumn());
    }
    return columns;
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) ColumnIndicator(org.talend.dataprofiler.core.model.ColumnIndicator) ArrayList(java.util.ArrayList) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 65 with MetadataColumn

use of org.talend.core.model.metadata.builder.connection.MetadataColumn in project tdq-studio-se by Talend.

the class ResourceManager method getMapDBCatalogName.

/**
 * Get the catalog name of current indicator.
 *
 * @param indicator we should find the name of analysis,analysisElement,indicatorDefinition.So that it should be
 * used by some one analysis
 *
 * ColumnAnalysis like(../analysisName/columnName/indicatorName) others like(../analysisName/indicatorName)
 * @return
 */
public static String getMapDBCatalogName(Indicator indicator) {
    Analysis analysis = AnalysisHelper.getAnalysis(indicator);
    String analysisUUID = null;
    String indicatorUUID = ResourceHelper.getUUID(indicator);
    String modelElementName = Path.EMPTY.toString();
    if (analysis == null) {
        // $NON-NLS-1$
        log.error(Messages.getString("ResourceManager.CanNotGetAnalysis"));
    } else {
        analysisUUID = ResourceHelper.getUUID(analysis);
        if (AnalysisType.MULTIPLE_COLUMN.equals(analysis.getParameters().getAnalysisType())) {
            modelElementName = indicator.getAnalyzedElement().getName();
            // TDQ-12795, only for file delimited connection, the name of the column maybe null, but the label always has value.
            if (modelElementName == null) {
                if (indicator.getAnalyzedElement() instanceof MetadataColumn) {
                    if (indicator.getAnalyzedElement().eIsProxy()) {
                        modelElementName = Path.EMPTY.toString();
                    } else {
                        modelElementName = ((MetadataColumn) indicator.getAnalyzedElement()).getLabel();
                    }
                } else {
                    modelElementName = Path.EMPTY.toString();
                    log.error(Messages.getString("ResourceManager.CanNotGetColunName"));
                }
            }
        }
    }
    return getTempMapDBFolder().append(analysisUUID).append(modelElementName).append(indicatorUUID).append("_").toString();
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) Analysis(org.talend.dataquality.analysis.Analysis)

Aggregations

MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)203 ArrayList (java.util.ArrayList)98 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)51 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)37 TdColumn (org.talend.cwm.relational.TdColumn)28 List (java.util.List)24 HashMap (java.util.HashMap)20 Test (org.junit.Test)15 TaggedValue (orgomg.cwm.objectmodel.core.TaggedValue)14 EList (org.eclipse.emf.common.util.EList)12 Indicator (org.talend.dataquality.indicators.Indicator)12 IRepositoryNode (org.talend.repository.model.IRepositoryNode)12 File (java.io.File)11 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)10 NoSQLExtractSchemaException (org.talend.repository.nosql.exceptions.NoSQLExtractSchemaException)10 Map (java.util.Map)9 DelimitedFileConnection (org.talend.core.model.metadata.builder.connection.DelimitedFileConnection)9 RepositoryNode (org.talend.repository.model.RepositoryNode)9 Iterator (java.util.Iterator)8 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)8