Example #1
0
        public bool ProcessRule(string ruleName, Dictionary<string, object> contextObjects, out IBRERuleResult ruleResult )
        {
            ruleResult = null;
            bool processed = false;

            if (myRules.ContainsKey(ruleName))
            {
                string rulePath = Path.Combine( this.sourceDir.FullName, myRules[ruleName].RuleFile);

                XBusinessRulesFileDriver driver = new XBusinessRulesFileDriver( rulePath );
                IFlowEngine flowEngine = theEngineFactory.NewBRE( driver );
                flowEngine.ResultHandlers += new DispatchRuleResult( flowEngine_ResultHandlers );

                foreach (string ruleKey in contextObjects.Keys)
                {
                    flowEngine.RuleContext.SetObject(ruleKey, contextObjects[ruleKey]);
                }

                this.ruleResult = null;
                processed = flowEngine.Process();
                ruleResult = this.ruleResult;
            }

            return processed;
        }
Example #2
0
 /// <summary>This is the method that is required by the listener interface.  It
 /// will get called whenever the LoginResult rule is executed
 /// </summary>
 public virtual void  HandleBRERuleResult(object sender, IBRERuleResult aBRR)
 {
     if (aBRR.MetaData.Id.Equals("LoginResult"))
     {
         lockLogin = true;
     }
 }
Example #3
0
 private void DispatchRuleResult(IBRERuleResult ruleResult)
 {
     if (ResultHandlers != null)
     {
         ResultHandlers(this, ruleResult);
     }
 }
Example #4
0
        /// <summary> Handles the Parameter node
        /// </summary>
        /// <param name="aNode">The Node to process
        /// </param>
        /// <param name="aMap">The Parameters map
        ///
        /// </param>
        private void ProcessParameterNode(XPathNavigator aNode, Hashtable aMap)
        {
            string valueNode     = aNode.GetAttribute(PARAMETER_ATTRS.VALUE, String.Empty);
            string typeNode      = aNode.GetAttribute(PARAMETER_ATTRS.TYPE, String.Empty);
            string ruleValueNode = aNode.GetAttribute(PARAMETER_ATTRS.RULE_VALUE, String.Empty);

            // Used to be initialized with null: changed to String.Empty to solve bug #1190485
            object finalValue = String.Empty;

            if (valueNode != String.Empty)
            {
                if (typeNode != String.Empty)
                {
                    finalValue = Reflection.CastValue(valueNode, typeNode);
                }
                else
                {
                    finalValue = valueNode;
                }
            }
            else if (ruleValueNode != String.Empty)
            {
                IBRERuleResult result = ruleContext.GetResult(ruleValueNode);
                if (result != null)
                {
                    finalValue = result.Result;
                }
            }

            aMap.Add(aNode.GetAttribute(PARAMETER_ATTRS.NAME, String.Empty), finalValue);
        }
Example #5
0
 /// <summary> Sets a RuleResult
 /// *
 /// </summary>
 /// <param name="aId">The UID of the RuleResult
 /// </param>
 /// <param name="aResult">The RuleResult
 ///
 /// </param>
 public virtual void  SetResult(object aId, IBRERuleResult aResult)
 {
     if (results != null)
     {
         if (results.Contains(aId))
         {
             results.Remove(aId);
         }
         results.Add(aId, aResult);
     }
 }
Example #6
0
        /// <summary> Returns a business object
        /// *
        /// </summary>
        /// <param name="aId">The UID of the business object
        /// </param>
        /// <returns> The requested business object</returns>
        /// <remarks>Never use this method in the engine itself: the engine should only rely on GetResult.</remarks>
        public override object GetObject(object aId)
        {
            IBRERuleResult ruleResult = GetResult(aId);

            if (ruleResult != null)
            {
                return(ruleResult.Result);
            }
            else
            {
                return(null);
            }
        }
Example #7
0
        /// <summary> Gets a String Id from either the id attribute or the ruleValue attribute
        /// </summary>
        /// <param name="aNode">The node to process</param>
        /// <param name="idAttribute">The Id of the attribute to process</param>
        /// <param name="valueAttribute">The value used in this node.</param>
        /// <returns> The Id found in the node attributes, null if nothing found</returns>
        private string ProcessIdValueAttributes(XPathNavigator aNode, string idAttribute, string valueAttribute)
        {
            string idNode        = aNode.GetAttribute(idAttribute, String.Empty);
            string ruleValueNode = aNode.GetAttribute(valueAttribute, String.Empty);

            if ((idNode == String.Empty) && (ruleValueNode != String.Empty))
            {
                IBRERuleResult result = ruleContext.GetResult(ruleValueNode);
                if (result != null)
                {
                    return(result.Result.ToString());
                }
            }
            else if (idNode != String.Empty)
            {
                return(idNode);
            }

            return(null);
        }
