Search in sources :

Example 26 with IndicatorParameters

use of org.talend.dataquality.indicators.IndicatorParameters 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 27 with IndicatorParameters

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

the class DynamicTableIndicatorOptionsPage method createForm.

public AbstractIndicatorForm[] createForm(Composite parent, ICheckListener listener, FormEnum[] formTypes) {
    IndicatorParameters parameters = indicatorUnit.getIndicator().getParameters();
    if (parameters == null) {
        parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
        indicatorUnit.getIndicator().setParameters(parameters);
    }
    AbstractIndicatorForm[] froms = new AbstractIndicatorForm[formTypes.length];
    for (int i = 0; i < formTypes.length; i++) {
        AbstractIndicatorForm form = IndicatorFormFactory.createForm(parent, formTypes[i], parameters);
        form.setListener(listener);
        froms[i] = form;
    }
    return froms;
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) AbstractIndicatorForm(org.talend.dataprofiler.core.ui.wizard.indicator.forms.AbstractIndicatorForm)

Example 28 with IndicatorParameters

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

the class FrequencyDynamicChartEventReceiver method setFrequecyToDataset.

private void setFrequecyToDataset(Object customerdataset, FrequencyExt[] frequencyExt, Indicator indicator) {
    int numOfShown = frequencyExt.length;
    IndicatorParameters parameters = indicator.getParameters();
    if (parameters != null) {
        if (parameters.getTopN() < numOfShown) {
            numOfShown = parameters.getTopN();
        }
    }
    FrequencyExt[] tempFreq = handleFrequency(frequencyExt);
    clearDataEntity(customerdataset);
    boolean withRowCountIndicator = FrequencyTypeStateUtil.isWithRowCountIndicator(indicator);
    // Added TDQ-12870
    List columnKeys = TOPChartUtils.getInstance().getColumnKeys(customerdataset);
    FrequencyExt freqE = tempFreq[0];
    if (!columnKeys.contains(String.valueOf(freqE.getKey()))) {
        // columnKeys.clear();
        TOPChartUtils.getInstance().clearDataset(customerdataset);
        ICustomerDataset customerDataset = TOPChartUtils.getInstance().getCustomerDataset(customerdataset);
        if (customerDataset != null && customerDataset instanceof CustomerDefaultCategoryDataset) {
            ((CustomerDefaultCategoryDataset) customerDataset).clearAll();
        }
    }
    for (int i = 0; i < numOfShown; i++) {
        FrequencyExt freqExt = tempFreq[i];
        String keyLabel = String.valueOf(freqExt.getKey());
        if ("null".equals(keyLabel)) {
            // $NON-NLS-1$
            keyLabel = SpecialValueDisplay.NULL_FIELD;
        }
        if ("".equals(keyLabel)) {
            // $NON-NLS-1$
            keyLabel = SpecialValueDisplay.EMPTY_FIELD;
        }
        ChartDataEntity entity = FrequencyTypeStateUtil.createChartEntity(indicator, freqExt, keyLabel, withRowCountIndicator);
        if (customerdataset instanceof CustomerDefaultCategoryDataset) {
            ((CustomerDefaultCategoryDataset) customerdataset).addDataEntity(entity);
            addValueToDataset(((CustomerDefaultCategoryDataset) customerdataset).getDataset(), freqExt, keyLabel);
        } else {
            ICustomerDataset customerDataset = TOPChartUtils.getInstance().getCustomerDataset(customerdataset);
            if (customerDataset != null && customerDataset instanceof CustomerDefaultCategoryDataset) {
                customerDataset.addDataEntity(entity);
                addValueToDataset(((CustomerDefaultCategoryDataset) customerDataset).getDataset(), freqExt, keyLabel);
            }
        }
    }
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) ArrayList(java.util.ArrayList) List(java.util.List) ChartDataEntity(org.talend.dq.indicators.preview.table.ChartDataEntity) FrequencyExt(org.talend.dq.indicators.ext.FrequencyExt) CustomerDefaultCategoryDataset(org.talend.dataprofiler.common.ui.editor.preview.CustomerDefaultCategoryDataset) ICustomerDataset(org.talend.dataprofiler.common.ui.editor.preview.ICustomerDataset)

Example 29 with IndicatorParameters

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

the class PieStatisticsStateUtil method getNumberOfShown.

/**
 * DOC yyin Comment method "getNumberOfShown".
 *
 * @param unit
 * @param frequencyExt
 * @return
 */
public static int getNumberOfShown(IndicatorUnit unit, FrequencyExt[] frequencyExt) {
    int numOfShown = frequencyExt.length;
    IndicatorParameters parameters = unit.getIndicator().getParameters();
    if (parameters != null) {
        if (parameters.getTopN() < numOfShown) {
            numOfShown = parameters.getTopN();
        }
    }
    return numOfShown;
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters)

Example 30 with IndicatorParameters

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

the class PatternNode method createNewIndicatorInstance.

/*
     * (non-Javadoc)
     * 
     * @see org.talend.dq.nodes.indicator.IIndicatorNode#createNewIndicatorInstance()
     */
@Override
public Indicator createNewIndicatorInstance() {
    Indicator patternIndicatorInstance = super.createNewIndicatorInstance();
    IndicatorParameters createIndicatorParameter = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
    Domain createDomain = DomainFactory.eINSTANCE.createDomain();
    createDomain.getPatterns().add(pattern);
    createIndicatorParameter.setDataValidDomain(createDomain);
    patternIndicatorInstance.setParameters(createIndicatorParameter);
    return patternIndicatorInstance;
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) Domain(org.talend.dataquality.domain.Domain) Indicator(org.talend.dataquality.indicators.Indicator)

Aggregations

IndicatorParameters (org.talend.dataquality.indicators.IndicatorParameters)65 Domain (org.talend.dataquality.domain.Domain)27 DateParameters (org.talend.dataquality.indicators.DateParameters)15 Test (org.junit.Test)14 TdColumn (org.talend.cwm.relational.TdColumn)14 Pattern (org.talend.dataquality.domain.pattern.Pattern)14 TdExpression (org.talend.cwm.relational.TdExpression)13 TextParameters (org.talend.dataquality.indicators.TextParameters)12 RegularExpression (org.talend.dataquality.domain.pattern.RegularExpression)10 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)10 Indicator (org.talend.dataquality.indicators.Indicator)9 ArrayList (java.util.ArrayList)8 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)8 Expression (orgomg.cwm.objectmodel.core.Expression)8 RegexpMatchingIndicator (org.talend.dataquality.indicators.RegexpMatchingIndicator)7 UserDefIndicator (org.talend.dataquality.indicators.sql.UserDefIndicator)7 PhoneNumberUtil (com.google.i18n.phonenumbers.PhoneNumberUtil)6 PhoneNumber (com.google.i18n.phonenumbers.Phonenumber.PhoneNumber)6 Analysis (org.talend.dataquality.analysis.Analysis)6 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)6