Search in sources :

Example 6 with ColumnIndicator

use of org.talend.dataprofiler.core.model.ColumnIndicator in project tdq-studio-se by Talend.

the class AnalysisColumnSetTreeViewer method getModelElemetnDisplayName.

/**
 * DOC qiongli Comment method "getModelElemetnDisplayName".
 *
 * @param meIndicator
 * @return
 */
private String getModelElemetnDisplayName(ModelElementIndicator meIndicator) {
    if (meIndicator.getModelElementRepositoryNode() == null) {
        // $NON-NLS-1$
        return "null";
    }
    String meName = meIndicator.getElementName();
    // $NON-NLS-1$
    String typeName = "";
    if (meIndicator instanceof ColumnIndicator) {
        // MOD scorreia 2010-10-20 bug 16403 avoid NPE here
        TdSqlDataType sqlDataType = ((ColumnIndicator) meIndicator).getTdColumn().getSqlDataType();
        // $NON-NLS-1$
        typeName = sqlDataType != null ? sqlDataType.getName() : "unknown";
    } else if (meIndicator instanceof DelimitedFileIndicatorImpl) {
        MetadataColumn mColumn = ((DelimitedFileIndicatorImpl) meIndicator).getMetadataColumn();
        typeName = TalendTypeConvert.convertToJavaType(mColumn.getTalendType());
    }
    return meName != null ? meName + PluginConstant.SPACE_STRING + PluginConstant.PARENTHESIS_LEFT + typeName + PluginConstant.PARENTHESIS_RIGHT : // $NON-NLS-1$
    "null";
}
Also used : MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) ColumnIndicator(org.talend.dataprofiler.core.model.ColumnIndicator) DelimitedFileIndicatorImpl(org.talend.dataprofiler.core.model.impl.DelimitedFileIndicatorImpl) TdSqlDataType(org.talend.cwm.relational.TdSqlDataType)

Example 7 with ColumnIndicator

use of org.talend.dataprofiler.core.model.ColumnIndicator in project tdq-studio-se by Talend.

the class ColumnIndicatorUnit method getForms.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit#getForms()
     */
@Override
public FormEnum[] getForms() {
    int sqlType = null != modelElementIndicator ? modelElementIndicator.getJavaType() : 0;
    ColumnIndicator columnIndicator = ModelElementIndicatorHelper.switchColumnIndicator(this);
    DataminingType dataminingType = columnIndicator == null ? null : MetadataHelper.getDataminingType(columnIndicator.getTdColumn());
    if (dataminingType == null) {
        dataminingType = null != modelElementIndicator ? MetadataHelper.getDefaultDataminingType(modelElementIndicator.getJavaType()) : DataminingType.NOMINAL;
    }
    return FormEnum.getFormEnumArray(this.getIndicator().getIndicatorDefinition(), sqlType, dataminingType, type, getExecutionLanguage());
}
Also used : DataminingType(org.talend.dataquality.indicators.DataminingType) ColumnIndicator(org.talend.dataprofiler.core.model.ColumnIndicator)

Example 8 with ColumnIndicator

use of org.talend.dataprofiler.core.model.ColumnIndicator in project tdq-studio-se by Talend.

the class PatternLabelProvider method getPatternFileByIndicator.

/**
 * @param clmIndicator
 * @return
 * @deprecated since repository nodes are used instead of IFiles
 */
@Deprecated
public static IFile[] getPatternFileByIndicator(ColumnIndicator clmIndicator) {
    Indicator[] patternIndicators = clmIndicator.getPatternIndicators();
    List<IFile> existedPatternFiles = new ArrayList<IFile>();
    if (patternIndicators.length != 0) {
        for (Indicator patternIndicator : patternIndicators) {
            PatternMatchingIndicator ptnIndicaotr = (PatternMatchingIndicator) patternIndicator;
            List<Pattern> patterns = ptnIndicaotr.getParameters().getDataValidDomain().getPatterns();
            for (Pattern pattern : patterns) {
                for (IFile file : getAllPatternFiles()) {
                    Pattern fpattern = PatternResourceFileHelper.getInstance().findPattern(file);
                    if (pattern.getName().equals(fpattern.getName())) {
                        existedPatternFiles.add(file);
                    }
                }
            }
        }
    }
    return existedPatternFiles.toArray(new IFile[existedPatternFiles.size()]);
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) IFile(org.eclipse.core.resources.IFile) ArrayList(java.util.ArrayList) ColumnIndicator(org.talend.dataprofiler.core.model.ColumnIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) Indicator(org.talend.dataquality.indicators.Indicator)

Aggregations

ColumnIndicator (org.talend.dataprofiler.core.model.ColumnIndicator)8 MetadataColumn (org.talend.core.model.metadata.builder.connection.MetadataColumn)3 ArrayList (java.util.ArrayList)2 Composite (org.eclipse.swt.widgets.Composite)2 ExpandableComposite (org.eclipse.ui.forms.widgets.ExpandableComposite)2 TdSqlDataType (org.talend.cwm.relational.TdSqlDataType)2 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)2 DelimitedFileIndicatorImpl (org.talend.dataprofiler.core.model.impl.DelimitedFileIndicatorImpl)2 IFile (org.eclipse.core.resources.IFile)1 EObject (org.eclipse.emf.ecore.EObject)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)1 DelimitedFileIndicator (org.talend.dataprofiler.core.model.DelimitedFileIndicator)1 Pattern (org.talend.dataquality.domain.pattern.Pattern)1 DataminingType (org.talend.dataquality.indicators.DataminingType)1 Indicator (org.talend.dataquality.indicators.Indicator)1 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)1