[jbpm-commits] JBoss JBPM SVN: r1540 - pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/descriptor.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Jul 8 05:20:46 EDT 2008


Author: porcherg
Date: 2008-07-08 05:20:46 -0400 (Tue, 08 Jul 2008)
New Revision: 1540

Modified:
   pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
Log:
autoWire search for objects in current environment

Modified: pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java
===================================================================
--- pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java	2008-07-08 08:19:11 UTC (rev 1539)
+++ pvm/trunk/modules/core/src/main/java/org/jbpm/pvm/internal/wire/descriptor/ObjectDescriptor.java	2008-07-08 09:20:46 UTC (rev 1540)
@@ -284,9 +284,20 @@
               autoWireValue = wireContext.get(fieldName);
 
             } else {
-              autoWireValue = wireContext.get(field.getType());
+              autoWireValue = wireContext.get(field.getType());  
             }
-
+            // if auto wire value has not been found in current context, 
+            // search in environment
+            if (autoWireValue == null) {
+              Environment currentEnvironment = Environment.getCurrent();
+              if (currentEnvironment != null) {
+                autoWireValue = currentEnvironment.get(fieldName); 
+                if (autoWireValue == null) {
+                  autoWireValue = currentEnvironment.get(field.getType());
+                }
+              }
+            }
+            
             if (autoWireValue!=null) {
               try {
                 log.debug("auto wiring field "+fieldName+" in "+name);




More information about the jbpm-commits mailing list