Example #8
0
 public virtual void HandleBRERuleResult(object sender, IBRERuleResult aBRR)
 {
     resultCount++;
 }
Example #9
0
 /// <summary> Defines a new BRERuleException with a specific msg,
 /// and the resultSet that may have been created (nullable)
 /// *
 /// </summary>
 /// <param name="aMsg">The error message
 /// </param>
 /// <param name="aBRR">The BusinessRuleResult that may have been created
 /// 
 /// </param>
 public BRERuleException(string aMsg, IBRERuleResult aBRR)
     : base(aMsg)
 {
     brr = aBRR;
 }
Example #10
0
        /// <summary> This methods processes the Rule nodes that may exist in the XML.
        /// <P>
        /// It executes as follows (this may not look so straightforward in the code...):
        /// <OL>
        /// <LI>Executes Factories executeRule()</LI>
        /// <LI>takes the result and puts it into a RuleResult object</LI>
        /// <LI>listeners.dispatches an error if it could not find the factory
        /// (See docs in code)</LI>
        /// <LI>Catches any exceptions from the executeRule() and makes it a
        /// RuleResult so it can be handled gracefully</LI>
        /// <LI>Adds the RuleResult to the CallStack</LI>
        /// <LI>listeners.dispatched the RuleResult to any listeners</LI>
        /// <LI>Adds the RuleResult to the RuleContext</LI>
        /// </OL>
        /// </P>
        /// </summary>
        /// <param name="id">The ID of the Rule
        /// </param>
        /// <param name="step">The current Step
        /// </param>
        /// <param name="aMap">The Parameters map
        /// </param>
        private void DoRule(object id, object step, Hashtable aMap)
        {
            var nextStackLoc = ruleContext.CallStack.Count;

            IBRERuleResult ruleResult = null;

            try
            {
                var factory = ruleContext.GetFactory(id);

                /*
                 * I have to check for null because if the RuleContext
                 * was passed in, an external reference exists and can be
                 * modified at any time
                 */

                if (factory != null)
                {
                    //setup metadata
                    IBRERuleMetaData metaData = new BRERuleMetaDataImpl(id, factory, aMap, nextStackLoc, step);

                    var result = factory.ExecuteRule(ruleContext, aMap, step);

                    ruleResult = new BRERuleResultImpl(metaData, result);
                }
                else
                {
                    /*
                     * A WARN version of this error can occur when the
                     * Factories are loaded.  But if the developer passed in
                     * a RuleContext, they can place the Factory into the
                     * RuleContext still.  If we get to this point it is now a full
                     * blown error because if it is not in the RuleContext at this point and
                     * it to late and can cause issues
                     */

                    if (Logger.IsFlowEngineError)
                    {
                        Logger.FlowEngineSource.TraceData(TraceEventType.Error, 0, new BREException("Factory Id " + id + " defined, but not found in RuleContext"));
                    }
                }
            }
            // This can occur internally in the RuleContext
            catch (System.InvalidCastException cce)
            {
                if (Logger.IsFlowEngineCritical)
                {
                    Logger.FlowEngineSource.TraceData(TraceEventType.Critical, 0, new BREException("Object in RuleContext not of correct type. " + cce.ToString()));
                }
            }
            // Catch unknown exceptions in the factory itself
            catch (System.Exception e)
            {
                if (Logger.IsFlowEngineError)
                {
                    Logger.FlowEngineSource.TraceData(TraceEventType.Error, 0, new BREException("Error when processing RuleFactory id: " + id, e));
                }

                /*
                 * Set the RuleResult to an exception so I can test for it in the If
                 * Hey, technically it IS what it returned ;)
                 * The factory can return null here, but that could have caused the
                 * exception anyway.....
                 */

                IBRERuleMetaData metaData = new BRERuleMetaDataImpl(id, ruleContext.GetFactory(id), aMap, nextStackLoc, step);
                ruleResult = new BRERuleResultImpl(metaData, e);
            }

            ruleContext.CallStack.Push(ruleResult);

            // call listeners
            DispatchRuleResult(ruleResult);

            ruleContext.SetResult(id, ruleResult);
        }
		/// <summary> Defines a new BRERuleFatalException with a specific msg,
		/// and the resultSet that may have been created (nullable)
		/// *
		/// </summary>
		/// <param name="aMsg">The error message
		/// </param>
		/// <param name="aBRR">The BusinessRuleResult that may have been created
		/// 
		/// </param>
		public BRERuleFatalException(string aMsg, IBRERuleResult aBRR):base(aMsg, aBRR)
		{
		}
