use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class SQLPatternExplorerTest method creatSqlPatternMatchingIndicator.
private SqlPatternMatchingIndicator creatSqlPatternMatchingIndicator() {
// create database construction
TdColumn column = UnitTestBuildHelper.createRealTdColumn("lname", "lname", Types.VARCHAR);
// create indicator
SqlPatternMatchingIndicator indicator = IndicatorsFactory.eINSTANCE.createSqlPatternMatchingIndicator();
indicator.setAnalyzedElement(column);
IndicatorParameters indicatorParameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
indicatorParameters.setDateParameters(null);
indicator.setParameters(indicatorParameters);
Pattern pattern = PatternFactory.eINSTANCE.createPattern();
// $NON-NLS-1$
pattern.setName("My Pattern");
RegularExpression regularExpr = PatternFactory.eINSTANCE.createRegularExpression();
TdExpression expression = RelationalFactory.eINSTANCE.createTdExpression();
expression.setBody("'su%'");
// $NON-NLS-1$
expression.setLanguage("SQL");
regularExpr.setExpression(expression);
pattern.getComponents().add(regularExpr);
// create Domain
Domain createDomain = DomainFactory.eINSTANCE.createDomain();
indicatorParameters.setDataValidDomain(createDomain);
indicatorParameters.getDataValidDomain().getPatterns().add(pattern);
return indicator;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class UDIFactory method createUserDefIndicator.
public static Indicator createUserDefIndicator(IndicatorDefinition indicatorDefinition) {
UserDefIndicator userDefIndicator = IndicatorSqlFactory.eINSTANCE.createUserDefIndicator();
IndicatorParameters indicParams = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
userDefIndicator.setParameters(indicParams);
userDefIndicator.setName(indicatorDefinition.getName());
return userDefIndicator;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class UDIFactory method createIndicator.
@Deprecated
public static Indicator createIndicator(IndicatorDefinition indicatorDefinition) {
IndicatorCategory category = UDIHelper.getUDICategory(indicatorDefinition);
Indicator indicator = null;
if (category != null) {
if (category.equals(DefinitionHandler.getInstance().getUserDefinedCountIndicatorCategory())) {
indicator = IndicatorsFactory.eINSTANCE.createRowCountIndicator();
} else if (category.equals(DefinitionHandler.getInstance().getUserDefinedMatchIndicatorCategory())) {
indicator = IndicatorsFactory.eINSTANCE.createRegexpMatchingIndicator();
} else if (category.equals(DefinitionHandler.getInstance().getUserDefinedFrequencyIndicatorCategory())) {
indicator = IndicatorsFactory.eINSTANCE.createFrequencyIndicator();
}
if (indicator != null) {
IndicatorParameters indicParams = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
indicator.setParameters(indicParams);
indicator.setName(indicatorDefinition.getName());
}
}
return indicator;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class UDIFactory method createUserDefIndicator.
/**
* DOC xqliu Comment method "createUserDefIndicator".
*
* @param indicatorDefinition
* @param pattern
* @return
*/
public static Indicator createUserDefIndicator(IndicatorDefinition indicatorDefinition, Pattern pattern) {
UserDefIndicator indicator = IndicatorSqlFactory.eINSTANCE.createUserDefIndicator();
IndicatorParameters indicParams = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
Domain validData = DomainFactory.eINSTANCE.createDomain();
validData.getPatterns().add(pattern);
indicParams.setDataValidDomain(validData);
indicator.setParameters(indicParams);
indicator.setName(UDIHelper.getMatchingIndicatorName(indicatorDefinition, pattern));
return indicator;
}
use of org.talend.dataquality.indicators.IndicatorParameters in project tdq-studio-se by Talend.
the class IndicatorHelperTest method testGetPattern_1.
/**
* Test method for get pattern based on indicator.
*/
@Test
public void testGetPattern_1() {
Indicator indicator = IndicatorsFactory.eINSTANCE.createRegexpMatchingIndicator();
IndicatorParameters parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
Domain validData = DomainFactory.eINSTANCE.createDomain();
Pattern pattern = PatternFactory.eINSTANCE.createPattern();
// $NON-NLS-1$
pattern.setName("Blank Text");
validData.getPatterns().add(pattern);
parameters.setDataValidDomain(validData);
indicator.setParameters(parameters);
Pattern pattern2 = IndicatorHelper.getPattern(indicator);
assert (pattern2 != null);
assert (pattern2.equals(pattern));
}
Aggregations