Search in sources :

Example 6 with CompositeIndicator

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

the class CompositeIndicatorImpl method getAllChildIndicators.

/**
 * <!-- begin-user-doc --> <!-- end-user-doc -->
 *
 * @generated NOT getAllChildIndicators()
 */
public EList<Indicator> getAllChildIndicators() {
    EList<Indicator> allChildIndicators = new BasicEList<Indicator>();
    EList<Indicator> childIndicators = getChildIndicators();
    for (Indicator indicator : childIndicators) {
        if (indicator instanceof CompositeIndicator) {
            allChildIndicators.addAll(((CompositeIndicator) indicator).getAllChildIndicators());
        } else {
            allChildIndicators.add(indicator);
        }
    }
    return allChildIndicators;
}
Also used : BasicEList(org.eclipse.emf.common.util.BasicEList) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator)

Example 7 with CompositeIndicator

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

the class ColumnAnalysisSqlExecutor method runAnalysisIndicators.

/**
 * DOC xqliu Comment method "runAnalysisIndicators".
 *
 * @param connection
 * @param elementToIndicator
 * @param indicators
 * @return
 * @throws SQLException
 */
private boolean runAnalysisIndicators(Connection connection, Map<ModelElement, List<Indicator>> elementToIndicator, Collection<Indicator> indicators) throws SQLException {
    boolean runStatus = Boolean.TRUE;
    for (Indicator indicator : indicators) {
        // skip composite indicators that do not require a sql execution
        if (indicator instanceof CompositeIndicator) {
            // options of composite indicators are handled elsewhere
            continue;
        }
        // set the connection's catalog
        if (needChangeCatalog(connection)) {
            String catalogName = getCatalogOrSchemaName(indicator.getAnalyzedElement());
            if (catalogName != null) {
                // check whether null argument can be given
                changeCatalog(catalogName, connection);
            }
        }
        Expression query = dbms().getInstantiatedExpression(indicator);
        if (query == null || !executeQuery(indicator, connection, query.getBody())) {
            traceError(// $NON-NLS-1$//$NON-NLS-2$
            "Query not executed for indicator: \"" + AnalysisExecutorHelper.getIndicatorName(indicator) + "\" " + // $NON-NLS-1$//$NON-NLS-2$
            ((query == null) ? "query is null" : "SQL query: " + query.getBody()));
            runStatus = Boolean.FALSE;
        } else {
            // set computation done
            indicator.setComputed(true);
        }
        // add mapping of analyzed elements to their indicators
        addElements2IndicatorsMapping(elementToIndicator, indicator);
    }
    return runStatus;
}
Also used : TdExpression(org.talend.cwm.relational.TdExpression) Expression(orgomg.cwm.objectmodel.core.Expression) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) NullCountIndicator(org.talend.dataquality.indicators.NullCountIndicator) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator)

Example 8 with CompositeIndicator

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

the class SplitSysIndicatorTask method doExecute.

@Override
protected boolean doExecute() throws Exception {
    boolean ok = true;
    // Copy system indicators.
    DQStructureManager manager = DQStructureManager.getInstance();
    IFolder systemIndicatorFolder = ResourceManager.getSystemIndicatorFolder();
    if (!systemIndicatorFolder.exists()) {
        systemIndicatorFolder = manager.createNewFolder(ResourceManager.getIndicatorFolder(), EResourceConstant.SYSTEM_INDICATORS);
    }
    manager.copyFilesToFolder(CorePlugin.getDefault(), DQStructureManager.SYSTEM_INDICATOR_PATH, true, systemIndicatorFolder, null, true);
    DefinitionHandler.getInstance().reloadIndicatorsDefinitions();
    // Migration for analyses (indicator definition)
    Collection<Analysis> analyses = (Collection<Analysis>) AnaResourceFileHelper.getInstance().getAllElement();
    for (Analysis ana : analyses) {
        try {
            for (Indicator ind : ana.getResults().getIndicators()) {
                updateIndDefinition(ind);
                if (ind instanceof CompositeIndicator) {
                    for (Indicator indLeave : IndicatorHelper.getIndicatorLeavesBySingleNode(ind)) {
                        updateIndDefinition(indLeave);
                    }
                }
            }
            EMFSharedResources.getInstance().saveResource(ana.eResource());
        } catch (Exception e) {
            log.warn(e, e);
            ok = false;
        }
    }
    // MOD qiongli 2011-11-16 TDQ-3694,should relaod definitions and all categories after changing the definition
    // file.
    // Copy system indicator categories.
    IFile file = ResourceManager.getLibrariesFolder().getFile(DefinitionHandler.FILENAME);
    file.delete(true, new NullProgressMonitor());
    DefinitionHandler.getInstance().copyDefinitionsIntoFolder(ResourceManager.getLibrariesFolder());
    URI uri = URI.createPlatformResourceURI(file.getFullPath().toString(), false);
    EMFSharedResources.getInstance().reloadResource(uri);
    DefinitionHandler.getInstance().reloadIndicatorsDefinitions();
    return ok;
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IFile(org.eclipse.core.resources.IFile) DQStructureManager(org.talend.dataprofiler.core.manager.DQStructureManager) Analysis(org.talend.dataquality.analysis.Analysis) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) Collection(java.util.Collection) URI(org.eclipse.emf.common.util.URI) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator) IFolder(org.eclipse.core.resources.IFolder)