Example #12
0
 private void flowEngine_ResultHandlers(object sender, IBRERuleResult ruleResult)
 {
     this.ruleResult = ruleResult;
 }
Example #13
0
        public bool ProcessRule(string ruleName, Dictionary <string, object> contextObjects, out IBRERuleResult ruleResult)
        {
            ruleResult = null;
            bool processed = false;

            if (myRules.ContainsKey(ruleName))
            {
                string rulePath = Path.Combine(this.sourceDir.FullName, myRules[ruleName].RuleFile);

                XBusinessRulesFileDriver driver = new XBusinessRulesFileDriver(rulePath);
                IFlowEngine flowEngine          = theEngineFactory.NewBRE(driver);
                flowEngine.ResultHandlers += new DispatchRuleResult(flowEngine_ResultHandlers);

                foreach (string ruleKey in contextObjects.Keys)
                {
                    flowEngine.RuleContext.SetObject(ruleKey, contextObjects[ruleKey]);
                }

                this.ruleResult = null;
                processed       = flowEngine.Process();
                ruleResult      = this.ruleResult;
            }

            return(processed);
        }
Example #14
0
 /// <summary> Defines a new BRERuleFatalException with a specific msg,
 /// and the resultSet that may have been created (nullable)
 /// </summary>
 /// <param name="aMsg">The error message
 /// </param>
 /// <param name="aBRR">The BusinessRuleResult that may have been created
 ///
 /// </param>
 public BRERuleFatalException(string aMsg, IBRERuleResult aBRR) : base(aMsg, aBRR)
 {
 }
