private string GetRulePreview(LogicBuilder.Workflow.Activities.Rules.Rule rule) { StringBuilder rulePreview = new StringBuilder(); if (rule != null) { rulePreview.Append("IF "); if (rule.Condition != null) { rulePreview.Append(rule.Condition.ToString() + " "); } rulePreview.Append("THEN "); foreach (RuleAction action in rule.ThenActions) { rulePreview.Append(action.ToString()); rulePreview.Append(' '); } if (rule.ElseActions.Count > 0) { rulePreview.Append("ELSE "); foreach (RuleAction action in rule.ElseActions) { rulePreview.Append(action.ToString()); rulePreview.Append(' '); } } } return(rulePreview.ToString()); }
private static RuleSymbolInfo AnalyzeRule(RuleChainingBehavior behavior, Rule rule, RuleValidation validator, Tracer tracer) { RuleSymbolInfo rsi = new RuleSymbolInfo(); if (rule.Condition != null) { rsi.conditionDependencies = rule.Condition.GetDependencies(validator); if ((rsi.conditionDependencies != null) && (tracer != null)) { tracer.TraceConditionSymbols(rule.Name, rsi.conditionDependencies); } } if (rule.thenActions != null) { rsi.thenSideEffects = GetActionSideEffects(behavior, rule.thenActions, validator); if ((rsi.thenSideEffects != null) && (tracer != null)) { tracer.TraceThenSymbols(rule.Name, rsi.thenSideEffects); } } if (rule.elseActions != null) { rsi.elseSideEffects = GetActionSideEffects(behavior, rule.elseActions, validator); if ((rsi.elseSideEffects != null) && (tracer != null)) { tracer.TraceElseSymbols(rule.Name, rsi.elseSideEffects); } } return(rsi); }
internal RuleState(Rule rule) { this.Rule = rule; }