Search in sources :

Example 11 with Indicator

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

the class ColumnSetAnalysisDetailsPage method refreshIndicatorsSection.

/**
 * refresh the Indicators Section.
 */
public void refreshIndicatorsSection() {
    // when there have pattern, show allmatchindicator
    ModelElementIndicator[] modelElementIndicator = treeViewer.getModelElementIndicator();
    if (modelElementIndicator != null) {
        for (ModelElementIndicator modelElementInd : modelElementIndicator) {
            Indicator[] inds = modelElementInd.getPatternIndicators();
            for (Indicator ind : inds) {
                if (ind instanceof RegexpMatchingIndicator) {
                    indicatorsViewer.setInput(simpleStatIndicator, allMatchIndicator);
                    return;
                }
            }
        }
    }
    indicatorsViewer.setInput(simpleStatIndicator);
}
Also used : RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 12 with Indicator

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

the class ColumnSetAnalysisDetailsPage method recomputeIndicators.

public void recomputeIndicators() {
    columnSetAnalysisHandler = new ColumnSetAnalysisHandler();
    columnSetAnalysisHandler.setAnalysis(getCurrentModelElement());
    stringDataFilter = columnSetAnalysisHandler.getStringDataFilter();
    analyzedColumns = columnSetAnalysisHandler.getAnalyzedColumns();
    if (columnSetAnalysisHandler.getSimpleStatIndicator() == null || columnSetAnalysisHandler.getSimpleStatIndicator().eIsProxy()) {
        ColumnsetFactory columnsetFactory = ColumnsetFactory.eINSTANCE;
        simpleStatIndicator = columnsetFactory.createSimpleStatIndicator();
        simpleStatIndicator.setRowCountIndicator(IndicatorsFactory.eINSTANCE.createRowCountIndicator());
        simpleStatIndicator.setDistinctCountIndicator(IndicatorsFactory.eINSTANCE.createDistinctCountIndicator());
        simpleStatIndicator.setDuplicateCountIndicator(IndicatorsFactory.eINSTANCE.createDuplicateCountIndicator());
        simpleStatIndicator.setUniqueCountIndicator(IndicatorsFactory.eINSTANCE.createUniqueCountIndicator());
    } else {
        simpleStatIndicator = (SimpleStatIndicator) columnSetAnalysisHandler.getSimpleStatIndicator();
    }
    if (columnSetAnalysisHandler.getAllmatchIndicator() == null) {
        ColumnsetFactory columnsetFactory = ColumnsetFactory.eINSTANCE;
        allMatchIndicator = columnsetFactory.createAllMatchIndicator();
        DefinitionHandler.getInstance().setDefaultIndicatorDefinition(allMatchIndicator);
    } else {
        allMatchIndicator = (AllMatchIndicator) columnSetAnalysisHandler.getAllmatchIndicator();
    }
    initializeIndicator(simpleStatIndicator);
    List<ModelElementIndicator> meIndicatorList = new ArrayList<ModelElementIndicator>();
    ModelElementIndicator currentIndicator = null;
    for (ModelElement element : analyzedColumns) {
        // MOD yyi 2011-02-16 17871:delimitefile
        MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(element);
        TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
        if (tdColumn == null && mdColumn == null) {
            continue;
        }
        if (tdColumn == null && mdColumn != null) {
            currentIndicator = ModelElementIndicatorHelper.createDFColumnIndicator(RepositoryNodeHelper.recursiveFind(mdColumn));
        } else if (tdColumn != null) {
            RepositoryNode recursiveFind = RepositoryNodeHelper.recursiveFind(tdColumn);
            if (recursiveFind == null) {
                recursiveFind = RepositoryNodeHelper.createRepositoryNode(tdColumn);
            }
            currentIndicator = ModelElementIndicatorHelper.createModelElementIndicator(recursiveFind);
        }
        DataminingType dataminingType = MetadataHelper.getDataminingType(element);
        MetadataHelper.setDataminingType(dataminingType == null ? DataminingType.NOMINAL : dataminingType, element);
        Collection<Indicator> indicatorList = columnSetAnalysisHandler.getRegexMathingIndicators(element);
        if (null != currentIndicator) {
            currentIndicator.setIndicators(indicatorList.toArray(new Indicator[indicatorList.size()]));
            meIndicatorList.add(currentIndicator);
        }
    }
    currentModelElementIndicators = meIndicatorList.toArray(new ModelElementIndicator[meIndicatorList.size()]);
}
Also used : DataminingType(org.talend.dataquality.indicators.DataminingType) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) MetadataColumn(org.talend.core.model.metadata.builder.connection.MetadataColumn) ColumnSetAnalysisHandler(org.talend.dq.analysis.ColumnSetAnalysisHandler) TdColumn(org.talend.cwm.relational.TdColumn) ArrayList(java.util.ArrayList) ColumnsetFactory(org.talend.dataquality.indicators.columnset.ColumnsetFactory) RepositoryNode(org.talend.repository.model.RepositoryNode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 13 with Indicator

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

the class ConnectionAnalysisDetailsPage method getSchemaIndicators.

@Override
public List<OverviewIndUIElement> getSchemaIndicators() {
    ConnectionIndicator conIndicator = (ConnectionIndicator) getCurrentModelElement().getResults().getIndicators().get(0);
    Connection analyzedElement = (Connection) conIndicator.getAnalyzedElement();
    EList<SchemaIndicator> schemaIndicators = conIndicator.getSchemaIndicators();
    List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
    RepositoryNode connNode = RepositoryNodeHelper.recursiveFind(analyzedElement);
    for (Indicator indicator : schemaIndicators) {
        if (connNode != null) {
            for (IRepositoryNode schemaNode : connNode.getChildren()) {
                String nodeUuid = ResourceHelper.getUUID(((MetadataSchemaRepositoryObject) schemaNode.getObject()).getSchema());
                String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
                if (nodeUuid.equals(anaUuid)) {
                    OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
                    cataUIEle.setNode(schemaNode);
                    cataUIEle.setOverviewIndicator(indicator);
                    cataUIEleList.add(cataUIEle);
                    break;
                }
            }
        }
    }
    return cataUIEleList;
}
Also used : SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) IRepositoryNode(org.talend.repository.model.IRepositoryNode) Connection(org.talend.core.model.metadata.builder.connection.Connection) ArrayList(java.util.ArrayList) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) ConnectionIndicator(org.talend.dataquality.indicators.schema.ConnectionIndicator) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) ConnectionIndicator(org.talend.dataquality.indicators.schema.ConnectionIndicator) SchemaIndicator(org.talend.dataquality.indicators.schema.SchemaIndicator) Indicator(org.talend.dataquality.indicators.Indicator)

