Search in sources :

Example 6 with IndicatorUnit

use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.

the class ModelElementIndicatorImpl method removeSpecialIndicatorUnit.

/**
 * Remove the specialIndicatorUnit from specialIndicatorList, if there exist more than one InicatorIndicator which
 * has same IndicatorEnumn type, the type of IndicatorUnit will be not removed from flatIndicatorEnumList.
 *
 * @param indicatorUnit
 */
private void removeSpecialIndicatorUnit(IndicatorUnit indicatorUnit) {
    IndicatorEnum indicatorEnumn = indicatorUnit.getType();
    this.specialIndicatorUnitList.remove(indicatorUnit);
    for (IndicatorUnit unit : specialIndicatorUnitList) {
        if (unit.getType() == indicatorEnumn) {
            return;
        } else {
            continue;
        }
    }
    this.flatIndicatorEnumList.remove(indicatorEnumn);
}
Also used : IndicatorEnum(org.talend.dq.nodes.indicator.type.IndicatorEnum) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit)

Example 7 with IndicatorUnit

use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.

the class ModelElementIndicatorImpl method createPlainIndicatorUnit.

/**
 * Create a new IndicatorUnit according to indicatorEnum and indicator, if the parameter indicator is null, will
 * create a new indicator .
 *
 * @param indicatorEnum
 * @param indicator
 * @return
 */
