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;
}
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;
}
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);
}
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);
}
}
Aggregations