Example 14 with Indicator

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

the class ColumnAnalysisResultPage method registerDynamicEvent.

/**
 * Added TDQ-8787 20140613 yyin: create all charts before running, register each chart with its related indicator.
 */
public void registerDynamicEvent() {
    // get all indicators and datasets
    List<DynamicIndicatorModel> indiAndDatasets = uiPagination.getAllIndcatorAndDatasetOfCurrentPage();
    // register dynamic event,for the indicator (for each column)
    for (DynamicIndicatorModel oneCategoryIndicatorModel : indiAndDatasets) {
        TableViewer tableViewer = oneCategoryIndicatorModel.getTableViewer();
        if (EIndicatorChartType.SUMMARY_STATISTICS.equals(oneCategoryIndicatorModel.getChartType())) {
            // when all/not-all summary indicators are selected
            DynamicBAWChartEventReceiver bawReceiver = AnalysisUtils.createDynamicBAWChartEventReceiver(oneCategoryIndicatorModel, eventReceivers);
            bawReceiver.setChartComposite(chartComposite);
            bawReceiver.setParentChartComposite((Composite) oneCategoryIndicatorModel.getBawParentChartComp());
            bawReceiver.refreshChart();
            bawReceiver.setTableViewer(tableViewer);
        // no need to register the parent baw receiver with one of summary indicator, no need to handle baw
        // actually
        } else {
            int index = 0;
            for (Indicator oneIndicator : oneCategoryIndicatorModel.getIndicatorList()) {
                DynamicChartEventReceiver eReceiver = AnalysisUtils.createDynamicChartEventReceiver(oneCategoryIndicatorModel, index++, oneIndicator);
                eReceiver.setChartComposite(chartComposite);
                eReceiver.refreshChart();
                eReceiver.setTableViewer(tableViewer);
                // clear data
                eReceiver.clearValue();
                registerIndicatorEvent(oneIndicator, eReceiver);
            }
        }
    }
    reLayoutChartComposite();
    registerOtherDynamicEvent();
}
Also used : DynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver) DynamicIndicatorModel(org.talend.dataprofiler.core.model.dynamic.DynamicIndicatorModel) TableViewer(org.eclipse.jface.viewers.TableViewer) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) DynamicBAWChartEventReceiver(org.talend.dataprofiler.core.ui.events.DynamicBAWChartEventReceiver)

Example 15 with Indicator

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

the class ColumnAnalysisResultPage method unRegisterDynamicEvent.

/**
 * unregister every dynamic events which registered before executing analysis
 *
 * @param eventReceivers
 */
public void unRegisterDynamicEvent() {
    EventManager.getInstance().clearEvent(masterPage.getCurrentModelElement(), EventEnum.DQ_DYNAMIC_SWITCH_MASTER_RESULT_PAGE);
    for (Indicator oneIndicator : eventReceivers.keySet()) {
        DynamicChartEventReceiver eventReceiver = (DynamicChartEventReceiver) eventReceivers.get(oneIndicator);
        eventReceiver.clear();
        EventManager.getInstance().clearEvent(oneIndicator, EventEnum.DQ_DYMANIC_CHART);
    }
    eventReceivers.clear();
    EventManager.getInstance().clearEvent(chartComposite, EventEnum.DQ_DYNAMIC_REFRESH_DYNAMIC_CHART);
    if (uiPagination != null) {
        uiPagination.clearAllDynamicMapOfCurrentPage();
    }
    masterPage.clearDynamicDatasets();
}
Also used : DynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

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