Search in sources :

Example 1 with DqRuleBuilder

use of org.talend.dq.dqrule.DqRuleBuilder in project tdq-studio-se by Talend.

the class NewDQRulesWizard method initCWMResourceBuilder.

public ModelElement initCWMResourceBuilder() {
    DqRuleBuilder ruleBuilder = new DqRuleBuilder();
    boolean ruleInitialized = ruleBuilder.initializeDqRuleBuilder(parameter.getName());
    if (ruleInitialized) {
        return ruleBuilder.getWhereRule();
    }
    return null;
}
Also used : DqRuleBuilder(org.talend.dq.dqrule.DqRuleBuilder)

Example 2 with DqRuleBuilder

use of org.talend.dq.dqrule.DqRuleBuilder in project tdq-studio-se by Talend.

the class NewParserRulesWizard method initCWMResourceBuilder.

public ModelElement initCWMResourceBuilder() {
    DqRuleBuilder ruleBuilder = new DqRuleBuilder();
    boolean ruleInitialized = ruleBuilder.initializeParserRuleBuilder(parameter.getName());
    if (ruleInitialized) {
        return ruleBuilder.getParserRule();
    }
    return null;
}
Also used : DqRuleBuilder(org.talend.dq.dqrule.DqRuleBuilder)

Example 3 with DqRuleBuilder

use of org.talend.dq.dqrule.DqRuleBuilder in project tdq-studio-se by Talend.

the class TOPRepositoryService method createParserRuleItem.

public void createParserRuleItem(ArrayList<HashMap<String, Object>> values, String parserRuleName) {
    ParserRule parserRule = null;
    DqRuleBuilder ruleBuilder = new DqRuleBuilder();
    boolean ruleInitialized = ruleBuilder.initializeParserRuleBuilder(parserRuleName);
    if (ruleInitialized) {
        parserRule = ruleBuilder.getParserRule();
    }
    TaggedValueHelper.setValidStatus(true, parserRule);
    for (HashMap<String, Object> expression : values) {
        parserRule.addExpression(expression.get(RULE_NAME).toString(), expression.get(RULE_TYPE) instanceof Integer ? Integer.toString((Integer) expression.get(RULE_TYPE)) : expression.get(RULE_TYPE).toString(), expression.get(RULE_VALUE).toString());
    }
    IndicatorCategory ruleIndicatorCategory = DefinitionHandler.getInstance().getDQRuleIndicatorCategory();
    if (ruleIndicatorCategory != null && !parserRule.getCategories().contains(ruleIndicatorCategory)) {
        parserRule.getCategories().add(ruleIndicatorCategory);
    }
    IFolder folder = ResourceManager.getRulesParserFolder();
    TypedReturnCode<Object> returnObject = ElementWriterFactory.getInstance().createdRuleWriter().create(parserRule, folder);
    Object object = returnObject.getObject();
    RuleRepNode parserRuleNode = RepositoryNodeHelper.recursiveFindRuleParser(parserRule);
    BusinessRuleItemEditorInput parserRuleEditorInput = new BusinessRuleItemEditorInput(parserRuleNode);
    CorePlugin.getDefault().openEditor(parserRuleEditorInput, DQRuleEditor.class.getName());
    refresh(object);
}
Also used : ParserRule(org.talend.dataquality.rules.ParserRule) BusinessRuleItemEditorInput(org.talend.dataprofiler.core.ui.editor.dqrules.BusinessRuleItemEditorInput) DQRuleEditor(org.talend.dataprofiler.core.ui.editor.dqrules.DQRuleEditor) DqRuleBuilder(org.talend.dq.dqrule.DqRuleBuilder) RuleRepNode(org.talend.dq.nodes.RuleRepNode) IndicatorCategory(org.talend.dataquality.indicators.definition.IndicatorCategory) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IFolder(org.eclipse.core.resources.IFolder)

Example 4 with DqRuleBuilder

use of org.talend.dq.dqrule.DqRuleBuilder in project tdq-studio-se by Talend.

the class ImportFactory method createAndStoreParserRule.

/**
 * DOC klliu Comment method "createAndStoreParserRule".
 *
 * @param prParameters
 * @param selectionFolder
 */
public static void createAndStoreParserRule(ParserRuleParameters prParameters, IFolder selectionFolder, String name) {
    DqRuleBuilder ruleBuilder = new DqRuleBuilder();
    boolean ruleInitialized = ruleBuilder.initializeParserRuleBuilder(prParameters.label);
    if (ruleInitialized) {
        ParserRule parserRule = ruleBuilder.getParserRule();
        parserRule.setName(name);
        TaggedValueHelper.setValidStatus(true, parserRule);
        List<ParserRuleTdExpresstion> prExpresstions = prParameters.getPrExpresstions();
        for (ParserRuleTdExpresstion prtde : prExpresstions) {
            parserRule.addExpression(prtde.name, prtde.type, prtde.value);
        }
        IndicatorCategory ruleIndicatorCategory = DefinitionHandler.getInstance().getDQRuleIndicatorCategory();
        if (ruleIndicatorCategory != null && !parserRule.getCategories().contains(ruleIndicatorCategory)) {
            parserRule.getCategories().add(ruleIndicatorCategory);
        }
        ElementWriterFactory.getInstance().createdRuleWriter().create(parserRule, selectionFolder);
    }
}
Also used : ParserRule(org.talend.dataquality.rules.ParserRule) IndicatorCategory(org.talend.dataquality.indicators.definition.IndicatorCategory) DqRuleBuilder(org.talend.dq.dqrule.DqRuleBuilder)

Aggregations

DqRuleBuilder (org.talend.dq.dqrule.DqRuleBuilder)4 IndicatorCategory (org.talend.dataquality.indicators.definition.IndicatorCategory)2 ParserRule (org.talend.dataquality.rules.ParserRule)2 IFolder (org.eclipse.core.resources.IFolder)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1 BusinessRuleItemEditorInput (org.talend.dataprofiler.core.ui.editor.dqrules.BusinessRuleItemEditorInput)1 DQRuleEditor (org.talend.dataprofiler.core.ui.editor.dqrules.DQRuleEditor)1 RuleRepNode (org.talend.dq.nodes.RuleRepNode)1