Search in sources :

Example 66 with Indicator

use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.

the class AnalysisExecutor method hasOutThreshold.

/**
 * DOC qiongli Comment method "hasOutThreshold".
 *
 * @param indicator
 * @return
 */
private boolean hasOutThreshold(Indicator indicator) {
    String[] indicatorThreshold = IndicatorHelper.getIndicatorThreshold(indicator);
    String[] indiPercentThreshold = IndicatorHelper.getIndicatorThresholdInPercent(indicator);
    Object obj = IndicatorCommonUtil.getIndicatorValue(indicator);
    if (indicatorThreshold != null || indiPercentThreshold != null) {
        // MOD qiongli 2011-11-15 TDQ-3690 avoid String "null",and get the value for ValueIndicator to transfer.
        if (obj != null && !PluginConstant.EMPTY_STRING.equals(obj.toString()) && !"null".equalsIgnoreCase(obj.toString())) {
            // $NON-NLS-1$
            String value = PluginConstant.EMPTY_STRING;
            if (indicator instanceof ValueIndicator) {
                value = ((ValueIndicator) indicator).getValue();
            }
            ChartDataEntity chartDataEntity = new ChartDataEntity(indicator, PluginConstant.EMPTY_STRING, value);
            if (obj instanceof PatternMatchingExt) {
                obj = (((PatternMatchingExt) obj).getMatchingValueCount());
            }
            if (chartDataEntity.isOutOfRange(obj.toString())) {
                return true;
            }
        }
    }
    List<Indicator> leaves = IndicatorHelper.getIndicatorLeaves(indicator);
    if (leaves.size() > 0 && !leaves.get(0).equals(indicator)) {
        for (Indicator leaveIndicator : leaves) {
            if (hasOutThreshold(leaveIndicator)) {
                return true;
            }
        }
    }
    return false;
}
Also used : ValueIndicator(org.talend.dataquality.indicators.ValueIndicator) PatternMatchingExt(org.talend.dq.indicators.ext.PatternMatchingExt) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) Indicator(org.talend.dataquality.indicators.Indicator) ValueIndicator(org.talend.dataquality.indicators.ValueIndicator)

Example 67 with Indicator

use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.

the class DependenciesHandler method getIndicatorDependency.

/**
 * get Indicator Dependency.
 *
 * @return get the list for analysis which use parameter to be a Indicator
 */
public List<IRepositoryViewObject> getIndicatorDependency(IRepositoryViewObject viewObject) {
    Item item = viewObject.getProperty().getItem();
    List<IRepositoryViewObject> listAnalysisViewObject = new ArrayList<IRepositoryViewObject>();
    if (item instanceof TDQIndicatorDefinitionItemImpl) {
        TDQIndicatorDefinitionItemImpl tdqIndicatorItem = (TDQIndicatorDefinitionItemImpl) item;
        IndicatorDefinition newIndicatorDefinition = tdqIndicatorItem.getIndicatorDefinition();
        List<IRepositoryViewObject> allAnaList = new ArrayList<IRepositoryViewObject>();
        try {
            allAnaList.addAll(ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.TDQ_ANALYSIS_ELEMENT, true));
        } catch (PersistenceException e) {
            log.error(e, e);
        }
        for (IRepositoryViewObject theAna : allAnaList) {
            List<Indicator> indicators = IndicatorHelper.getIndicators(((TDQAnalysisItem) theAna.getProperty().getItem()).getAnalysis().getResults());
            for (Indicator indicator : indicators) {
                IndicatorDefinition oldIndicatorDefinition = indicator.getIndicatorDefinition();
                if (ModelElementHelper.compareUUID(oldIndicatorDefinition, newIndicatorDefinition)) {
                    listAnalysisViewObject.add(theAna);
                    break;
                }
            }
        }
    }
    return listAnalysisViewObject;
}
Also used : TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem) Item(org.talend.core.model.properties.Item) TDQSourceFileItem(org.talend.dataquality.properties.TDQSourceFileItem) TDQFileItem(org.talend.dataquality.properties.TDQFileItem) TDQIndicatorDefinitionItemImpl(org.talend.dataquality.properties.impl.TDQIndicatorDefinitionItemImpl) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ArrayList(java.util.ArrayList) PersistenceException(org.talend.commons.exception.PersistenceException) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) Indicator(org.talend.dataquality.indicators.Indicator) TDQAnalysisItem(org.talend.dataquality.properties.TDQAnalysisItem)