Example #15
0
        /// <summary> This methods processes the Compare nodes that may exist in the XML.
        /// <P>
        /// The best comparison works when the object implements Comparable.
        /// </P>
        /// <P>
        /// If the object does not do so, it eliminates the &lt;,&gt;,&lt;=,&gt;=
        /// functionality as we are left with .equals(), !.equals(), and
        /// exception
        /// </P>
        /// </summary>
        /// <param name="aNode">The Node to process
        /// </param>
        /// <param name="aMap"/>
        /// <returns> True if the If stmt passes, False otherwise
        ///
        /// </returns>
        private bool ProcessCompareNode(XPathNavigator aNode, Hashtable aMap)
        {
            bool resultBool = false;

            // This is required in the XML, so we shouldn't have to worry about nulls....
            string leftId     = aNode.GetAttribute(COMPARE_ATTRS.LEFTID, String.Empty);
            string rightId    = aNode.GetAttribute(COMPARE_ATTRS.RIGHTID, String.Empty);
            string operatorId = aNode.GetAttribute(COMPARE_ATTRS.OPERATOR, String.Empty);

            IBREOperator ruleOperator = GetOperator(operatorId);

            if (ruleOperator != null)
            {
                // Get the results
                IBRERuleResult leftResult  = (IBRERuleResult)ruleContext.GetResult(leftId);
                IBRERuleResult rightResult = (IBRERuleResult)ruleContext.GetResult(rightId);

                // If it does not, consider a null in left or right members as exceptions!
                if ((!ruleOperator.AcceptsNulls) && (leftResult == null))
                {
                    if (Logger.IsFlowEngineError)
                    {
                        Logger.FlowEngineSource.TraceEvent(TraceEventType.Error, 0, "RuleResult " + leftId + " not found in RuleContext");
                    }
                }
                else if ((!ruleOperator.AcceptsNulls) && (rightResult == null))
                {
                    if (Logger.IsFlowEngineError)
                    {
                        Logger.FlowEngineSource.TraceEvent(TraceEventType.Error, 0, "RuleResult " + rightId + " not found in RuleContext");
                    }
                }
                else
                {
                    if (Logger.IsFlowEngineVerbose)
                    {
                        Logger.FlowEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Retrieved results for comparison");
                    }

                    object left  = (leftResult == null)?null:leftResult.Result;
                    object right = (rightResult == null)?null:rightResult.Result;

                    try
                    {
                        if (Logger.IsFlowEngineVerbose)
                        {
                            Logger.FlowEngineSource.TraceEvent(TraceEventType.Verbose, 0, "BREOperator " + operatorId + " executing");
                        }
                        resultBool = ruleOperator.ExecuteComparison(ruleContext, aMap, left, right);
                    }
                    catch (InvalidCastException ice)
                    {
                        if (Logger.IsFlowEngineCritical)
                        {
                            Logger.FlowEngineSource.TraceData(TraceEventType.Critical,
                                                              0,
                                                              new BREException("Specified BREOperator "
                                                                               + operatorId
                                                                               + " not of type BREOperator or objects being compared are not"
                                                                               + " of the same type.\n"
                                                                               + "Left Object Name:" + leftId
                                                                               + "\nLeft Object Type:" + left.GetType().FullName
                                                                               + "\nRight Object Name:" + rightId
                                                                               + "\nRight Object Type:" + right.GetType().FullName
                                                                               + "\n", ice));
                        }
                    }
                    catch (Exception e)
                    {
                        if (Logger.IsFlowEngineCritical)
                        {
                            Logger.FlowEngineSource.TraceData(TraceEventType.Critical,
                                                              0,
                                                              new BREException("Error when processing BREOperator "
                                                                               + operatorId
                                                                               + ".\n"
                                                                               + "Left Object Name:" + leftId
                                                                               + "\nLeft Object:" + left
                                                                               + "\nRight Object Name:" + rightId
                                                                               + "\nRight Object:" + right
                                                                               + "\n", e));
                        }
                    }
                }
            }
            else
            {
                if (Logger.IsFlowEngineCritical)
                {
                    Logger.FlowEngineSource.TraceData(TraceEventType.Critical, 0, new BREException("Operator could not be loaded from BRERuleContext"));
                }
            }

            if (Logger.IsFlowEngineVerbose)
            {
                Logger.FlowEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Compare result: " + resultBool);
            }
            return(resultBool);
        }
		/// <summary> Sets a RuleResult
		/// *
		/// </summary>
		/// <param name="aId">The UID of the RuleResult
		/// </param>
		/// <param name="aResult">The RuleResult
		/// 
		/// </param>
		public virtual void  SetResult(object aId, IBRERuleResult aResult)
		{
			if (results != null) {
                results[aId] = aResult;
			}
		}
		/// <summary> Sets a RuleResult
		/// *
		/// </summary>
		/// <param name="aId">The UID of the RuleResult
		/// </param>
		/// <param name="aResult">The RuleResult
		/// 
		/// </param>
		public virtual void  SetResult(object aId, IBRERuleResult aResult)
		{
			if (results != null) {
				if (results.Contains(aId)) results.Remove(aId);
				results.Add(aId, aResult);
			}
		}
