Search in sources :

Example 46 with Indicator

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

the class FileSystemImportWriter method updatePatternInAnaParams.

/**
 * if there is a same name pattern in current workspace,update the pattern in imported analysis IndicatorParameters.
 *
 * @param systemSupplyModelElement
 * @param analysis
 */
private void updatePatternInAnaParams(ModelElement systemSupplyModelElement, Analysis analysis) {
    if (analysis.getResults() != null) {
        EList<Indicator> indicators = analysis.getResults().getIndicators();
        IndicatorParameters parameters = null;
        for (Indicator indicator : indicators) {
            // AllMatchIndicator is in column set analysis.
            if (indicator instanceof AllMatchIndicator) {
                EList<RegexpMatchingIndicator> list = ((AllMatchIndicator) indicator).getCompositeRegexMatchingIndicators();
                for (RegexpMatchingIndicator regMatchIndicator : list) {
                    parameters = regMatchIndicator.getParameters();
                    removOldAddSysPatternInAnaParams(parameters, (Pattern) systemSupplyModelElement, analysis);
                }
            } else if (indicator instanceof PatternMatchingIndicator) {
                parameters = ((PatternMatchingIndicator) indicator).getParameters();
                removOldAddSysPatternInAnaParams(parameters, (Pattern) systemSupplyModelElement, analysis);
            }
        }
    }
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) Indicator(org.talend.dataquality.indicators.Indicator) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator)

Example 47 with Indicator

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

the class ItemRecord method getSystemIndicaotrOfAnalysis.

/**
 * get Analysis Dependency (for indicator only).
 *
 * @return get the list of indicator which in use by the analysis
 */
private List<File> getSystemIndicaotrOfAnalysis(ModelElement mElement) {
    List<File> listFile = new ArrayList<File>();
    if (mElement instanceof Analysis) {
        Analysis anaElement = (Analysis) mElement;
        List<Indicator> indicators = IndicatorHelper.getIndicators(anaElement.getResults());
        for (Indicator indicator : indicators) {
            if (indicator instanceof UserDefIndicator) {
                // whereRuleIndicator or UDIIndicator
                continue;
            }
            boolean isContain = false;
            IndicatorDefinition newIndicatorDefinition = indicator.getIndicatorDefinition();
            // MOD qiongli 2012-5-11 TDQ-5256
            if (newIndicatorDefinition == null) {
                continue;
            }
            for (File lf : listFile) {
                ModelElement me = getElement(lf);
                if (me != null && me instanceof IndicatorDefinition) {
                    IndicatorDefinition oldIndicatorDefinition = (IndicatorDefinition) me;
                    if (ModelElementHelper.compareUUID(oldIndicatorDefinition, newIndicatorDefinition)) {
                        isContain = true;
                        break;
                    }
                }
            }
            if (!isContain) {
                File depFile = EObjectHelper.modelElement2File(newIndicatorDefinition);
                if (depFile != null) {
                    FILE_ELEMENT_MAP.put(depFile, newIndicatorDefinition);
                    listFile.add(depFile);
                }
            }
        }
    }
    return listFile;
}
Also used : ModelElement(orgomg.cwm.objectmodel.core.ModelElement) Analysis(org.talend.dataquality.analysis.Analysis) ArrayList(java.util.ArrayList) File(java.io.File) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator) UDIndicatorDefinition(org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator) RecordMatchingIndicator(org.talend.dataquality.indicators.columnset.RecordMatchingIndicator) Indicator(org.talend.dataquality.indicators.Indicator)

Example 48 with Indicator

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

the class AnalysisUtils method createDynamicBAWChartEventReceiver.

/**
 * DOC yyin Comment method "createDynamicBAWChartEventReceiver".
 *
 * @param oneCategoryIndicatorModel
 * @param categoryDataset
 * @return
 */
public static DynamicBAWChartEventReceiver createDynamicBAWChartEventReceiver(DynamicIndicatorModel oneCategoryIndicatorModel, Map<Indicator, EventReceiver> eventReceivers) {
    DynamicBAWChartEventReceiver bawReceiver = new DynamicBAWChartEventReceiver();
    Object categoryDataset = oneCategoryIndicatorModel.getDataset();
    if (categoryDataset instanceof CustomerDefaultBAWDataset) {
        // all summary selected
        bawReceiver.setBawDataset((CustomerDefaultBAWDataset) categoryDataset);
    } else {
        // not-all summary selected
        bawReceiver.setDataset(categoryDataset);
    }
    bawReceiver.setBAWparentComposite(oneCategoryIndicatorModel.getBawParentChartComp());
    bawReceiver.setTableViewer(oneCategoryIndicatorModel.getTableViewer());
    int index = 0;
    int length = oneCategoryIndicatorModel.getSummaryIndicators().size();
    for (Indicator oneIndicator : oneCategoryIndicatorModel.getSummaryIndicators()) {
        DynamicChartEventReceiver eReceiver = bawReceiver.createEventReceiver(IndicatorEnum.findIndicatorEnum(oneIndicator.eClass()), oneIndicator);
        eReceiver.setTableViewer(oneCategoryIndicatorModel.getTableViewer());
        eReceiver.setEntityIndex(index++);
        if (SummaryStatisticsState.FULL_FLAG != length) {
            eReceiver.setDataset(categoryDataset);
        }
        eReceiver.clearValue();
        eventReceivers.put(oneIndicator, eReceiver);
        EventManager.getInstance().register(oneIndicator, EventEnum.DQ_DYMANIC_CHART, eReceiver);
    }
    bawReceiver.clearValue();
    return bawReceiver;
}
Also used : DynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.DynamicChartEventReceiver) BenfordFrequencyDynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.BenfordFrequencyDynamicChartEventReceiver) PatternDynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.PatternDynamicChartEventReceiver) FrequencyDynamicChartEventReceiver(org.talend.dataprofiler.core.ui.events.FrequencyDynamicChartEventReceiver) CustomerDefaultBAWDataset(org.talend.dataprofiler.core.ui.editor.preview.model.dataset.CustomerDefaultBAWDataset) Indicator(org.talend.dataquality.indicators.Indicator) DynamicBAWChartEventReceiver(org.talend.dataprofiler.core.ui.events.DynamicBAWChartEventReceiver)

