Search in sources :

Example 1 with PatternBuilder

use of org.talend.dq.pattern.PatternBuilder in project tdq-studio-se by Talend.

the class CreatePatternWizard method initCWMResourceBuilder.

public ModelElement initCWMResourceBuilder() {
    patternBuilder = new PatternBuilder();
    boolean patternInitialized = patternBuilder.initializePattern(parameter.getName());
    if (patternInitialized) {
        Pattern pattern = patternBuilder.getPattern();
        String lang = PatternLanguageType.findLanguageByName(parameter.getLanguage());
        String express = parameter.getExpression();
        RegularExpression regularExpr = BooleanExpressionHelper.createRegularExpression(lang, express);
        regularExpr.setExpressionType(type.getLiteral());
        pattern.getComponents().add(regularExpr);
        return pattern;
    }
    return null;
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) RegularExpression(org.talend.dataquality.domain.pattern.RegularExpression) PatternBuilder(org.talend.dq.pattern.PatternBuilder)

Example 2 with PatternBuilder

use of org.talend.dq.pattern.PatternBuilder in project tdq-studio-se by Talend.

the class CreatePatternsMigratorTask method newPattern.

private Pattern newPattern(String name, String lang, String express) {
    PatternBuilder patternBuilder = new PatternBuilder();
    boolean patternInitialized = patternBuilder.initializePattern(name);
    if (patternInitialized) {
        Pattern pattern = patternBuilder.getPattern();
        RegularExpression regularExpr = BooleanExpressionHelper.createRegularExpression(lang, express);
        // $NON-NLS-1$
        regularExpr.setExpressionType("REGEXP");
        pattern.getComponents().add(regularExpr);
        return pattern;
    }
    return null;
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) RegularExpression(org.talend.dataquality.domain.pattern.RegularExpression) PatternBuilder(org.talend.dq.pattern.PatternBuilder)

Example 3 with PatternBuilder

use of org.talend.dq.pattern.PatternBuilder in project tdq-studio-se by Talend.

the class AddPatternISBN13Task method newPattern.

private Pattern newPattern(String name, String lang, String express) {
    PatternBuilder patternBuilder = new PatternBuilder();
    boolean patternInitialized = patternBuilder.initializePattern(name);
    if (patternInitialized) {
        Pattern pattern = patternBuilder.getPattern();
        RegularExpression regularExpr = BooleanExpressionHelper.createRegularExpression(lang, express);
        // $NON-NLS-1$
        regularExpr.setExpressionType("REGEXP");
        pattern.getComponents().add(regularExpr);
        return pattern;
    }
    return null;
}
Also used : Pattern(org.talend.dataquality.domain.pattern.Pattern) RegularExpression(org.talend.dataquality.domain.pattern.RegularExpression) PatternBuilder(org.talend.dq.pattern.PatternBuilder)

Aggregations

Pattern (org.talend.dataquality.domain.pattern.Pattern)3 RegularExpression (org.talend.dataquality.domain.pattern.RegularExpression)3 PatternBuilder (org.talend.dq.pattern.PatternBuilder)3