Search in sources :

Example 96 with Indicator

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

the class ColumnAnalysisDetailsPage method recomputeIndicators.

public void recomputeIndicators() {
    analysisHandler = new ModelElementAnalysisHandler();
    analysisHandler.setAnalysis(getCurrentModelElement());
    // Handle JUDIs
    UDIHelper.updateJUDIsForAnalysis(getCurrentModelElement());
    stringDataFilter = analysisHandler.getStringDataFilterwithContext();
    EList<ModelElement> analyzedColumns = analysisHandler.getAnalyzedColumns();
    List<ModelElementIndicator> meIndicatorList = new ArrayList<ModelElementIndicator>();
    ModelElementIndicator currentIndicator = null;
    for (ModelElement element : analyzedColumns) {
        TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
        // MOD qiongli 2011-1-10,16796:delimitefile
        MetadataColumn mdColumn = SwitchHelpers.METADATA_COLUMN_SWITCH.doSwitch(element);
        if (tdColumn == null && mdColumn == null) {
            continue;
        }
        // MOD qiongli TDQ-7052 if the node is filtered ,it will be return null,so should create a new node.
        RepositoryNode repNode = RepositoryNodeHelper.recursiveFind(element);
        if (repNode == null) {
            repNode = RepositoryNodeHelper.createRepositoryNode(element);
        }
        // MOD mzhao feature 15750, The column is recompute from the file, here create a new repository view object.
        if (tdColumn == null && mdColumn != null) {
            currentIndicator = ModelElementIndicatorHelper.createDFColumnIndicator(repNode);
        } else if (tdColumn != null) {
            currentIndicator = ModelElementIndicatorHelper.createModelElementIndicator(repNode);
        }
        DataminingType dataminingType = DataminingType.get(analysisHandler.getDatamingType(element));
        MetadataHelper.setDataminingType(dataminingType == null ? DataminingType.NOMINAL : dataminingType, element);
        Collection<Indicator> indicatorList = analysisHandler.getIndicators(element);
        if (currentIndicator != null) {
            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) TdColumn(org.talend.cwm.relational.TdColumn) ModelElementAnalysisHandler(org.talend.dq.analysis.ModelElementAnalysisHandler) ArrayList(java.util.ArrayList) RepositoryNode(org.talend.repository.model.RepositoryNode) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator) Indicator(org.talend.dataquality.indicators.Indicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 97 with Indicator

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

the class ColumnSetAnalysisDetailsPage method saveAnalysis.

/**
 * @param outputFolder
 * @throws DataprofilerCoreException
 */
@Override
public void saveAnalysis() throws DataprofilerCoreException {
    columnSetAnalysisHandler.changeDefaultRowLoaded(rowLoadedText.getText());
    columnSetAnalysisHandler.changeSampleDataShowWay(sampleDataShowWayCombo.getText());
    // columnSetAnalysisHandler.setName(columnSetAnalysisHandler.getName().replace(" ", ""));
    for (Domain domain : getCurrentModelElement().getParameters().getDataFilter()) {
        domain.setName(getCurrentModelElement().getName());
    }
    // ~
    columnSetAnalysisHandler.clearAnalysis();
    simpleStatIndicator.getAnalyzedColumns().clear();
    allMatchIndicator.getAnalyzedColumns().clear();
    // set execute engine
    Analysis analysis = columnSetAnalysisHandler.getAnalysis();
    analysis.getParameters().setExecutionLanguage(ExecutionLanguage.get(execLang));
    // set data filter
    columnSetAnalysisHandler.setStringDataFilter(dataFilterComp.getDataFilterString());
    // save analysis
    List<IRepositoryNode> repositoryNodes = treeViewer.getColumnSetMultiValueList();
    Connection tdProvider = null;
    IRepositoryViewObject reposObject = null;
    if (repositoryNodes != null && repositoryNodes.size() != 0) {
        ConnectionItem item = (ConnectionItem) repositoryNodes.get(0).getObject().getProperty().getItem();
        tdProvider = item.getConnection();
        if (tdProvider.eIsProxy()) {
            // Resolve the connection again
            tdProvider = (Connection) EObjectHelper.resolveObject(tdProvider);
        }
        analysis.getContext().setConnection(tdProvider);
        List<ModelElement> columnList = new ArrayList<ModelElement>();
        for (IRepositoryNode rd : repositoryNodes) {
            reposObject = rd.getObject();
            columnList.add(((MetadataColumnRepositoryObject) reposObject).getTdColumn());
        }
        simpleStatIndicator.getAnalyzedColumns().addAll(columnList);
        columnSetAnalysisHandler.addIndicator(columnList, simpleStatIndicator);
        // ~ MOD mzhao feature 13040. 2010-05-21
        allMatchIndicator.getCompositeRegexMatchingIndicators().clear();
        ModelElementIndicator[] modelElementIndicator = treeViewer.getModelElementIndicator();
        if (modelElementIndicator != null) {
            for (ModelElementIndicator modelElementInd : modelElementIndicator) {
                Indicator[] inds = modelElementInd.getPatternIndicators();
                for (Indicator ind : inds) {
                    if (ind instanceof RegexpMatchingIndicator) {
                        // MOD yyi 2011-06-15 22419:column set pattern for MDM
                        IRepositoryViewObject obj = modelElementInd.getModelElementRepositoryNode().getObject();
                        ModelElement analyzedElt = ((MetadataColumnRepositoryObject) obj).getTdColumn();
                        ind.setAnalyzedElement(analyzedElt);
                        allMatchIndicator.getCompositeRegexMatchingIndicators().add((RegexpMatchingIndicator) ind);
                    }
                }
            }
        }
        if (allMatchIndicator.getCompositeRegexMatchingIndicators().size() > 0) {
            allMatchIndicator.getAnalyzedColumns().addAll(columnList);
            columnSetAnalysisHandler.addIndicator(columnList, allMatchIndicator);
        }
    // ~
    } else {
        analysis.getContext().setConnection(null);
    }
    TaggedValueHelper.setTaggedValue(getCurrentModelElement(), TaggedValueHelper.IS_USE_SAMPLE_DATA, isRunWithSampleData.toString());
    // save the number of connections per analysis
    this.saveNumberOfConnectionsPerAnalysis();
    // 2011.1.12 MOD by zhsne to unify anlysis and connection id when saving.
    this.nameText.setText(columnSetAnalysisHandler.getName());
    // TDQ-5581,if has removed emlements(patten),should remove dependency each other before saving.
    // MOD yyi 2012-02-08 TDQ-4621:Explicitly set true for updating dependencies.
    ReturnCode saved = ElementWriterFactory.getInstance().createAnalysisWrite().save(getCurrentRepNode().getObject().getProperty().getItem(), true);
    // MOD yyi 2012-02-03 TDQ-3602:Avoid to rewriting all analyzes after saving, no reason to update all analyzes
    // which is depended in the referred connection.
    // Extract saving log function.
    // @see org.talend.dataprofiler.core.ui.editor.analysis.AbstractAnalysisMetadataPage#logSaved(ReturnCode)
    logSaved(saved);
    treeViewer.setDirty(false);
    dataFilterComp.setDirty(false);
}
Also used : ReturnCode(org.talend.utils.sugars.ReturnCode) IRepositoryNode(org.talend.repository.model.IRepositoryNode) ConnectionItem(org.talend.core.model.properties.ConnectionItem) FileConnection(org.talend.core.model.metadata.builder.connection.FileConnection) Connection(org.talend.core.model.metadata.builder.connection.Connection) ArrayList(java.util.ArrayList) 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) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) Analysis(org.talend.dataquality.analysis.Analysis) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) MetadataColumnRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject) Domain(org.talend.dataquality.domain.Domain) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator)