Example 49 with Indicator

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

the class FileSystemImportWriter method updateAnalysisClientDependence.

/**
 * remove the old client dependency add a new one in Anlaysis.
 *
 * @param supplierItem
 * @param modelElement
 * @throws PersistenceException
 */
private void updateAnalysisClientDependence(TDQItem supplierItem, Property property) throws PersistenceException {
    ModelElement anaModelElement = PropertyHelper.getModelElement(property);
    if (anaModelElement != null) {
        Analysis analysis = (Analysis) anaModelElement;
        EList<Dependency> clientDependency = anaModelElement.getClientDependency();
        Iterator<Dependency> it = clientDependency.iterator();
        ModelElement supplierModelElement = RepositoryNodeHelper.getResourceModelElement(supplierItem);
        Resource supModeResource = supplierModelElement.eResource();
        while (it.hasNext()) {
            Dependency clientDep = it.next();
            // systemSupplyModelElement,remove it.
            if (clientDep.eResource() == null) {
                URI clientDepURI = ((InternalEObject) clientDep).eProxyURI();
                boolean isUDI = clientDepURI.path().contains(ResourceManager.getUDIFolder().getProjectRelativePath().toString());
                boolean isPattern = clientDepURI.path().contains(ResourceManager.getPatternFolder().getProjectRelativePath().toString());
                if (supModeResource != null && (isUDI || isPattern) && clientDepURI.lastSegment().equals(supModeResource.getURI().lastSegment())) {
                    it.remove();
                    break;
                }
            }
        }
        DependenciesHandler.getInstance().setUsageDependencyOn(anaModelElement, supplierModelElement);
        // TDQ-8436 remove the old pattern and add the new pattern in analysis Indicator Parameters.
        if (isPattern(supplierModelElement)) {
            updatePatternInAnaParams(supplierModelElement, analysis);
            ElementWriterFactory.getInstance().createPatternWriter().save(supplierItem, true);
        }
        // remove old udi and set a new one in the analysis indicators.
        if (supplierModelElement instanceof UDIndicatorDefinition) {
            if (analysis.getResults() != null) {
                EList<Indicator> indicators = analysis.getResults().getIndicators();
                Iterator<Indicator> itIndicators = indicators.iterator();
                while (itIndicators.hasNext()) {
                    Indicator indicator = itIndicators.next();
                    IndicatorDefinition indicatorDefinition = indicator.getIndicatorDefinition();
                    if (indicatorDefinition.eResource() == null) {
                        URI indicatorDefURI = ((InternalEObject) indicatorDefinition).eProxyURI();
                        if (supModeResource != null && UDIHelper.isUDI(indicator) && indicatorDefURI.lastSegment().equals(supModeResource.getURI().lastSegment())) {
                            indicator.setIndicatorDefinition((UDIndicatorDefinition) supplierModelElement);
                            break;
                        }
                    }
                }
                ElementWriterFactory.getInstance().createIndicatorDefinitionWriter().save(supplierItem, true);
            }
        }
        // only save analysis item at here.
        ProxyRepositoryFactory.getInstance().save(property.getItem(), true);
    }
}
Also used : UDIndicatorDefinition(org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition) Resource(org.eclipse.emf.ecore.resource.Resource) Dependency(orgomg.cwm.objectmodel.core.Dependency) URI(org.eclipse.emf.common.util.URI) UDIndicatorDefinition(org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition) IndicatorDefinition(org.talend.dataquality.indicators.definition.IndicatorDefinition) Indicator(org.talend.dataquality.indicators.Indicator) RegexpMatchingIndicator(org.talend.dataquality.indicators.RegexpMatchingIndicator) AllMatchIndicator(org.talend.dataquality.indicators.columnset.AllMatchIndicator) PatternMatchingIndicator(org.talend.dataquality.indicators.PatternMatchingIndicator) ModelElement(orgomg.cwm.objectmodel.core.ModelElement) Analysis(org.talend.dataquality.analysis.Analysis) InternalEObject(org.eclipse.emf.ecore.InternalEObject)

Example 50 with Indicator

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

the class DrillDownUtils method createDrillDownMenuForMapDB.

public static void createDrillDownMenuForMapDB(final ChartDataEntity dataEntity, Menu menu, MenuItemEntity[] itemEntities, final Analysis analysis) {
    final Indicator indicator = dataEntity != null ? dataEntity.getIndicator() : null;
    if (dataEntity == null || indicator == null) {
        return;
    }
    createDrillDownMenu(dataEntity, menu, itemEntities, analysis);
}
Also used : FrequencyIndicator(org.talend.dataquality.indicators.FrequencyIndicator) LengthIndicator(org.talend.dataquality.indicators.LengthIndicator) SimpleStatIndicator(org.talend.dataquality.indicators.columnset.SimpleStatIndicator) 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