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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations