use of org.talend.dataquality.domain.Domain in project tdq-studio-se by Talend.
the class AnalysisHelper method createDomain.
private static Domain createDomain(Analysis analysis, String datafilterString, String alias) {
// by default use same name as the analysis. This is ok as long as there is only one datafilter.
Domain domain = DomainHelper.createDomain(analysis.getName() + alias);
RangeRestriction rangeRestriction = DomainHelper.addRangeRestriction(domain);
BooleanExpressionNode expressionNode = BooleanExpressionHelper.createBooleanExpressionNode(datafilterString);
rangeRestriction.setExpressions(expressionNode);
return domain;
}
use of org.talend.dataquality.domain.Domain in project tdq-studio-se by Talend.
the class EMailValidationIndicator method initParameters.
boolean initParameters() {
// Check prerequisite
IndicatorParameters param = this.getParameters();
if (param == null) {
// $NON-NLS-1$
log.error("No parameter set in the user defined indicator " + this.getName());
return false;
}
Domain indicatorValidDomain = param.getIndicatorValidDomain();
if (indicatorValidDomain == null) {
// $NON-NLS-1$
log.error("No parameter set in the user defined indicator " + this.getName());
return false;
}
// else retrieve email from parameter
EList<JavaUDIIndicatorParameter> javaUDIIndicatorParameter = indicatorValidDomain.getJavaUDIIndicatorParameter();
for (JavaUDIIndicatorParameter p : javaUDIIndicatorParameter) {
if (EMAIL_PARAM.equalsIgnoreCase(p.getKey())) {
this.emailAddress = p.getValue();
} else if (INVALID_PARAM.equalsIgnoreCase(p.getKey())) {
this.storeInvalidData = true;
// TODO add more checks on the file
try {
this.tempInvalidData = new StringBuffer();
this.os = new FileOutputStream(new File(p.getValue()));
} catch (FileNotFoundException e) {
// $NON-NLS-1$
log.error("Invalid file path in the user defined indicator: " + this.getName(), e);
return false;
}
} else if (BUFFER_SIZE_PARAM.equalsIgnoreCase(p.getKey())) {
try {
this.buffSize = Integer.valueOf(p.getValue());
} catch (Exception e) {
// $NON-NLS-1$
log.error("Invalid buffer size: " + p.getValue(), e);
return false;
}
} else {
// log warn but keep running (don't return false)
if (!NAMING_PARAM.equalsIgnoreCase(p.getKey())) {
// $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
log.warn("Unknown parameter given to UDI: " + this.getName() + ": " + p.getKey() + " = " + p.getValue());
}
}
}
if (!this.isAddressValid(emailAddress)) {
log.error(// $NON-NLS-1$ //$NON-NLS-2$
"Invalid sender email set in parameters of the user defined indicator \"" + this.getName() + "\": " + emailAddress);
return false;
}
return true;
}
use of org.talend.dataquality.domain.Domain in project tdq-studio-se by Talend.
the class IndicatorParametersImpl method basicSetIndicatorValidDomain.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetIndicatorValidDomain(Domain newIndicatorValidDomain, NotificationChain msgs) {
Domain oldIndicatorValidDomain = indicatorValidDomain;
indicatorValidDomain = newIndicatorValidDomain;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IndicatorsPackage.INDICATOR_PARAMETERS__INDICATOR_VALID_DOMAIN, oldIndicatorValidDomain, newIndicatorValidDomain);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
use of org.talend.dataquality.domain.Domain in project tdq-studio-se by Talend.
the class IndicatorParametersImpl method basicSetBins.
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public NotificationChain basicSetBins(Domain newBins, NotificationChain msgs) {
Domain oldBins = bins;
bins = newBins;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, IndicatorsPackage.INDICATOR_PARAMETERS__BINS, oldBins, newBins);
if (msgs == null) {
msgs = notification;
} else {
msgs.add(notification);
}
}
return msgs;
}
use of org.talend.dataquality.domain.Domain in project tdq-studio-se by Talend.
the class BinLowFrequencyIndicatorImpl method getGroupLabel.
/*
* (non-Javadoc)
*
* if the bin parameter is set,look range name as a new name.
*/
protected String getGroupLabel(Object name) {
if (name == null) {
return null;
}
if (parameters != null) {
Domain bins = parameters.getBins();
if (bins != null) {
EList<RangeRestriction> ranges = bins.getRanges();
for (RangeRestriction range : ranges) {
double minRealValue = DomainHelper.getRealValue(range.getLowerValue());
double maxRealValue = DomainHelper.getRealValue(range.getUpperValue());
double inputValue = Double.valueOf(name.toString());
if (minRealValue <= inputValue && inputValue < maxRealValue) {
return range.getName();
}
}
// if the data(name) is not in these ranges,return null and ignor it.
return null;
}
}
return name.toString();
}
Aggregations