Search in sources :

Example 46 with IndicatorParameters

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;
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) RegularExpression(org.talend.dataquality.domain.pattern.RegularExpression) TdColumn(org.talend.cwm.relational.TdColumn) TdExpression(org.talend.cwm.relational.TdExpression) SqlPatternMatchingIndicator(org.talend.dataquality.indicators.SqlPatternMatchingIndicator) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) Domain(org.talend.dataquality.domain.Domain)

Example 47 with IndicatorParameters

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;
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator)

Example 48 with IndicatorParameters

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;
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) IndicatorCategory(org.talend.dataquality.indicators.definition.IndicatorCategory) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator) Indicator(org.talend.dataquality.indicators.Indicator)

Example 49 with IndicatorParameters

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;
}
Also used : IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) Domain(org.talend.dataquality.domain.Domain) UserDefIndicator(org.talend.dataquality.indicators.sql.UserDefIndicator)

Example 50 with IndicatorParameters

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));
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) IndicatorParameters(org.talend.dataquality.indicators.IndicatorParameters) Domain(org.talend.dataquality.domain.Domain) NullCountIndicator(org.talend.dataquality.indicators.NullCountIndicator) Indicator(org.talend.dataquality.indicators.Indicator) RowCountIndicator(org.talend.dataquality.indicators.RowCountIndicator) Test(org.junit.Test)

Aggregations

IndicatorParameters (org.talend.dataquality.indicators.IndicatorParameters)65 Domain (org.talend.dataquality.domain.Domain)27 DateParameters (org.talend.dataquality.indicators.DateParameters)15 Test (org.junit.Test)14 TdColumn (org.talend.cwm.relational.TdColumn)14 Pattern (org.talend.dataquality.domain.pattern.Pattern)14 TdExpression (org.talend.cwm.relational.TdExpression)13 TextParameters (org.talend.dataquality.indicators.TextParameters)12 RegularExpression (org.talend.dataquality.domain.pattern.RegularExpression)10 ChartDataEntity (org.talend.dq.indicators.preview.table.ChartDataEntity)10 Indicator (org.talend.dataquality.indicators.Indicator)9 ArrayList (java.util.ArrayList)8 PatternMatchingIndicator (org.talend.dataquality.indicators.PatternMatchingIndicator)8 Expression (orgomg.cwm.objectmodel.core.Expression)8 RegexpMatchingIndicator (org.talend.dataquality.indicators.RegexpMatchingIndicator)7 UserDefIndicator (org.talend.dataquality.indicators.sql.UserDefIndicator)7 PhoneNumberUtil (com.google.i18n.phonenumbers.PhoneNumberUtil)6 PhoneNumber (com.google.i18n.phonenumbers.Phonenumber.PhoneNumber)6 Analysis (org.talend.dataquality.analysis.Analysis)6 UDIndicatorDefinition (org.talend.dataquality.indicators.definition.userdefine.UDIndicatorDefinition)6