Search in sources :

Example 6 with IndicatorParameters

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

the class QuarterLowFrequencyIndicatorImpl method getParameters.

@Override
public IndicatorParameters getParameters() {
    IndicatorParameters parameters = super.getParameters();
    if (parameters == null) {
        parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
    }
    DateParameters dateParameters = parameters.getDateParameters();
    if (dateParameters == null) {
        dateParameters = IndicatorsFactory.eINSTANCE.createDateParameters();
    }
    dateParameters.setDateAggregationType(DateGrain.QUARTER);
    parameters.setDateParameters(dateParameters);
    this.setParameters(parameters);
    return parameters;
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) DateParameters(org.talend.dataquality.indicators.DateParameters)

Example 7 with IndicatorParameters

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

the class FormatFreqPieIndicatorImpl method handle.

@Override
public boolean handle(Object data) {
    count++;
    boolean isInvalidForm = false;
    try {
        if (data == null || data.toString().trim().equals(PluginConstant.EMPTY_STRING)) {
            isInvalidForm = true;
        } else {
            PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
            IndicatorParameters indParameters = this.getParameters();
            TextParameters textParameters = indParameters == null ? null : indParameters.getTextParameter();
            String country = IndicatorHelper.getCountryCodeByParameter(textParameters);
            PhoneNumber phoneNumeber = phoneUtil.parse(data.toString(), country);
            // MOD msjian TDQ-7603 2013-7-19: with the Standard value to compare
            String format_E164 = phoneUtil.format(phoneNumeber, PhoneNumberFormat.E164);
            String format_inter = phoneUtil.format(phoneNumeber, PhoneNumberFormat.INTERNATIONAL);
            String format_national = phoneUtil.format(phoneNumeber, PhoneNumberFormat.NATIONAL);
            if (data.toString().equals(format_E164)) {
                this.mustStoreRow = checkMustStoreCurrentRow(wellFormE164Count);
                wellFormE164Count++;
                setCurrentKey(WELL_FORM_E164_KEY);
            } else if (data.toString().equals(format_inter)) {
                this.mustStoreRow = checkMustStoreCurrentRow(wellFormInteCount);
                wellFormInteCount++;
                setCurrentKey(WELL_FORM_INTE_KEY);
            } else if (data.toString().equals(format_national)) {
                this.mustStoreRow = checkMustStoreCurrentRow(wellFormNatiCount);
                wellFormNatiCount++;
                setCurrentKey(WELL_FORM_NATI_KEY);
            } else {
                isInvalidForm = true;
            }
        // TDQ-7603~
        }
    } catch (Exception e) {
        isInvalidForm = true;
    }
    if (isInvalidForm) {
        this.mustStoreRow = checkMustStoreCurrentRow(invalidFormCount);
        invalidFormCount++;
        setCurrentKey(INVALID_FORM_KEY);
    }
    return true;
}
Also used : TextParameters(org.talend.dataquality.indicators.TextParameters) PhoneNumberUtil(com.google.i18n.phonenumbers.PhoneNumberUtil) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) PhoneNumber(com.google.i18n.phonenumbers.Phonenumber.PhoneNumber)

Example 8 with IndicatorParameters

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

the class MonthFrequencyIndicatorImpl method getParameters.

@Override
public IndicatorParameters getParameters() {
    IndicatorParameters parameters = super.getParameters();
    if (parameters == null) {
        parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
    }
    DateParameters dateParameters = parameters.getDateParameters();
    if (dateParameters == null) {
        dateParameters = IndicatorsFactory.eINSTANCE.createDateParameters();
    }
    dateParameters.setDateAggregationType(DateGrain.MONTH);
    parameters.setDateParameters(dateParameters);
    this.setParameters(parameters);
    return parameters;
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) DateParameters(org.talend.dataquality.indicators.DateParameters)

Example 9 with IndicatorParameters

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

the class WellFormIntePhoneCountIndicatorImpl method handle.

@Override
public boolean handle(Object data) {
    super.handle(data);
    if (data == null) {
        return false;
    }
    try {
        PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
        IndicatorParameters indParameters = this.getParameters();
        TextParameters textParameters = indParameters == null ? null : indParameters.getTextParameter();
        String country = IndicatorHelper.getCountryCodeByParameter(textParameters);
        PhoneNumber phoneNumeber = phoneUtil.parse(data.toString(), country);
        String format = phoneUtil.format(phoneNumeber, PhoneNumberFormat.INTERNATIONAL);
        if (data.toString().equals(format)) {
            wellFormIntePhoneCount++;
            if (checkMustStoreCurrentRow() || checkMustStoreCurrentRow(drillDownValueCount)) {
                this.mustStoreRow = true;
            }
        }
    } catch (NumberParseException e) {
        return false;
    }
    return true;
}
Also used : TextParameters(org.talend.dataquality.indicators.TextParameters) PhoneNumberUtil(com.google.i18n.phonenumbers.PhoneNumberUtil) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) PhoneNumber(com.google.i18n.phonenumbers.Phonenumber.PhoneNumber) NumberParseException(com.google.i18n.phonenumbers.NumberParseException)

Example 10 with IndicatorParameters

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

the class FrequencyStatisticsExplorerTest method creatFrenquceIndicator.

/**
 * DOC yyin Comment method "creatFrenquceIndicator".
 *
 * @return
 */
private LowFrequencyIndicator creatFrenquceIndicator(String columnName, String tdSqlName, int javaType) {
    // create database construction
    TdColumn column = UnitTestBuildHelper.createRealTdColumn(columnName, tdSqlName, javaType);
    // create indicator
    LowFrequencyIndicator indicator = IndicatorsFactory.eINSTANCE.createLowFrequencyIndicator();
    indicator.setAnalyzedElement(column);
    IndicatorParameters indicatorParameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
    indicatorParameters.setDateParameters(null);
    indicator.setParameters(indicatorParameters);
    return indicator;
}
Also used : TdColumn(org.talend.cwm.relational.TdColumn) LowFrequencyIndicator(org.talend.dataquality.indicators.LowFrequencyIndicator) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters)

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