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

Gavin King gavin.king at jboss.com
Wed Jul 12 16:44:58 EDT 2006


  User: gavin   
  Date: 06/07/12 16:44:58

  Modified:    src/main/org/jboss/seam/interceptors 
                        ConversationInterceptor.java
  Log:
  added beforeRedirect to @End
  
  Revision  Changes    Path
  1.44      +16 -10    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.43
  retrieving revision 1.44
  diff -u -b -r1.43 -r1.44
  --- ConversationInterceptor.java	28 Jun 2006 22:03:27 -0000	1.43
  +++ ConversationInterceptor.java	12 Jul 2006 20:44:58 -0000	1.44
  @@ -1,4 +1,4 @@
  -//$Id: ConversationInterceptor.java,v 1.43 2006/06/28 22:03:27 gavin Exp $
  +//$Id: ConversationInterceptor.java,v 1.44 2006/07/12 20:44:58 gavin Exp $
   package org.jboss.seam.interceptors;
   
   import java.lang.reflect.Method;
  @@ -183,39 +183,45 @@
   
      private void endConversationIfNecessary(Method method, Object result)
      {
  +      boolean isEndAnnotation = method.isAnnotationPresent(End.class);
  +      boolean isEndTaskAnnotation = method.isAnnotationPresent(EndTask.class);
  +      
  +      boolean beforeRedirect = ( isEndAnnotation && method.getAnnotation(End.class).beforeRedirect() ) ||
  +            ( isEndTaskAnnotation && method.getAnnotation(EndTask.class).beforeRedirect() );
  +      
         boolean simpleEnd = 
  -            ( method.isAnnotationPresent(End.class) && method.getAnnotation(End.class).ifOutcome().length==0 ) || 
  -            ( method.isAnnotationPresent(EndTask.class) && method.getAnnotation(EndTask.class).ifOutcome().length==0 );
  +            ( isEndAnnotation && method.getAnnotation(End.class).ifOutcome().length==0 ) || 
  +            ( isEndTaskAnnotation && method.getAnnotation(EndTask.class).ifOutcome().length==0 );
         if ( simpleEnd )
         {
            if ( result!=null || method.getReturnType().equals(void.class) ) //null outcome interpreted as redisplay
            {
  -            endConversation();
  +            endConversation(beforeRedirect);
            }
         }
  -      else if ( method.isAnnotationPresent(End.class) )
  +      else if ( isEndAnnotation )
         {
            String[] outcomes = method.getAnnotation(End.class).ifOutcome();
            if ( Arrays.asList(outcomes).contains(result) )
            {
  -            endConversation();
  +            endConversation(beforeRedirect);
            }
         }
  -      else if ( method.isAnnotationPresent(EndTask.class) )
  +      else if ( isEndTaskAnnotation )
         {
            //TODO: fix minor code duplication
            String[] outcomes = method.getAnnotation(EndTask.class).ifOutcome();
            if ( Arrays.asList(outcomes).contains(result) )
            {
  -            endConversation();
  +            endConversation(beforeRedirect);
            }
         }
      }
   
  -   private void endConversation()
  +   private void endConversation(boolean beforeRedirect)
      {
         log.debug("Ending long-running conversation");
  -      Manager.instance().endConversation();
  +      Manager.instance().endConversation(false);
      }
   
   }
  
  
  



More information about the jboss-cvs-commits mailing list