[jboss-svn-commits] JBL Code SVN: r10811 - labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Apr 7 17:02:52 EDT 2007


Author: mark.proctor at jboss.com
Date: 2007-04-07 17:02:52 -0400 (Sat, 07 Apr 2007)
New Revision: 10811

Modified:
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/DefaultKnowledgeHelper.java
Log:
JBRULES-778 column fact handle used in consequences even for field bindings
-handle is reset to null if its a bound field, knowledgehelper attempts to lookup 
 the handle from the working memory if its null.

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/DefaultKnowledgeHelper.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/DefaultKnowledgeHelper.java	2007-04-07 16:09:32 UTC (rev 10810)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/DefaultKnowledgeHelper.java	2007-04-07 21:02:52 UTC (rev 10811)
@@ -90,12 +90,21 @@
                                          this.activation );
     }
 
-    public void modifyObject(final FactHandle handle,
+    public void modifyObject(FactHandle handle,
                              final Object newObject) throws FactException {
-        this.workingMemory.modifyObject( handle,
-                                         newObject,
-                                         this.rule,
-                                         this.activation );
+    	if ( handle == null ) {
+    		// no fact handle exists for this object, so it must be a bound field
+    		// check if that bound field is still a fact in the WM
+    		handle = this.workingMemory.getFactHandle( newObject );
+    	}
+    	
+    	if (  handle != null ) {
+    		// only modify if this fact exists in the wm
+	        this.workingMemory.modifyObject( handle,
+	                                         newObject,
+	                                         this.rule,
+	                                         this.activation );
+    	}
     }
 
     public void retractObject(final FactHandle handle) throws FactException {




More information about the jboss-svn-commits mailing list