Example 98 with Indicator

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

the class ConnectionAnalysisDetailsPage method getCatalogIndicators.

@Override
public List<OverviewIndUIElement> getCatalogIndicators() {
    ConnectionIndicator conIndicator = (ConnectionIndicator) getCurrentModelElement().getResults().getIndicators().get(0);
    Connection analyzedElement = (Connection) conIndicator.getAnalyzedElement();
    EList<CatalogIndicator> catalogIndicators = conIndicator.getCatalogIndicators();
    List<OverviewIndUIElement> cataUIEleList = new ArrayList<OverviewIndUIElement>();
    RepositoryNode connNode = RepositoryNodeHelper.recursiveFind(analyzedElement);
    for (Indicator indicator : catalogIndicators) {
        if (connNode != null) {
            for (IRepositoryNode catalogNode : connNode.getChildren()) {
                Catalog catalog = ((MetadataCatalogRepositoryObject) catalogNode.getObject()).getCatalog();
                String connUuid = ResourceHelper.getUUID(catalog);
                String anaUuid = ResourceHelper.getUUID(indicator.getAnalyzedElement());
                if (connUuid.equals(anaUuid)) {
                    OverviewIndUIElement cataUIEle = new OverviewIndUIElement();
                    cataUIEle.setNode(catalogNode);
                    cataUIEle.setOverviewIndicator(indicator);
                    cataUIEleList.add(cataUIEle);
                    break;
                }
            }
        }
    }
    return cataUIEleList;
}
Also used : IRepositoryNode(org.talend.repository.model.IRepositoryNode) Connection(org.talend.core.model.metadata.builder.connection.Connection) CatalogIndicator(org.talend.dataquality.indicators.schema.CatalogIndicator) ArrayList(java.util.ArrayList) MetadataCatalogRepositoryObject(org.talend.core.repository.model.repositoryObject.MetadataCatalogRepositoryObject) IRepositoryNode(org.talend.repository.model.IRepositoryNode) RepositoryNode(org.talend.repository.model.RepositoryNode) 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) Catalog(orgomg.cwm.resource.relational.Catalog) OverviewIndUIElement(org.talend.dataprofiler.core.model.OverviewIndUIElement) ConnectionIndicator(org.talend.dataquality.indicators.schema.ConnectionIndicator)