private IndicatorUnit createPlainIndicatorUnit(IndicatorEnum indicatorEnum, Indicator indicator) {
    Indicator tempIndicator = indicator;
    if (tempIndicator == null) {
        EFactoryImpl factory = (EFactoryImpl) indicatorEnum.getIndicatorType().getEPackage().getEFactoryInstance();
        tempIndicator = (Indicator) factory.create(indicatorEnum.getIndicatorType());
        // MOD scorreia 2008-09-18: bug 5131 fixed: set indicator's definition when the indicator is created.
        if (!DefinitionHandler.getInstance().setDefaultIndicatorDefinition(tempIndicator)) {
            // $NON-NLS-1$
            log.error("Could not set the definition of the given indicator :" + tempIndicator.getName());
        }
        // for 4225, the frequency indicator need be initialized
        int sqlType = getJavaType();
        if (tempIndicator instanceof FrequencyIndicator && Java2SqlType.isDateInSQL(sqlType)) {
            IndicatorParameters parameters = tempIndicator.getParameters();
            if (parameters == null) {
                parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
                tempIndicator.setParameters(parameters);
            }
            DateParameters dateParameters = parameters.getDateParameters();
            // "Year Frequency Table" when applying on "Time" type
            if (dateParameters == null && !(indicatorEnum == IndicatorEnum.PatternFreqIndicatorEnum || indicatorEnum == IndicatorEnum.PatternLowFreqIndicatorEnum || indicatorEnum == IndicatorEnum.FrequencyIndicatorEnum || indicatorEnum == IndicatorEnum.LowFrequencyIndicatorEnum)) {
                dateParameters = IndicatorsFactory.eINSTANCE.createDateParameters();
                parameters.setDateParameters(dateParameters);
            }
        // TDQ-5357~
        // MOD scorreia 2008-06-19 default is already set in the model
        // dateParameters.setDateAggregationType(DateGrain.YEAR);
        }
    }
    IndicatorUnit indicatorUnit = new ColumnIndicatorUnit(indicatorEnum, tempIndicator, this);
    this.plainIndicatorUnitMap.put(indicatorEnum, indicatorUnit);
    return indicatorUnit;
}
Also used : EFactoryImpl(org.eclipse.emf.ecore.impl.EFactoryImpl) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) DateParameters(org.talend.dataquality.indicators.DateParameters) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) UniqueCountIndicator(org.talend.dataquality.indicators.UniqueCountIndicator) AvgLengthWithBlankIndicator(org.talend.dataquality.indicators.AvgLengthWithBlankIndicator) FrequencyIndicator(org.talend.dataquality.indicators.FrequencyIndicator) MaxValueIndicator(org.talend.dataquality.indicators.MaxValueIndicator) MaxLengthWithBlankNullIndicator(org.talend.dataquality.indicators.MaxLengthWithBlankNullIndicator) ValidRegCodeCountIndicator(org.talend.dataquality.indicators.ValidRegCodeCountIndicator) PhoneNumbStatisticsIndicator(org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator) AvgLengthWithBlankNullIndicator(org.talend.dataquality.indicators.AvgLengthWithBlankNullIndicator) MinLengthIndicator(org.talend.dataquality.indicators.MinLengthIndicator) MinValueIndicator(org.talend.dataquality.indicators.MinValueIndicator) LowerQuartileIndicator(org.talend.dataquality.indicators.LowerQuartileIndicator) AverageLengthIndicator(org.talend.dataquality.indicators.AverageLengthIndicator) MaxLengthWithBlankIndicator(org.talend.dataquality.indicators.MaxLengthWithBlankIndicator) MeanIndicator(org.talend.dataquality.indicators.MeanIndicator) DefValueCountIndicator(org.talend.dataquality.indicators.DefValueCountIndicator) WellFormE164PhoneCountIndicator(org.talend.dataquality.indicators.WellFormE164PhoneCountIndicator) RangeIndicator(org.talend.dataquality.indicators.RangeIndicator) AvgLengthWithNullIndicator(org.talend.dataquality.indicators.AvgLengthWithNullIndicator) MaxLengthWithNullIndicator(org.talend.dataquality.indicators.MaxLengthWithNullIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) InvalidRegCodeCountIndicator(org.talend.dataquality.indicators.InvalidRegCodeCountIndicator) UpperQuartileIndicator(org.talend.dataquality.indicators.UpperQuartileIndicator) ValidPhoneCountIndicator(org.talend.dataquality.indicators.ValidPhoneCountIndicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) PossiblePhoneCountIndicator(org.talend.dataquality.indicators.PossiblePhoneCountIndicator) MaxLengthIndicator(org.talend.dataquality.indicators.MaxLengthIndicator) CountsIndicator(org.talend.dataquality.indicators.CountsIndicator) MinLengthWithBlankNullIndicator(org.talend.dataquality.indicators.MinLengthWithBlankNullIndicator) NullCountIndicator(org.talend.dataquality.indicators.NullCountIndicator) MedianIndicator(org.talend.dataquality.indicators.MedianIndicator) Indicator(org.talend.dataquality.indicators.Indicator) BlankCountIndicator(org.talend.dataquality.indicators.BlankCountIndicator) TextIndicator(org.talend.dataquality.indicators.TextIndicator) DistinctCountIndicator(org.talend.dataquality.indicators.DistinctCountIndicator) DuplicateCountIndicator(org.talend.dataquality.indicators.DuplicateCountIndicator) IQRIndicator(org.talend.dataquality.indicators.IQRIndicator) MinLengthWithBlankIndicator(org.talend.dataquality.indicators.MinLengthWithBlankIndicator) MinLengthWithNullIndicator(org.talend.dataquality.indicators.MinLengthWithNullIndicator) BoxIndicator(org.talend.dataquality.indicators.BoxIndicator) FrequencyIndicator(org.talend.dataquality.indicators.FrequencyIndicator)

Example 8 with IndicatorUnit

use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.

the class ModelElementIndicatorImpl method getIndicators.

