[seam-commits] Seam SVN: r9504 - branches/community/Seam_2_0/src/main/org/jboss/seam/contexts.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Tue Nov 4 18:54:11 EST 2008


Author: youngm
Date: 2008-11-04 18:54:11 -0500 (Tue, 04 Nov 2008)
New Revision: 9504

Modified:
   branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/BusinessProcessContext.java
   branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/Lifecycle.java
   branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/TestLifecycle.java
Log:
JBSEAM-3656

Modified: branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/BusinessProcessContext.java
===================================================================
--- branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/BusinessProcessContext.java	2008-11-04 23:53:17 UTC (rev 9503)
+++ branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/BusinessProcessContext.java	2008-11-04 23:54:11 UTC (rev 9504)
@@ -35,13 +35,25 @@
 
    private final Map<String, Object> additions = new HashMap<String, Object>();
    private final Set<String> removals = new HashSet<String>();
+   private final boolean enabled;
 
    public ScopeType getType()
    {
       return ScopeType.BUSINESS_PROCESS;
    }
 
-   public BusinessProcessContext() {}
+   public BusinessProcessContext()
+   {
+      Init init = Init.instance();
+      if (init == null)
+      {
+         enabled = false;
+      }
+      else
+      {
+         enabled = init.isJbpmInstalled();
+      }
+   }
    
    public Object get(String name) 
    {
@@ -208,8 +220,7 @@
 
    private org.jbpm.graph.exe.ProcessInstance getProcessInstance()
    {
-      Init init = Init.instance(); //may be null in some tests
-      if ( init==null || !init.isJbpmInstalled() ) 
+      if (!enabled)
       {
          return null;
       }
@@ -221,8 +232,7 @@
    
    private org.jbpm.taskmgmt.exe.TaskInstance getTaskInstance()
    {
-      Init init = Init.instance(); //may be null in some tests
-      if ( init==null || !init.isJbpmInstalled() ) 
+      if (!enabled)
       {
          return null;
       }

Modified: branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/Lifecycle.java
===================================================================
--- branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/Lifecycle.java	2008-11-04 23:53:17 UTC (rev 9503)
+++ branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/Lifecycle.java	2008-11-04 23:54:11 UTC (rev 9504)
@@ -81,11 +81,11 @@
    public static void beginCall()
    {
       log.debug( ">>> Begin call" );
+      Contexts.applicationContext.set( new ApplicationContext(getApplication()) );
       Contexts.eventContext.set( new BasicContext(ScopeType.EVENT) );
       Contexts.sessionContext.set( new BasicContext(ScopeType.SESSION) );
       Contexts.conversationContext.set( new BasicContext(ScopeType.CONVERSATION) );
       Contexts.businessProcessContext.set( new BusinessProcessContext() );
-      Contexts.applicationContext.set( new ApplicationContext(getApplication()) );
    }
 
    public static void endCall()

Modified: branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/TestLifecycle.java
===================================================================
--- branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/TestLifecycle.java	2008-11-04 23:53:17 UTC (rev 9503)
+++ branches/community/Seam_2_0/src/main/org/jboss/seam/contexts/TestLifecycle.java	2008-11-04 23:54:11 UTC (rev 9504)
@@ -29,11 +29,11 @@
    public static void beginTest(ServletContext context, Map<String, Object> session)
    {
       log.debug( ">>> Begin test" );
+      Contexts.applicationContext.set( new ApplicationContext( new ServletApplicationMap(context) ) );
       Contexts.eventContext.set( new BasicContext(ScopeType.EVENT) );
       Contexts.conversationContext.set( new BasicContext(ScopeType.CONVERSATION) );
       Contexts.businessProcessContext.set( new BusinessProcessContext() );
       Contexts.sessionContext.set( new SessionContext(session) );
-      Contexts.applicationContext.set( new ApplicationContext( new ServletApplicationMap(context) ) );
    }
 
    public static void endTest()




More information about the seam-commits mailing list