Search in sources :

Example 1 with ColumnIndicatorUnit

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

the class ModelElementIndicatorImpl method createTempSpecialIndicatorUnit.

private IndicatorUnit createTempSpecialIndicatorUnit(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(DefaultMessagesImpl.getString("ModelElementIndicatorImpl_COULDNOTSETDEF_GIVEN_IND0") + tempIndicator.getName());
        }
    }
    // }
    if (this.specialIndicatorUnitList == null) {
        this.specialIndicatorUnitList = new ArrayList<IndicatorUnit>();
    }
    for (IndicatorUnit currentUnit : tempSpecialIndicatorUnitList) {
        if (tempIndicator.getName().equalsIgnoreCase(currentUnit.getIndicator().getName())) {
            return currentUnit;
        }
    }
    IndicatorUnit indicatorUnit = new ColumnIndicatorUnit(indicatorEnum, tempIndicator, this);
    tempSpecialIndicatorUnitList.add(indicatorUnit);
    this.specialIndicatorUnitMap.put(tempIndicator.getName(), indicatorUnit);
    return indicatorUnit;
}
Also used : EFactoryImpl(org.eclipse.emf.ecore.impl.EFactoryImpl) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) 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 2 with ColumnIndicatorUnit

use of org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit 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 3 with ColumnIndicatorUnit

use of org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit 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 4 with ColumnIndicatorUnit

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

the class FrequencyDynamicChartEventReceiver method refreshChart.

@Override
public void refreshChart() {
    List<IndicatorUnit> indicatorUnits = new ArrayList<IndicatorUnit>();
    indicatorUnits.add(new ColumnIndicatorUnit(IndicatorEnum.findIndicatorEnum(this.getIndicator().eClass()), this.getIndicator(), null));
    // indicators
    FrequencyStatisticsState state = new FrequencyStatisticsState(indicatorUnits);
    state.setSupportDynamicChart(true);
    Object chart = state.getChart();
    TOPChartUtils.getInstance().decorateChart(chart, false);
    if (this.parentChartComposite != null) {
        TOPChartUtils.getInstance().refrechChart(this.parentChartComposite, chart);
    }
    EventManager.getInstance().publish(chartComposite, EventEnum.DQ_DYNAMIC_REFRESH_DYNAMIC_CHART, null);
}
Also used : ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit) IndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit) ArrayList(java.util.ArrayList) FrequencyStatisticsState(org.talend.dataprofiler.core.ui.editor.preview.model.states.freq.FrequencyStatisticsState) ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit)

Example 5 with ColumnIndicatorUnit

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

the class DynamicBAWChartEventReceiver method createEventReceiver.

public DynamicChartEventReceiver createEventReceiver(IndicatorEnum type, Indicator oneIndicator) {
    // the receiver for each summary indicator, just need to put the indicator name and its related value into the
    // map, and call the method which judge the total
    DynamicChartEventReceiver eReceiver = new DynamicChartEventReceiver() {

        @Override
        public boolean handle(Object value) {
            super.handle(value);
            addToSummaryMap(getIndicatorType(), value);
            if (isIntact()) {
                if (this.getTableViewer() != null) {
                    String str = value == null ? String.valueOf(Double.NaN) : String.valueOf(value);
                    this.refreshTable(str);
                    if (isLastIndicator()) {
                        // when current is last one indicator which Summary statistics indicators then update IQRIndicator and
                        // RangeIndicator
                        updateValueOfIRQAndRange();
                    }
                }
            } else {
                updateValueOfIRQAndRange();
            }
            return true;
        }
    };
    eReceiver.setIndicatorType(type);
    eReceiver.setIndicatorName(oneIndicator.getName());
    indicators.add(new ColumnIndicatorUnit(type, oneIndicator, null));
    if (IndicatorEnum.IQRIndicatorEnum.equals(type)) {
        this.IRQIndicator = oneIndicator;
        this.IRQIndicatorEvent = eReceiver;
    } else if (IndicatorEnum.RangeIndicatorEnum.equals(type)) {
        this.rangeIndicator = oneIndicator;
        this.rangeIndicatorEvent = eReceiver;
    }
    return eReceiver;
}
Also used : ColumnIndicatorUnit(org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit)

Aggregations

ColumnIndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.ColumnIndicatorUnit)7 IndicatorUnit (org.talend.dataprofiler.core.ui.editor.preview.IndicatorUnit)6 ModelElementIndicator (org.talend.dataprofiler.core.model.ModelElementIndicator)5 EFactoryImpl (org.eclipse.emf.ecore.impl.EFactoryImpl)3 AverageLengthIndicator (org.talend.dataquality.indicators.AverageLengthIndicator)3 AvgLengthWithBlankIndicator (org.talend.dataquality.indicators.AvgLengthWithBlankIndicator)3 AvgLengthWithBlankNullIndicator (org.talend.dataquality.indicators.AvgLengthWithBlankNullIndicator)3 AvgLengthWithNullIndicator (org.talend.dataquality.indicators.AvgLengthWithNullIndicator)3 BlankCountIndicator (org.talend.dataquality.indicators.BlankCountIndicator)3 BoxIndicator (org.talend.dataquality.indicators.BoxIndicator)3 CountsIndicator (org.talend.dataquality.indicators.CountsIndicator)3 DefValueCountIndicator (org.talend.dataquality.indicators.DefValueCountIndicator)3 DistinctCountIndicator (org.talend.dataquality.indicators.DistinctCountIndicator)3 DuplicateCountIndicator (org.talend.dataquality.indicators.DuplicateCountIndicator)3 FrequencyIndicator (org.talend.dataquality.indicators.FrequencyIndicator)3 IQRIndicator (org.talend.dataquality.indicators.IQRIndicator)3 Indicator (org.talend.dataquality.indicators.Indicator)3 InvalidRegCodeCountIndicator (org.talend.dataquality.indicators.InvalidRegCodeCountIndicator)3 LowerQuartileIndicator (org.talend.dataquality.indicators.LowerQuartileIndicator)3 MaxLengthIndicator (org.talend.dataquality.indicators.MaxLengthIndicator)3