Example 99 with Indicator

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

the class DynamicAnalysisMasterPage method registerDynamicEvent.

/**
 * Added TDQ-8787 20140613 yyin: create all charts before running, register each chart with its related indicator.
 */
public void registerDynamicEvent() {
    // only worked for the analysis which support dynamic chart
    // create all charts for related indicator in current page
    createDynamicChartsBeforeRun();
    // get all indicators and datasets
    List<DynamicIndicatorModel> indiAndDatasets = getDynamicDatasets();
    // register dynamic event,for the indicator (for each column)
    for (DynamicIndicatorModel oneCategoryIndicatorModel : indiAndDatasets) {
        if (EIndicatorChartType.SUMMARY_STATISTICS.equals(oneCategoryIndicatorModel.getChartType())) {
            // when all summary indicators are selected
            DynamicBAWChartEventReceiver bawReceiver = AnalysisUtils.createDynamicBAWChartEventReceiver(oneCategoryIndicatorModel, eventReceivers);
            bawReceiver.setChartComposite(chartComposite);
        // 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()) {
                // if the indicator is a frequency indicator, create a Frequency Event Receiver
                DynamicChartEventReceiver eReceiver = createEventReceiver(oneCategoryIndicatorModel, index++, oneIndicator);
                eReceiver.setChartComposite(chartComposite);
                // 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) Indicator(org.talend.dataquality.indicators.Indicator) DynamicBAWChartEventReceiver(org.talend.dataprofiler.core.ui.events.DynamicBAWChartEventReceiver)

Example 100 with Indicator

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

the class DynamicAnalysisMasterPage method unRegisterDynamicEvent.

/**
 * unregister every dynamic events which registered before executing analysis
 *
 * @param eventReceivers
 */
public void unRegisterDynamicEvent() {
    EventManager.getInstance().clearEvent(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);
    clearDynamicDatasets();
}
Also used : DynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver) Indicator(org.talend.dataquality.indicators.Indicator)

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