Example 9 with CompositeIndicator

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

the class IndicatorHelper method getIndicators.

/**
 * Method "getIndicators".
 *
 * @param result
 * @return
 */
public static List<Indicator> getIndicators(AnalysisResult result) {
    List<Indicator> indicators = new ArrayList<Indicator>();
    if (result != null) {
        EList<Indicator> indicators2 = result.getIndicators();
        if (indicators2 != null) {
            for (Indicator indicator : indicators2) {
                List<Indicator> indicatorLeaves = getIndicatorLeavesBySingleNode(indicator);
                if (indicator instanceof CompositeIndicator) {
                    indicators.add(indicator);
                }
                indicators.addAll(indicatorLeaves);
            }
        }
    }
    return indicators;
}
Also used : CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) ArrayList(java.util.ArrayList) UniqueCountIndicator(org.talend.dataquality.indicators.UniqueCountIndicator) MaxValueIndicator(org.talend.dataquality.indicators.MaxValueIndicator) ValidRegCodeCountIndicator(org.talend.dataquality.indicators.ValidRegCodeCountIndicator) PhoneNumbStatisticsIndicator(org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator) MinLengthIndicator(org.talend.dataquality.indicators.MinLengthIndicator) MinValueIndicator(org.talend.dataquality.indicators.MinValueIndicator) AverageLengthIndicator(org.talend.dataquality.indicators.AverageLengthIndicator) MeanIndicator(org.talend.dataquality.indicators.MeanIndicator) DefValueCountIndicator(org.talend.dataquality.indicators.DefValueCountIndicator) WellFormE164PhoneCountIndicator(org.talend.dataquality.indicators.WellFormE164PhoneCountIndicator) RangeIndicator(org.talend.dataquality.indicators.RangeIndicator) JavaUserDefIndicator(org.talend.dataquality.indicators.sql.JavaUserDefIndicator) ValueIndicator(org.talend.dataquality.indicators.ValueIndicator) InvalidRegCodeCountIndicator(org.talend.dataquality.indicators.InvalidRegCodeCountIndicator) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator) ValidPhoneCountIndicator(org.talend.dataquality.indicators.ValidPhoneCountIndicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) WellFormIntePhoneCountIndicator(org.talend.dataquality.indicators.WellFormIntePhoneCountIndicator) FormatFreqPieIndicator(org.talend.dataquality.indicators.FormatFreqPieIndicator) PossiblePhoneCountIndicator(org.talend.dataquality.indicators.PossiblePhoneCountIndicator) ModeIndicator(org.talend.dataquality.indicators.ModeIndicator) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) MaxLengthIndicator(org.talend.dataquality.indicators.MaxLengthIndicator) RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator) NullCountIndicator(org.talend.dataquality.indicators.NullCountIndicator) MedianIndicator(org.talend.dataquality.indicators.MedianIndicator) Indicator(org.talend.dataquality.indicators.Indicator) CompositeIndicator(org.talend.dataquality.indicators.CompositeIndicator) BlankCountIndicator(org.talend.dataquality.indicators.BlankCountIndicator) DistinctCountIndicator(org.talend.dataquality.indicators.DistinctCountIndicator) DuplicateCountIndicator(org.talend.dataquality.indicators.DuplicateCountIndicator) IQRIndicator(org.talend.dataquality.indicators.IQRIndicator) BoxIndicator(org.talend.dataquality.indicators.BoxIndicator) WellFormNationalPhoneCountIndicator(org.talend.dataquality.indicators.WellFormNationalPhoneCountIndicator) WhereRuleIndicator(org.talend.dataquality.indicators.sql.WhereRuleIndicator)

Aggregations

CompositeIndicator (org.talend.dataquality.indicators.CompositeIndicator)9 Indicator (org.talend.dataquality.indicators.Indicator)6 BasicEList (org.eclipse.emf.common.util.BasicEList)2 Tree (org.eclipse.swt.widgets.Tree)2 TreeItem (org.eclipse.swt.widgets.TreeItem)2 TooltipTree (org.talend.dataprofiler.core.ui.dialog.composite.TooltipTree)2 AbstractAnalysisActionHandler (org.talend.dataprofiler.core.ui.editor.AbstractAnalysisActionHandler)2 NullCountIndicator (org.talend.dataquality.indicators.NullCountIndicator)2 RowCountIndicator (org.talend.dataquality.indicators.RowCountIndicator)2 UserDefIndicator (org.talend.dataquality.indicators.sql.UserDefIndicator)2 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 IFile (org.eclipse.core.resources.IFile)1 IFolder (org.eclipse.core.resources.IFolder)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 URI (org.eclipse.emf.common.util.URI)1 TreeColumn (org.eclipse.swt.widgets.TreeColumn)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)1