[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...

Gavin King gavin.king at jboss.com
Wed Jul 12 20:58:55 EDT 2006


  User: gavin   
  Date: 06/07/12 20:58:55

  Modified:    src/main/org/jboss/seam/interceptors 
                        ConversationInterceptor.java
  Log:
  control flushing from @Begin
  
  Revision  Changes    Path
  1.45      +32 -2     jboss-seam/src/main/org/jboss/seam/interceptors/ConversationInterceptor.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: ConversationInterceptor.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ConversationInterceptor.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -b -r1.44 -r1.45
  --- ConversationInterceptor.java	12 Jul 2006 20:44:58 -0000	1.44
  +++ ConversationInterceptor.java	13 Jul 2006 00:58:55 -0000	1.45
  @@ -1,4 +1,4 @@
  -//$Id: ConversationInterceptor.java,v 1.44 2006/07/12 20:44:58 gavin Exp $
  +//$Id: ConversationInterceptor.java,v 1.45 2006/07/13 00:58:55 gavin Exp $
   package org.jboss.seam.interceptors;
   
   import java.lang.reflect.Method;
  @@ -14,8 +14,10 @@
   import org.jboss.seam.annotations.BeginTask;
   import org.jboss.seam.annotations.End;
   import org.jboss.seam.annotations.EndTask;
  +import org.jboss.seam.annotations.FlushModeType;
   import org.jboss.seam.annotations.StartTask;
   import org.jboss.seam.annotations.Within;
  +import org.jboss.seam.core.Conversation;
   import org.jboss.seam.core.ConversationEntry;
   import org.jboss.seam.core.Interpolator;
   import org.jboss.seam.core.Manager;
  @@ -124,6 +126,7 @@
                  nested = method.getAnnotation(Begin.class).nested();
               }
               beginConversation( nested, getProcessDefinitionName(method) );
  +            setFlushMode(method); //TODO: what if conversation already exists? Or a nested conversation?
            }
         }
         else if ( method.isAnnotationPresent(Begin.class) )
  @@ -135,11 +138,38 @@
                     method.getAnnotation(Begin.class).nested(), 
                     getProcessDefinitionName(method) 
                  );
  +            setFlushMode(method); //TODO: what if conversation already exists? Or a nested conversation?
            }
         }
         
      }
   
  +   private void setFlushMode(Method method)
  +   {
  +      FlushModeType flushMode;
  +      if (method.isAnnotationPresent(Begin.class))
  +      {
  +         flushMode = method.getAnnotation(Begin.class).flushMode();
  +      }
  +      else if (method.isAnnotationPresent(BeginTask.class))
  +      {
  +         flushMode = method.getAnnotation(BeginTask.class).flushMode();
  +      }
  +      else if (method.isAnnotationPresent(StartTask.class))
  +      {
  +         flushMode = method.getAnnotation(StartTask.class).flushMode();
  +      }
  +      else
  +      {
  +         return;
  +      }
  +      
  +      if (flushMode!=FlushModeType.AUTO)
  +      {
  +         Conversation.instance().setFlushMode(flushMode);
  +      }
  +   }
  +
      private String getProcessDefinitionName(Method method) {
         if ( method.isAnnotationPresent(Begin.class) )
         {
  @@ -153,7 +183,7 @@
         {
            return method.getAnnotation(StartTask.class).pageflow();
         }
  -      //TODO: let them pass a pagelfow name as a request parameter
  +      //TODO: let them pass a pageflow name as a request parameter
         return "";
      }
   
  
  
  



More information about the jboss-cvs-commits mailing list