Example 68 with Indicator

use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.

the class SchemaAnalysisWizard method initCWMResourceBuilder.

@Override
public ModelElement initCWMResourceBuilder() {
    Analysis analysis = (Analysis) super.initCWMResourceBuilder();
    if (getAnalysisBuilder() != null) {
        // MOD klliu 15750 2011-1-05 add the repnode on parameter
        PackagesAnalyisParameter packageParameter = getParameter();
        IRepositoryNode connectionRepNode = getParameter().getConnectionRepNode();
        ConnectionItem item = (ConnectionItem) connectionRepNode.getObject().getProperty().getItem();
        Connection tdProvider = item.getConnection();
        // Connection tdProvider = packageParameter.getTdDataProvider();
        getAnalysisBuilder().setAnalysisConnection(tdProvider);
        Indicator[] indicators = new Indicator[packageParameter.getPackages().size()];
        ModelElement[] modelElement = new ModelElement[packageParameter.getPackages().size()];
        int i = 0;
        for (IRepositoryNode node : packageParameter.getPackages()) {
            SchemaIndicator createSchemaIndicator = SchemaFactory.eINSTANCE.createSchemaIndicator();
            DBSchemaRepNode catalogNode = (DBSchemaRepNode) node;
            Schema schema = ((MetadataSchemaRepositoryObject) catalogNode.getObject()).getSchema();
            modelElement[i] = schema;
            DefinitionHandler.getInstance().setDefaultIndicatorDefinition(createSchemaIndicator);
            createSchemaIndicator.setAnalyzedElement(schema);
            indicators[i] = createSchemaIndicator;
            i++;
        }
        getAnalysisBuilder().addElementsToAnalyze(modelElement, indicators);
    }
    return analysis;
}
Also used : SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) DBSchemaRepNode(org.talend.dq.nodes.DBSchemaRepNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) Schema(orgomg.cwm.resource.relational.Schema) Connection(org.talend.core.model.metadata.builder.connection.Connection) SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) Indicator(org.talend.dataquality.indicators.Indicator) MetadataSchemaRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataSchemaRepositoryObject) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) PackagesAnalyisParameter(org.talend.dq.analysis.parameters.PackagesAnalyisParameter) Analysis(org.talend.dataquality.analysis.Analysis)

Example 69 with Indicator

use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.

the class MatchWizard method initCWMResourceBuilder.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dataprofiler.core.ui.wizard.analysis.column.ColumnSetWizard#initCWMResourceBuilder()
     */
@Override
public ModelElement initCWMResourceBuilder() {
    Analysis analysis = (Analysis) super.initCWMResourceBuilder();
    // New blocking key indicator.
    Indicator blockKeyIndicator = ColumnsetFactory.eINSTANCE.createBlockKeyIndicator();
    analysis.getResults().getIndicators().add(blockKeyIndicator);
    // Match rule indicator
    RecordMatchingIndicator matchRuleIndicator = ColumnsetFactory.eINSTANCE.createRecordMatchingIndicator();
    MatchRuleDefinition matchRuleDefinition = RulesFactory.eINSTANCE.createMatchRuleDefinition();
    matchRuleIndicator.setBuiltInMatchRuleDefinition(matchRuleDefinition);
    analysis.getResults().getIndicators().add(matchRuleIndicator);
    // default loaded row count
    IPreferenceStore preferenceStore = CorePlugin.getDefault().getPreferenceStore();
    int maxRows = preferenceStore.getInt(PluginConstant.MAX_NB_ROWS_ANALYSIS_EDITOR);
    TaggedValueHelper.setTaggedValue(analysis, TaggedValueHelper.PREVIEW_ROW_NUMBER, String.valueOf(maxRows));
    return analysis;
}
Also used : Analysis(org.talend.dataquality.analysis.Analysis) MatchRuleDefinition(org.talend.dataquality.rules.MatchRuleDefinition) RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore) RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator) Indicator(org.talend.dataquality.indicators.Indicator)