public Indicator[] getIndicators() {
    List<Indicator> indicatorList = new ArrayList<Indicator>();
    IndicatorUnit[] indicatorUnits = this.getIndicatorUnits();
    for (IndicatorUnit indicatorUnit : indicatorUnits) {
        indicatorList.add(indicatorUnit.getIndicator());
    }
    return indicatorList.toArray(new Indicator[indicatorList.size()]);
}
Also used : ArrayList(java.util.ArrayList) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) UniqueCountIndicator(org.talend.dataquality.indicators.UniqueCountIndicator) AvgLengthWithBlankIndicator(org.talend.dataquality.indicators.AvgLengthWithBlankIndicator) FrequencyIndicator(org.talend.dataquality.indicators.FrequencyIndicator) MaxValueIndicator(org.talend.dataquality.indicators.MaxValueIndicator) MaxLengthWithBlankNullIndicator(org.talend.dataquality.indicators.MaxLengthWithBlankNullIndicator) ValidRegCodeCountIndicator(org.talend.dataquality.indicators.ValidRegCodeCountIndicator) PhoneNumbStatisticsIndicator(org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator) AvgLengthWithBlankNullIndicator(org.talend.dataquality.indicators.AvgLengthWithBlankNullIndicator) MinLengthIndicator(org.talend.dataquality.indicators.MinLengthIndicator) MinValueIndicator(org.talend.dataquality.indicators.MinValueIndicator) LowerQuartileIndicator(org.talend.dataquality.indicators.LowerQuartileIndicator) AverageLengthIndicator(org.talend.dataquality.indicators.AverageLengthIndicator) MaxLengthWithBlankIndicator(org.talend.dataquality.indicators.MaxLengthWithBlankIndicator) MeanIndicator(org.talend.dataquality.indicators.MeanIndicator) DefValueCountIndicator(org.talend.dataquality.indicators.DefValueCountIndicator) WellFormE164PhoneCountIndicator(org.talend.dataquality.indicators.WellFormE164PhoneCountIndicator) RangeIndicator(org.talend.dataquality.indicators.RangeIndicator) AvgLengthWithNullIndicator(org.talend.dataquality.indicators.AvgLengthWithNullIndicator) MaxLengthWithNullIndicator(org.talend.dataquality.indicators.MaxLengthWithNullIndicator) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) InvalidRegCodeCountIndicator(org.talend.dataquality.indicators.InvalidRegCodeCountIndicator) UpperQuartileIndicator(org.talend.dataquality.indicators.UpperQuartileIndicator) ValidPhoneCountIndicator(org.talend.dataquality.indicators.ValidPhoneCountIndicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) PossiblePhoneCountIndicator(org.talend.dataquality.indicators.PossiblePhoneCountIndicator) MaxLengthIndicator(org.talend.dataquality.indicators.MaxLengthIndicator) CountsIndicator(org.talend.dataquality.indicators.CountsIndicator) MinLengthWithBlankNullIndicator(org.talend.dataquality.indicators.MinLengthWithBlankNullIndicator) NullCountIndicator(org.talend.dataquality.indicators.NullCountIndicator) MedianIndicator(org.talend.dataquality.indicators.MedianIndicator) Indicator(org.talend.dataquality.indicators.Indicator) BlankCountIndicator(org.talend.dataquality.indicators.BlankCountIndicator) TextIndicator(org.talend.dataquality.indicators.TextIndicator) DistinctCountIndicator(org.talend.dataquality.indicators.DistinctCountIndicator) DuplicateCountIndicator(org.talend.dataquality.indicators.DuplicateCountIndicator) IQRIndicator(org.talend.dataquality.indicators.IQRIndicator) MinLengthWithBlankIndicator(org.talend.dataquality.indicators.MinLengthWithBlankIndicator) MinLengthWithNullIndicator(org.talend.dataquality.indicators.MinLengthWithNullIndicator) BoxIndicator(org.talend.dataquality.indicators.BoxIndicator)

Example 9 with IndicatorUnit

use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.

the class BenfordLawFrequencyStateTest method setUp.

/**
 * init the state.
 *
 * @throws java.lang.Exception
 */
