[seam-commits] Seam SVN: r9817 - in trunk/src/wicket/org/jboss/seam/wicket: annotations and 1 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Dec 22 11:20:30 EST 2008


Author: cpopetz
Date: 2008-12-22 11:20:30 -0500 (Mon, 22 Dec 2008)
New Revision: 9817

Added:
   trunk/src/wicket/org/jboss/seam/wicket/annotations/Begin.java
Modified:
   trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java
   trunk/src/wicket/org/jboss/seam/wicket/ioc/ConversationInterceptor.java
Log:
JBSEAM-3663: @Begin can annotate constructors in wicket


Modified: trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java	2008-12-22 16:17:48 UTC (rev 9816)
+++ trunk/src/wicket/org/jboss/seam/wicket/WicketComponent.java	2008-12-22 16:20:30 UTC (rev 9817)
@@ -321,6 +321,7 @@
    private void add(Constructor<T> constructor)
    {
       if ( constructor.isAnnotationPresent(Begin.class) || 
+            constructor.isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class) || 
             constructor.isAnnotationPresent(End.class) || 
             constructor.isAnnotationPresent(StartTask.class) ||
             constructor.isAnnotationPresent(BeginTask.class) ||
@@ -362,6 +363,7 @@
       }
       
       if ( method.isAnnotationPresent(Begin.class) || 
+            method.isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class) || 
             method.isAnnotationPresent(End.class) || 
             method.isAnnotationPresent(StartTask.class) ||
             method.isAnnotationPresent(BeginTask.class) ||

Added: trunk/src/wicket/org/jboss/seam/wicket/annotations/Begin.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/annotations/Begin.java	                        (rev 0)
+++ trunk/src/wicket/org/jboss/seam/wicket/annotations/Begin.java	2008-12-22 16:20:30 UTC (rev 9817)
@@ -0,0 +1,42 @@
+//$Id: Begin.java 6884 2007-12-03 06:26:39Z sbryzak2 $
+package org.jboss.seam.wicket.annotations;
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import org.jboss.seam.annotations.FlushModeType;
+/**
+ * A version of the core @Begin annotation which can be placed on wicket component constructors.
+ * The wicket interceptor will scan for this as well as the default @Begin annotation.  They
+ * are identical in function, but java does not allow annotation inheritance.  In addition, the 
+ * deprecated ifOutcome and id methods have been removed, and the pageflow method as well, as it is
+ * not as yet supported in wicket.
+ */
+ at Target({METHOD,CONSTRUCTOR})
+ at Retention(RUNTIME)
+ at Documented
+public @interface Begin 
+{
+   /**
+    * If enabled, and if a conversation is already active,
+    * begin a nested conversation, instead of continuing
+    * in the context of the existing conversation.
+    */
+   boolean nested() default false;
+   /**
+    * If false (the default), invocation of the begin
+    * method in the scope of an existing conversation
+    * will cause an exception to be thrown.
+    */
+   boolean join() default false;
+   /**
+    * Set the FlushMode for any EntityManager used in
+    * this conversation.
+    */
+   FlushModeType flushMode() default FlushModeType.AUTO;
+
+}

Modified: trunk/src/wicket/org/jboss/seam/wicket/ioc/ConversationInterceptor.java
===================================================================
--- trunk/src/wicket/org/jboss/seam/wicket/ioc/ConversationInterceptor.java	2008-12-22 16:17:48 UTC (rev 9816)
+++ trunk/src/wicket/org/jboss/seam/wicket/ioc/ConversationInterceptor.java	2008-12-22 16:20:30 UTC (rev 9817)
@@ -125,6 +125,11 @@
                   !invocationContext.getAccessibleObject().getAnnotation(Begin.class).join() && 
                   !invocationContext.getAccessibleObject().getAnnotation(Begin.class).nested() 
             ) ||
+            ( 
+                  invocationContext.getAccessibleObject().isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class) && 
+                  !invocationContext.getAccessibleObject().getAnnotation(org.jboss.seam.wicket.annotations.Begin.class).join() && 
+                  !invocationContext.getAccessibleObject().getAnnotation(org.jboss.seam.wicket.annotations.Begin.class).nested() 
+            ) ||
             invocationContext.getAccessibleObject().isAnnotationPresent(BeginTask.class) ||
             invocationContext.getAccessibleObject().isAnnotationPresent(StartTask.class) 
          );
@@ -137,6 +142,7 @@
       boolean simpleBegin = 
             invocationContext.getAccessibleObject().isAnnotationPresent(StartTask.class) || 
             invocationContext.getAccessibleObject().isAnnotationPresent(BeginTask.class) ||
+            invocationContext.getAccessibleObject().isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class) ||
             ( invocationContext.getAccessibleObject().isAnnotationPresent(Begin.class) && invocationContext.getAccessibleObject().getAnnotation(Begin.class).ifOutcome().length==0 );
       if ( simpleBegin )
       {
@@ -147,6 +153,10 @@
             {
                nested = invocationContext.getAccessibleObject().getAnnotation(Begin.class).nested();
             }
+            else if ( invocationContext.getAccessibleObject().isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class) )
+            {
+               nested = invocationContext.getAccessibleObject().getAnnotation(org.jboss.seam.wicket.annotations.Begin.class).nested();
+            }
             beginConversation( nested, getProcessDefinitionName(invocationContext) );
             setFlushMode(invocationContext); //TODO: what if conversation already exists? Or a nested conversation?
          }
@@ -173,6 +183,10 @@
       {
          flushMode = invocationContext.getAccessibleObject().getAnnotation(Begin.class).flushMode();
       }
+      else if (invocationContext.getAccessibleObject().isAnnotationPresent(org.jboss.seam.wicket.annotations.Begin.class))
+      {
+         flushMode = invocationContext.getAccessibleObject().getAnnotation(org.jboss.seam.wicket.annotations.Begin.class).flushMode();
+      }
       else if (invocationContext.getAccessibleObject().isAnnotationPresent(BeginTask.class))
       {
          flushMode = invocationContext.getAccessibleObject().getAnnotation(BeginTask.class).flushMode();




More information about the seam-commits mailing list