use of org.talend.dataquality.indicators.TextParameters in project tdq-studio-se by Talend.
the class WellFormNationalPhoneCountIndicatorImpl 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.parseAndKeepRawInput(data.toString(), country);
String format = phoneUtil.format(phoneNumeber, PhoneNumberFormat.NATIONAL);
if (data.toString().equals(format)) {
this.wellFormNatiPhoneCount++;
if (checkMustStoreCurrentRow() || 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 ValidPhoneCountIndicatorImpl method handle.
/*
* (non-Jsdoc)
*
* @see org.talend.dataquality.indicators.impl.IndicatorImpl#handle(java.lang.Object)
*/
@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 phoneNumber = phoneUtil.parse(data.toString(), country);
if (phoneUtil.isValidNumberForRegion(phoneNumber, country)) {
// if (phoneUtil.isValidNumber(phoneNumber)) {
validPhoneNumCount++;
if (checkMustStoreCurrentRow() || 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 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.TextParameters in project tdq-studio-se by Talend.
the class IndicatorParametersImpl method basicSetTextParameter.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetTextParameter(TextParameters newTextParameter, NotificationChain msgs) {
TextParameters oldTextParameter = textParameter;
textParameter = newTextParameter;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IndicatorsPackage.INDICATOR_PARAMETERS__TEXT_PARAMETER, oldTextParameter, newTextParameter);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
use of org.talend.dataquality.indicators.TextParameters in project tdq-studio-se by Talend.
the class PatternLowFreqIndicatorImpl 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 = "aaaaaaaaaaaaaaaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAAAAAAA9999999999";
hasBeanCustomized = false;
}
String charactersToReplace = textParameter.getCharactersToReplace();
if (!StringUtils.isBlank(charactersToReplace)) {
this.charsToReplace = charactersToReplace;
} else {
charsToReplace = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
}
// TDQ-10044~
}
return super.prepare();
}
Aggregations