use of org.drools.workbench.models.datamodel.rule.RuleAttribute in project drools-wb by kiegroup.
the class RuleModelCloneVisitor method visitRuleAttribute.
private RuleAttribute visitRuleAttribute(RuleAttribute attr) {
RuleAttribute clone = new RuleAttribute();
clone.setAttributeName(attr.getAttributeName());
clone.setValue(attr.getValue());
return clone;
}
use of org.drools.workbench.models.datamodel.rule.RuleAttribute in project drools-wb by kiegroup.
the class GuidedRuleTemplateFactory method makeModelWithAttributes.
public static TemplateModel makeModelWithAttributes(final String packageName, final Collection<Import> imports, final String name) {
final TemplateModel model = new TemplateModel();
model.getImports().getImports().addAll(imports);
model.setPackageName(packageName);
model.name = name;
model.addAttribute(new RuleAttribute("ruleflow-group", "myRuleFlowGroup"));
return model;
}
use of org.drools.workbench.models.datamodel.rule.RuleAttribute in project drools-wb by kiegroup.
the class GuidedRuleTemplateIndexVisitor method visitRuleModel.
public void visitRuleModel(final TemplateModel model) {
// Add Attributes
if (model.attributes != null) {
for (int i = 0; i < model.attributes.length; i++) {
RuleAttribute attr = model.attributes[i];
visit(attr);
}
}
// Add Types and Fields used by LHS
if (model.lhs != null) {
for (int i = 0; i < model.lhs.length; i++) {
IPattern pattern = model.lhs[i];
visit(pattern);
}
}
// Add Types and Fields used by RHS
if (model.rhs != null) {
for (int i = 0; i < model.rhs.length; i++) {
IAction action = model.rhs[i];
if (action instanceof ActionSetField) {
final ActionSetField asf = (ActionSetField) action;
final String typeName = getTypeNameForBinding(asf.getVariable());
if (typeName != null) {
final String fullyQualifiedClassName = getFullyQualifiedClassName(typeName);
visitActionFieldList(fullyQualifiedClassName, asf);
}
} else {
visit(action);
}
}
}
// Add rule names
final String parentRuleName = model.parentName;
for (int i = 0; i < model.getRowsCount(); i++) {
final String ruleName = model.name + "_" + i;
addResourceReference(ruleName, ResourceType.RULE);
if (parentRuleName != null) {
addResourceReference(parentRuleName, ResourceType.RULE);
}
}
}
Aggregations