Example #18
0
        /// <summary> This methods processes the Compare nodes that may exist in the XML.
        /// <P>
        /// The best comparison works when the object implements Comparable.
        /// </P>
        /// <P>
        /// If the object does not do so, it eliminates the &lt;,&gt;,&lt;=,&gt;=
        /// functionality as we are left with .equals(), !.equals(), and
        /// exception
        /// </P>
        /// </summary>
        /// <param name="aNode">The Node to process
        /// </param>
        /// <param name="aMap"/>
        /// <returns> True if the If stmt passes, False otherwise
        ///
        /// </returns>
        private Boolean ProcessCompareNode(XPathNavigator aNode, Hashtable aMap)
        {
            bool resultBool = false;

            // This is required in the XML, so we shouldn't have to worry about nulls....
            string leftId     = aNode.GetAttribute(COMPARE_ATTRS.LEFTID, String.Empty);
            string rightId    = aNode.GetAttribute(COMPARE_ATTRS.RIGHTID, String.Empty);
            string operatorId = aNode.GetAttribute(COMPARE_ATTRS.OPERATOR, String.Empty);

            IBREOperator ruleOperator = GetOperator(operatorId);

            if (ruleOperator != null)
            {
                // Get the results
                IBRERuleResult leftResult  = (IBRERuleResult)ruleContext.GetResult(leftId);
                IBRERuleResult rightResult = (IBRERuleResult)ruleContext.GetResult(rightId);

                // If it does not, consider a null in left or right members as exceptions!
                if ((!ruleOperator.AcceptsNulls) && (leftResult == null))
                {
                    DispatchException(new BREException("RuleResult " + leftId + " not found in RuleContext"), ExceptionEventImpl.ERROR);
                }
                else if ((!ruleOperator.AcceptsNulls) && (rightResult == null))
                {
                    DispatchException(new BREException("RuleResult " + rightId + " not found in RuleContext"), ExceptionEventImpl.ERROR);
                }
                else
                {
                    DispatchLog("Retrieved results for comparison", LogEventImpl.DEBUG);

                    object left  = (leftResult == null)?null:leftResult.Result;
                    object right = (rightResult == null)?null:rightResult.Result;

                    try
                    {
                        DispatchLog("BREOperator " + operatorId + " executing.", LogEventImpl.DEBUG);
                        resultBool = ruleOperator.ExecuteComparison(ruleContext, aMap, left, right);
                    }
                    catch (System.InvalidCastException)
                    {
                        DispatchException(new BREException("Specified BREOperator "
                                                           + operatorId
                                                           + " not of type BREOperator or objects being compared are not"
                                                           + " of the same type.\n"
                                                           + "Left Object Name:" + leftId
                                                           + "\nLeft Object Type:" + left.GetType().FullName
                                                           + "\nRight Object Name:" + rightId
                                                           + "\nRight Object Type:" + right.GetType().FullName
                                                           + "\n"),
                                          ExceptionEventImpl.FATAL);
                    }
                    catch (System.Exception e)
                    {
                        DispatchException(new BREException(e.ToString()), ExceptionEventImpl.FATAL);
                    }
                }
            }
            else
            {
                DispatchException(new BREException("Operator could not be loaded from BRERuleContext"), ExceptionEventImpl.FATAL);
            }

            DispatchLog("Compare result: " + resultBool, LogEventImpl.DEBUG);
            return(resultBool);
        }
Example #19
0
 private void flowEngine_ResultHandlers( object sender, IBRERuleResult ruleResult )
 {
     this.ruleResult = ruleResult;
 }
		public void DispatchRuleResult(IBRERuleResult ruleResult) {
			if (ResultHandlers != null)
				ResultHandlers(this, ruleResult);
		}
Example #21
0
        public bool ProcessRule(string ruleName, Dictionary <string, object> contextObjects)
        {
            IBRERuleResult ruleResult = null;

            return(ProcessRule(ruleName, contextObjects, out ruleResult));
        }
Example #22
0
 public virtual void handleBRERuleResult(object sender, IBRERuleResult aBRR)
 {
     resultCount++;
 }
Example #23
0
 /// <summary> Defines a new BRERuleException with a specific msg,
 /// and the resultSet that may have been created (nullable)
 /// </summary>
 /// <param name="aMsg">The error message
 /// </param>
 /// <param name="aBRR">The BusinessRuleResult that may have been created
 /// </param>
 public BRERuleException(string aMsg, IBRERuleResult aBRR) : base(aMsg)
 {
     brr = aBRR;
 }
Example #24
0
 /// <summary>This is the method that is required by the listener interface.  It 
 /// will get called whenever the LoginResult rule is executed
 /// </summary>
 public virtual void handleBRERuleResult(object sender, IBRERuleResult aBRR)
 {
     if (aBRR.MetaData.Id.Equals("LoginResult")) lockLogin = true;
 }