@Before
public void setUp() throws Exception {
    UnitTestBuildHelper.initProjectStructure();
    List<IndicatorUnit> units = new ArrayList<IndicatorUnit>();
    BenfordLawFrequencyIndicator benfordLawFrequencyIndicator = IndicatorsFactory.eINSTANCE.createBenfordLawFrequencyIndicator();
    List<IRepositoryViewObject> all = ProxyRepositoryFactory.getInstance().getAll(ERepositoryObjectType.SYSTEM_INDICATORS_FRAUDDETECTION);
    Assert.assertEquals(1, all.size());
    IRepositoryViewObject iRepositoryViewObject = all.get(0);
    Assert.assertNotNull(iRepositoryViewObject);
    TDQIndicatorDefinitionItem benfordItem = (TDQIndicatorDefinitionItem) iRepositoryViewObject.getProperty().getItem();
    benfordLawFrequencyIndicator.setIndicatorDefinition(benfordItem.getIndicatorDefinition());
    ModelElementIndicator modelElementIndicator = UnitTestBuildHelper.createModelElementIndicator();
    ColumnIndicatorUnit columnIndicatorUnit = new ColumnIndicatorUnit(IndicatorEnum.BenfordLawFrequencyIndicatorEnum, benfordLawFrequencyIndicator, modelElementIndicator);
    // IndicatorUnit unit = mock(IndicatorUnit.class);
    units.add(columnIndicatorUnit);
    for (int i = 0; i < 10; i++) {
        benfordLawFrequencyIndicator.handle(i);
    }
    benState = new BenfordLawFrequencyState(units);
}
Also used : TDQIndicatorDefinitionItem(org.talend.dataquality.properties.TDQIndicatorDefinitionItem) BenfordLawFrequencyIndicator(org.talend.dataquality.indicators.BenfordLawFrequencyIndicator) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ArrayList(java.util.ArrayList) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) ModelElementIndicator(org.talend.dataprofiler.core.model.ModelElementIndicator) Before(org.junit.Before)

Example 10 with IndicatorUnit

use of org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit in project tdq-studio-se by Talend.

the class AbstractColumnDropTree method openIndicatorOptionDialog.

/**
 * open Indicator Option Dialog.
 *
 * @param shell
 * @param indicatorItem
 * @return
 */
public boolean openIndicatorOptionDialog(Shell shell, TreeItem indicatorItem) {
    IndicatorUnit indicatorUnit = (IndicatorUnit) indicatorItem.getData(INDICATOR_UNIT_KEY);
    if (FormEnum.isExsitingForm(indicatorUnit)) {
        IndicatorOptionsWizard wizard = new IndicatorOptionsWizard(indicatorUnit);
        String href = FormEnum.getFirstFormHelpHref(indicatorUnit);
        OpeningHelpWizardDialog optionDialog = new OpeningHelpWizardDialog(shell, wizard, href);
        if (Window.OK == optionDialog.open()) {
            setDirty(wizard.isDirty());
            return hasIndicatorParameters(indicatorUnit);
        }
    } else {
        openNoIndicatorOptionsMessageDialog(shell);
    }
    return false;
}
Also used : IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) OpeningHelpWizardDialog(org.talend.dataprofiler.core.ui.utils.OpeningHelpWizardDialog) IndicatorOptionsWizard(org.talend.dataprofiler.core.ui.wizard.indicator.IndicatorOptionsWizard)

Aggregations

IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)54 ArrayList (java.util.ArrayList)24 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)17 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)17 ColumnIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit)13 CustomerDefaultCategoryDataset (org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset)10 TreeItem (org.eclipse.swt.widgets.TreeItem)9 Indicator (org.talend.dataquality.indicators.Indicator)9 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)7 FrequencyExt (org.talend.dq.indicators.ext.FrequencyExt)7 BoxIndicator (org.talend.dataquality.indicators.BoxIndicator)5 CountsIndicator (org.talend.dataquality.indicators.CountsIndicator)5 IQRIndicator (org.talend.dataquality.indicators.IQRIndicator)5 PhoneNumbStatisticsIndicator (org.talend.dataquality.indicators.PhoneNumbStatisticsIndicator)5 IRepositoryNode (org.talend.repository.model.IRepositoryNode)5 MetadataColumnRepositoryObject (org.talend.core.repository.model.repositoryObject.MetadataColumnRepositoryObject)4 ColumnSetIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.ColumnSetIndicatorUnit)4 IndicatorEnum (org.talend.dq.nodes.indicator.type.IndicatorEnum)4 IChartTypeStates (org.talend.dataprofiler.core.ui.editor.preview.model.states.IChartTypeStates)3 AverageLengthIndicator (org.talend.dataquality.indicators.AverageLengthIndicator)3