Example 70 with Indicator

use of org.talend.dataquality.indicators.Indicator in project tdq-studio-se by Talend.

the class IndicatorEvaluator method storeIndicator.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dq.indicators.Evaluator#storeIndicator(java.lang.Object,
     * org.talend.dataquality.indicators.Indicator)
     * 
     * MOD scorreia 2009-04-24 overrided to solve bug 7093
     */
@Override
public boolean storeIndicator(String elementToAnalyze, Indicator indicator) {
    boolean ok = true;
    final List<Indicator> indicatorLeaves = IndicatorHelper.getIndicatorLeaves(indicator);
    for (Indicator leaf : indicatorLeaves) {
        if (!this.allIndicators.contains(leaf) && !MultiMapHelper.addUniqueObjectToListMap(elementToAnalyze, leaf, elementToIndicators)) {
            ok = false;
        }
    }
    this.allIndicators.addAll(indicatorLeaves);
    return ok;
}
Also used : UniqueCountIndicator(org.talend.dataquality.indicators.UniqueCountIndicator) FrequencyIndicator(org.talend.dataquality.indicators.FrequencyIndicator) FormatFreqPieIndicator(org.talend.dataquality.indicators.FormatFreqPieIndicator) MaxLengthIndicator(org.talend.dataquality.indicators.MaxLengthIndicator) Indicator(org.talend.dataquality.indicators.Indicator) MinLengthIndicator(org.talend.dataquality.indicators.MinLengthIndicator) PatternLowFreqIndicator(org.talend.dataquality.indicators.PatternLowFreqIndicator) PatternFreqIndicator(org.talend.dataquality.indicators.PatternFreqIndicator) DuplicateCountIndicator(org.talend.dataquality.indicators.DuplicateCountIndicator) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator)

Aggregations

Indicator (org.talend.dataquality.indicators.Indicator)178 ArrayList (java.util.ArrayList)58 RowCountIndicator (org.talend.dataquality.indicators.RowCountIndicator)40 CompositeIndicator (org.talend.dataquality.indicators.CompositeIndicator)31 ModelElement (orgomg.cwm.objectmodel.core.ModelElement)31 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)28 Analysis (org.talend.dataquality.analysis.Analysis)27 DuplicateCountIndicator (org.talend.dataquality.indicators.DuplicateCountIndicator)27 UniqueCountIndicator (org.talend.dataquality.indicators.UniqueCountIndicator)27 AllMatchIndicator (org.talend.dataquality.indicators.columnset.AllMatchIndicator)26 ReturnCode (org.talend.utils.sugars.ReturnCode)25 SimpleStatIndicator (org.talend.dataquality.indicators.columnset.SimpleStatIndicator)24 UserDefIndicator (org.talend.dataquality.indicators.sql.UserDefIndicator)24 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)23 DistinctCountIndicator (org.talend.dataquality.indicators.DistinctCountIndicator)22 NullCountIndicator (org.talend.dataquality.indicators.NullCountIndicator)22 TdColumn (org.talend.cwm.relational.TdColumn)20 WhereRuleIndicator (org.talend.dataquality.indicators.sql.WhereRuleIndicator)18 FrequencyIndicator (org.talend.dataquality.indicators.FrequencyIndicator)17 Test (org.junit.Test)16