use of org.talend.dataquality.indicators.TextParameters in project tdq-studio-se by Talend.
the class IndicatorHelper method setCountryCodeParameter.
/**
* set country code as parameter for indicator
*
* @param indicator
* @param countryCode
*/
public static void setCountryCodeParameter(Indicator indicator, String countryCode) {
IndicatorParameters parameters = indicator.getParameters();
if (parameters == null) {
parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
indicator.setParameters(parameters);
}
TextParameters textParameter = parameters.getTextParameter();
if (textParameter == null) {
textParameter = IndicatorsFactory.eINSTANCE.createTextParameters();
}
textParameter.setCountryCode(countryCode);
parameters.setTextParameter(textParameter);
}
use of org.talend.dataquality.indicators.TextParameters in project tdq-studio-se by Talend.
the class TextParametersWithoutOptionsForm method performFinish.
@Override
public boolean performFinish() {
TextParameters textParameter = parameters.getTextParameter();
if (textParameter == null) {
textParameter = IndicatorsFactory.eINSTANCE.createTextParameters();
}
parameters.setTopN(Integer.parseInt(numberTxt.getText()));
return true;
}
use of org.talend.dataquality.indicators.TextParameters in project tdq-studio-se by Talend.
the class PatternFreqIndicatorImpl method prepare.
@Override
public boolean prepare() {
// MOD xqliu 2009-06-29 bug 7068
final TextParameters textParameter = this.getParameters() == null ? null : this.getParameters().getTextParameter();
// ~
if (textParameter != null) {
// TDQ-10044: fix when the user didn't set the replace and charactersToReplace, use the default value(only
// for jave engine)
String replacementCharacters = textParameter.getReplacementCharacters();
if (!StringUtils.isBlank(replacementCharacters)) {
this.replacementChars = replacementCharacters;
hasBeanCustomized = true;
} else {
replacementChars = REPLACEMENT_CHARS;
hasBeanCustomized = false;
}
String charactersToReplace = textParameter.getCharactersToReplace();
if (!StringUtils.isBlank(charactersToReplace)) {
this.charsToReplace = charactersToReplace;
} else {
charsToReplace = CHARS_TO_REPLACE;
}
// TDQ-10044~
}
return super.prepare();
}
use of org.talend.dataquality.indicators.TextParameters in project tdq-studio-se by Talend.
the class PossiblePhoneCountIndicatorImpl 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);
// number.
if (phoneUtil.isPossibleNumber(phoneNumeber)) {
this.possiblePhoneCount++;
if (checkMustStoreCurrentRow() || this.checkMustStoreCurrentRow(drillDownValueCount)) {
this.mustStoreRow = true;
}
}
} catch (NumberParseException e) {
return false;
}
return true;
}
use of org.talend.dataquality.indicators.TextParameters in project tdq-studio-se by Talend.
the class WellFormE164PhoneCountIndicatorImpl 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.E164);
if (data.toString().equals(format)) {
wellFormE164PhoneCount++;
if (checkMustStoreCurrentRow() || checkMustStoreCurrentRow(drillDownValueCount)) {
this.mustStoreRow = true;
}
}
} catch (NumberParseException e) {
return false;
}
return true;
}
Aggregations