private int parseNonDrlInLhs(final RuleModel m, final ExpandedDRLInfo expandedDRLInfo, int lineCounter) { lineCounter++; lineCounter = parseDslInLhs(m, expandedDRLInfo, lineCounter); lineCounter = parseFreeForm(m, expandedDRLInfo, lineCounter); return lineCounter; }
private ActionSetFieldWrapper(final ActionSetField action, final boolean isUpdate) { this.action = clone(action); this.isUpdate = isUpdate; }
public void visit(final IAction iAction) { if (iAction instanceof ActionFieldList) { visit((ActionFieldList) iAction); } }
private String toSourceUnexpanded(final Path path, final RuleModel content) { //Wrap RuleModel as we need to control whether the DSLs are expanded. Both DRL and DSLR files should not have //DSLs expanded. In the case of DSLRs we need to explicitly control escaping plain-DRL to prevent attempts //by drools to expand it, by forcing the Model->DRL persistence into believing the model has DSLs. final RuleModelWrapper model = new RuleModelWrapper(content, dslrResourceType.accept(path)); final String source = RuleModelDRLPersistenceImpl.getInstance().marshal(model); return source; }
private void generateSetMethodCalls(final String variableName, final ActionFieldValue[] fieldValues) { for (int i = 0; i < fieldValues.length; i++) { generateSetMethodCall(variableName, fieldValues[i]); } }
private Map<String, List<ActionFieldValue>> getRHSClassDependencies(final RuleModel model) { if (model != null) { RHSClassDependencyVisitor dependencyVisitor = new RHSClassDependencyVisitor(); for (IAction action : model.rhs) { dependencyVisitor.visit(action); } return dependencyVisitor.getRHSClasses(); } Map<String, List<ActionFieldValue>> empty = Collections.emptyMap(); return empty; }
@Override protected void generateConstraint(final FieldConstraint constr, final LHSGeneratorContext gctx) { if (isValidFieldConstraint(constr)) { super.generateConstraint(constr, gctx); } }
@Override protected void generateModifyMethodCall(final RHSGeneratorContext gctx, final ActionFieldValue fieldValue) { if (isValidFieldConstraint(fieldValue)) { super.generateModifyMethodCall(gctx, fieldValue); } }
@Override protected String marshalRuleName(final RuleModel model) { return super.marshalRuleName(model) + "_@{row.rowNumber}"; }
public void visitActionInsertFact(final ActionInsertFact action) { this.generateInsertCall(action, false); }
protected RHSActionVisitor getRHSActionVisitor(final boolean isDSLEnhanced, final StringBuilder buf, final String indentation, final RHSGeneratorContextFactory generatorContextFactory) { return new RHSActionVisitor(isDSLEnhanced, bindingsPatterns, bindingsFields, constraintValueBuilder, generatorContextFactory, buf, indentation); }
private SingleFieldConstraint createNullCheckFieldConstraint(final RuleModel m, final FactPattern factPattern, final String fieldName) { return createFieldConstraint(m, factPattern, fieldName, null, null, true); }
protected LHSPatternVisitor getLHSPatternVisitor(final boolean isDSLEnhanced, final StringBuilder buf, final String nestedIndentation, final boolean isNegated, final LHSGeneratorContextFactory generatorContextFactory) { return new LHSPatternVisitor(isDSLEnhanced, bindingsPatterns, bindingsFields, constraintValueBuilder, generatorContextFactory, buf, nestedIndentation, isNegated); }
@Override public String marshal(final RuleModel model) { return marshalRule(model); }
private SingleFieldConstraint createExpressionBuilderConstraint(final RuleModel m, final FactPattern factPattern, final String fieldName, final String operator, final String value) { // TODO: we should find a way to know when the expression uses a getter and in this case create a plain SingleFieldConstraint //int dotPos = fieldName.lastIndexOf('.'); //SingleFieldConstraint con = createSingleFieldConstraint(dotPos > 0 ? fieldName.substring(dotPos+1) : fieldName, operator, value); SingleFieldConstraint con = createSingleFieldConstraintEBLeftSide(m, factPattern, fieldName, operator, value); return con; }
public RuleModel unmarshalUsingDSL(final String str, final List<String> globals, final PackageDataModelOracle dmo, final String... dsls) { return unmarshalUsingDSL(str, globals, dmo, Collections.emptyList(), dsls); }
protected void generateModifyMethodSeparator(final RHSGeneratorContext gctx, final ActionFieldValue fieldValue) { if (doesPeerHaveOutput(gctx)) { buf.append(", \n"); } }
private String toSourceUnexpanded(final Path path, final RuleModel content) { //Wrap RuleModel as we need to control whether the DSLs are expanded. Both DRL and DSLR files should not have //DSLs expanded. In the case of DSLRs we need to explicitly control escaping plain-DRL to prevent attempts //by drools to expand it, by forcing the Model->DRL persistence into believing the model has DSLs. final RuleModelWrapper model = new RuleModelWrapper(content, dslrResourceType.accept(path)); final String source = RuleModelDRLPersistenceImpl.getInstance().marshal(model); return source; }
@Override protected void generateSetMethodCall(final String variableName, final ActionFieldValue fieldValue) { if (isValidFieldConstraint(fieldValue)) { super.generateSetMethodCall(variableName, fieldValue); } }
public void visitActionInsertLogicalFact(final ActionInsertLogicalFact action) { this.generateInsertCall(action, true); }