/// <summary> /// Invokes named rule in a specified rulePointPath. /// </summary> /// <typeparam name="T">Return type</typeparam> /// <param name="rulePointPath">The path of rule point which contains the named rule.</param> /// <param name="ruleName">The name of the rule</param> /// <param name="arguments">The arguments required by this rule</param> /// <returns>The execution result of the named rule, or default(T) if the rule does not exist"/></returns> public T InvokeNamedRule <T>(string rulePointPath, string ruleName, Dictionary <string, object> arguments) { if (String.IsNullOrEmpty(rulePointPath)) { throw new ArgumentNullException("rulePointPath"); // NOXLATE } if (String.IsNullOrEmpty(ruleName)) { throw new ArgumentNullException("ruleName"); // NOXLATE } if (arguments == null) { throw new ArgumentNullException("arguments"); // NOXLATE } RulePoint parentRulePoint = GetRulePoint(rulePointPath); if (parentRulePoint == null) { return(default(T)); } NamedRule namedRule = parentRulePoint.GetNamedRule(ruleName); if (namedRule == null) { return(default(T)); } return(InvokeRule <T>(namedRule, arguments)); }
/// <summary> /// Removes named rule by given name. /// </summary> /// <param name="name">The name of named rule to remove</param> public void RemoveNamedRule(string name) { NamedRule theOneToRemove = GetNamedRule(name); if (theOneToRemove != null) { Owner.Storage.RemoveNamedRule(theOneToRemove); } else { throw new ArgumentException(String.Format(Properties.Resources.NamedRuleNotExist, name)); } }
/// <summary> /// Creates named rule as child of this rule point. /// </summary> /// <param name="name">Name of the new one.</param> /// <returns>The newly-created named rule.</returns> public NamedRule CreateNamedRule(string name) { if (HasChild(name)) { throw new ArgumentException(String.Format(Properties.Resources.NamedRuleAlreadyExists, name)); } NamedRule newOne = new NamedRule(Owner, name, this); try { var defaultWorkflow = newOne.Signature.CreateDefaultRoutine(); defaultWorkflow.Name = RuleClassName; Owner.Storage.SetNamedRule(newOne, defaultWorkflow); } catch (Exception ex) { throw new Exception(Properties.Resources.FailToAddSubRule, ex); } return(newOne); }
public void RemoveNamedRule(NamedRule theOneToRemove) { throw new NotImplementedException(); }
public void SetNamedRule(NamedRule namedRule, System.Activities.DynamicActivity workflow) { throw new NotImplementedException(); }
/// <summary> /// Called when a named rule is called. /// </summary> /// <param name="rule">The named rule being called.</param> public virtual void OnInvokingNamedRule(NamedRule rule) { _log.AppendLine(String.Format("{0} Invoking subrule: {1}: {2}", _indent, rule.DisplayName, rule.Path)); //NOXLATE }
/// <summary> /// Initializes a new instance of Autodesk.IM.Rule.NamedRuleExpressionItem class with /// specified named rule. /// </summary> /// <param name="item">The specified named rule which will used in an expression.</param> public NamedRuleExpressionItem(NamedRule item) { this._item = item; }