Example #25
0
        /// <summary> This method processes the XML Document.
        /// <P>
        /// This is a recursive alg. So be careful if editing it!!!!!!!
        /// </P>
        /// </summary>
        /// <param name="aNode">The Node to process
        /// </param>
        /// <param name="aSetId">The set to process</param>
        /// <param name="aObj">A bland object for anything
        /// </param>
        /// <returns> True if successful, False otherwise
        ///
        /// </returns>
        private object ProcessXML(XPathNavigator aNode, string aSetId, object aObj)
        {
            if ((aNode == null) || (!running))
            {
                return(null);
            }

            string nodeName = aNode.LocalName;

            if (Logger.IsFlowEngineVerbose)
            {
                Logger.FlowEngineSource.TraceEvent(TraceEventType.Verbose, 0, "Element Node: " + nodeName);
            }

            /*
             * A lot of this code is the same but it is broken up for
             * scalability reasons...
             */
            if (nodeName == BUSINESS_RULES)
            {
                // Instead of parsing all sub nodes perform an xPath pre-selection of nodes
                // depending if a set is selected or not.
                XPathNodeIterator selectedNodes;
                if (aSetId == null)
                {
                    selectedNodes = aNode.Select("*[count(ancestor-or-self::" + SET + ")=0]");
                }
                else
                {
                    selectedNodes = aNode.Select("*[count(ancestor-or-self::" + SET + ")=0] | " + SET + "[@" + SET_ATTRS.ID + "='" + aSetId + "']/*");
                }

                while (selectedNodes.MoveNext())
                {
                    ProcessXML(selectedNodes.Current, aSetId, aObj);
                }
            }
            else if (nodeName == COMPARE)
            {
                Hashtable map = new Hashtable();
                DoRecursion(aNode, aSetId, map);
                aObj = ProcessCompareNode(aNode, map);
                map  = null;
            }
            else if (nodeName == CONDITION)
            {
                aObj = ProcessConditionNode(aNode, aSetId, aObj);
            }
            else if (nodeName == DO)
            {
                DoRecursion(aNode, aSetId, aObj);
            }
            else if (nodeName == ELSE)
            {
                DoRecursion(aNode, aSetId, aObj);
            }
            else if (nodeName == FOREACH)
            {
                string resultToAssert    = aNode.GetAttribute(FOREACH_ATTRS.ID, String.Empty);
                string objectToEnumerate = aNode.GetAttribute(FOREACH_ATTRS.RULE_VALUE, String.Empty);

                IBRERuleResult ruleObjectToEnumerate = ruleContext.GetResult(objectToEnumerate);

                if (ruleObjectToEnumerate != null)
                {
                    IEnumerable enumerable = (IEnumerable)ruleObjectToEnumerate.Result;
                    if (enumerable != null)
                    {
                        foreach (object parser in enumerable)
                        {
                            ruleContext.SetObject(resultToAssert, parser);
                            DoRecursion(aNode, aSetId, aObj);
                        }
                    }
                }
            }
            else if ((nodeName == IF) || (nodeName == ELSEIF) || (nodeName == WHILE))
            {
                bool exitWhile = false;
                do
                {
                    bool firstChild            = true;
                    XPathNodeIterator children = aNode.SelectChildren(XPathNodeType.Element);

                    while ((children.MoveNext()) && (running))
                    {
                        // Thanks Sihong & Bernhard
                        aObj = ProcessXML(children.Current, aSetId, firstChild?null:aObj);

                        // Only the first child node is considered as test, the rest are executed blindely
                        if ((firstChild) && (aObj is System.Boolean) && (!Convert.ToBoolean(aObj)))
                        {
                            exitWhile = true;
                            break;
                        }

                        firstChild = false;
                    }
                } while ((nodeName == WHILE) && (!exitWhile) && (running));
            }
            else if (nodeName == INVOKESET)
            {
                ProcessInvokeSetNode(aNode);
            }
            else if (nodeName == LOG)
            {
                ProcessLogNode(aNode);
            }
            else if (nodeName == LOGIC)
            {
                XPathNodeIterator children = aNode.SelectChildren(XPathNodeType.Element);
                while ((children.MoveNext()) && (running))
                {
                    aObj = ProcessXML(children.Current, aSetId, aObj);
                    if ((aObj is System.Boolean) && (Convert.ToBoolean(aObj)))
                    {
                        break;
                    }
                }
            }
            else if (nodeName == PARAMETER)
            {
                if (aObj is Hashtable)
                {
                    ProcessParameterNode(aNode, (Hashtable)aObj);
                }
            }
            else if (nodeName == RETRACT)
            {
                string idToRetract = aNode.GetAttribute(RETRACT_ATTRS.ID, String.Empty);
                if (ruleContext.ResultsMap.Contains(idToRetract))
                {
                    ruleContext.ResultsMap.Remove(idToRetract);
                }
            }
            else if (nodeName == RULE)
            {
                Hashtable map = new Hashtable();
                DoRecursion(aNode, aSetId, map);
                ProcessRuleNode(aNode, map);
                map = null;
            }
            else if (nodeName == SET)
            {
                // If I reach a SET node, it has been pre-filtered at document level
                // therefore I process it blindely
                DoRecursion(aNode, aSetId, aObj);
            }

            return(aObj);
        }