myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r963054 - in /myfaces/extensions/cdi/trunk: core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ je...
Date Sun, 11 Jul 2010 11:33:59 GMT
Author: gpetracek
Date: Sun Jul 11 11:33:58 2010
New Revision: 963054

URL: http://svn.apache.org/viewvc?rev=963054&view=rev
Log:
EXTCDI-1, EXTCDI-2 and EXTCDI-3 refactoring for simpler usage

Added:
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/DefaultGroup.java
      - copied, changed from r962943, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationGroup.java
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ViewAccessGroup.java
      - copied, changed from r962943, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ViewAccess.java
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowGroup.java
      - copied, changed from r962943, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Window.java
Removed:
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ViewAccess.java
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Window.java
Modified:
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationGroup.java
    myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationScoped.java
    myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean1.java
    myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean2.java
    myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean3.java
    myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean4.java
    myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationGroup1.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversation.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/GroupedConversationContextAdapter.java

Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationGroup.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationGroup.java?rev=963054&r1=963053&r2=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationGroup.java
(original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationGroup.java
Sun Jul 11 11:33:58 2010
@@ -18,20 +18,11 @@
  */
 package org.apache.myfaces.extensions.cdi.core.api.scope.conversation;
 
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-
 /**
  * TODO refactor it
  *
  * @author Gerhard Petracek
  */
-@Target({TYPE})
-@Retention(RUNTIME)
-public @interface ConversationGroup
+public interface ConversationGroup
 {
-    Class value();
 }
\ No newline at end of file

Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationScoped.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationScoped.java?rev=963054&r1=963053&r2=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationScoped.java
(original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationScoped.java
Sun Jul 11 11:33:58 2010
@@ -37,4 +37,5 @@ import static java.lang.annotation.Reten
 @Inherited
 public @interface ConversationScoped
 {
+    Class<? extends ConversationGroup> value() default DefaultGroup.class;
 }                 

Copied: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/DefaultGroup.java
(from r962943, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationGroup.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/DefaultGroup.java?p2=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/DefaultGroup.java&p1=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationGroup.java&r1=962943&r2=963054&rev=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationGroup.java
(original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/DefaultGroup.java
Sun Jul 11 11:33:58 2010
@@ -18,20 +18,11 @@
  */
 package org.apache.myfaces.extensions.cdi.core.api.scope.conversation;
 
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-
 /**
  * TODO refactor it
  *
  * @author Gerhard Petracek
  */
-@Target({TYPE})
-@Retention(RUNTIME)
-public @interface ConversationGroup
+public interface DefaultGroup extends ConversationGroup
 {
-    Class value();
 }
\ No newline at end of file

Copied: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ViewAccessGroup.java
(from r962943, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ViewAccess.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ViewAccessGroup.java?p2=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ViewAccessGroup.java&p1=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ViewAccess.java&r1=962943&r2=963054&rev=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ViewAccess.java
(original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ViewAccessGroup.java
Sun Jul 11 11:33:58 2010
@@ -18,17 +18,9 @@
  */
 package org.apache.myfaces.extensions.cdi.core.api.scope.conversation;
 
-import static java.lang.annotation.ElementType.TYPE;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-
-
 /**
  * @author Gerhard Petracek
  */
-@Target({TYPE})
-@Retention(RUNTIME)
-public @interface ViewAccess
+public interface ViewAccessGroup extends ConversationGroup
 {
 }
\ No newline at end of file

Copied: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowGroup.java
(from r962943, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Window.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowGroup.java?p2=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowGroup.java&p1=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Window.java&r1=962943&r2=963054&rev=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Window.java
(original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowGroup.java
Sun Jul 11 11:33:58 2010
@@ -18,17 +18,9 @@
  */
 package org.apache.myfaces.extensions.cdi.core.api.scope.conversation;
 
-import static java.lang.annotation.ElementType.TYPE;
-import java.lang.annotation.Retention;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-import java.lang.annotation.Target;
-
-
 /**
  * @author Gerhard Petracek
  */
-@Target({TYPE})
-@Retention(RUNTIME)
-public @interface Window
+public interface WindowGroup extends ConversationGroup
 {
 }
\ No newline at end of file

Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean1.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean1.java?rev=963054&r1=963053&r2=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean1.java
(original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean1.java
Sun Jul 11 11:33:58 2010
@@ -19,7 +19,6 @@
 package org.apache.myfaces.blank.conversation.grouped;
 
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationGroup;
 
 import javax.inject.Named;
 import javax.annotation.PostConstruct;
@@ -30,8 +29,7 @@ import java.util.Date;
  * @author Gerhard Petracek
  */
 @Named
-@ConversationScoped
-@ConversationGroup(ConversationGroup1.class)
+@ConversationScoped(ConversationGroup1.class)
 public class ConversationDemoBean1 implements Serializable
 {
     private String value = "Hello grouped conversation1! ";

Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean2.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean2.java?rev=963054&r1=963053&r2=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean2.java
(original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean2.java
Sun Jul 11 11:33:58 2010
@@ -19,7 +19,6 @@
 package org.apache.myfaces.blank.conversation.grouped;
 
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationGroup;
 
 import javax.inject.Named;
 import javax.annotation.PostConstruct;
@@ -30,8 +29,7 @@ import java.util.Date;
  * @author Gerhard Petracek
  */
 @Named
-@ConversationScoped
-@ConversationGroup(ConversationGroup1.class)
+@ConversationScoped(ConversationGroup1.class)
 public class ConversationDemoBean2 implements Serializable
 {
     private String value = "Hello grouped conversation2! ";

Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean3.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean3.java?rev=963054&r1=963053&r2=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean3.java
(original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean3.java
Sun Jul 11 11:33:58 2010
@@ -19,7 +19,7 @@
 package org.apache.myfaces.blank.conversation.grouped;
 
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.Window;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowGroup;
 
 import javax.inject.Named;
 import javax.annotation.PostConstruct;
@@ -30,8 +30,7 @@ import java.util.Date;
  * @author Gerhard Petracek
  */
 @Named
-@Window
-@ConversationScoped
+@ConversationScoped(WindowGroup.class)
 public class ConversationDemoBean3 implements Serializable
 {
     private String value = "Hello window conversation! ";

Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean4.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean4.java?rev=963054&r1=963053&r2=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean4.java
(original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean4.java
Sun Jul 11 11:33:58 2010
@@ -19,7 +19,7 @@
 package org.apache.myfaces.blank.conversation.grouped;
 
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ViewAccess;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ViewAccessGroup;
 
 import javax.inject.Named;
 import javax.annotation.PostConstruct;
@@ -30,8 +30,7 @@ import java.util.Date;
  * @author Gerhard Petracek
  */
 @Named
-@ViewAccess
-@ConversationScoped
+@ConversationScoped(ViewAccessGroup.class)
 public class ConversationDemoBean4 implements Serializable
 {
     private String value = "Hello view access scoped! ";

Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationGroup1.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationGroup1.java?rev=963054&r1=963053&r2=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationGroup1.java
(original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationGroup1.java
Sun Jul 11 11:33:58 2010
@@ -18,9 +18,11 @@
  */
 package org.apache.myfaces.blank.conversation.grouped;
 
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationGroup;
+
 /**
  * @author Gerhard Petracek
  */
-interface ConversationGroup1
+interface ConversationGroup1 extends ConversationGroup
 {
 }

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversation.java?rev=963054&r1=963053&r2=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversation.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversation.java
Sun Jul 11 11:33:58 2010
@@ -19,8 +19,9 @@
 package org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation;
 
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.Conversation;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ViewAccess;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.Window;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ViewAccessGroup;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowGroup;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped;
 import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.BeanEntry;
 import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.EditableConversation;
 
@@ -52,15 +53,12 @@ public class DefaultConversation impleme
 
     private Date lastAccess;
 
-    public DefaultConversation(Class groupKey, int conversationTimeoutInMinutes)
+    public DefaultConversation(Class<?> groupKey, int conversationTimeoutInMinutes)
     {
         this.groupKey = groupKey;
-        this.windowScoped = Window.class.isAssignableFrom(groupKey);
+        this.windowScoped = WindowGroup.class.isAssignableFrom(groupKey);
 
-        if (groupKey.isAnnotationPresent(ViewAccess.class))
-        {
-            this.lastViewId = getCurrentViewId();
-        }
+        tryToProcessAccessViewScope(groupKey);
 
         this.beanStorage = new BeanStorage();
         this.conversationTimeoutInMs = conversationTimeoutInMinutes * 60000;
@@ -113,10 +111,7 @@ public class DefaultConversation impleme
 
     public <T> void addBean(Class<?> beanClass, BeanEntry<T> beanEntry)
     {
-        if (beanEntry.getBean().getBeanClass().isAnnotationPresent(ViewAccess.class))
-        {
-            this.lastViewId = getCurrentViewId();
-        }
+        tryToProcessAccessViewScope(beanClass);
 
         //TODO check if conversation is active
         touchConversation();
@@ -171,4 +166,13 @@ public class DefaultConversation impleme
     {
         return FacesContext.getCurrentInstance().getViewRoot().getViewId();
     }
+
+    private void tryToProcessAccessViewScope(Class<?> groupKey)
+    {
+        ConversationScoped conversationScoped = groupKey.getAnnotation(ConversationScoped.class);
+        if (conversationScoped != null && ViewAccessGroup.class.isAssignableFrom(conversationScoped.value()))
+        {
+            this.lastViewId = getCurrentViewId();
+        }
+    }
 }

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/GroupedConversationContextAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/GroupedConversationContextAdapter.java?rev=963054&r1=963053&r2=963054&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/GroupedConversationContextAdapter.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/GroupedConversationContextAdapter.java
Sun Jul 11 11:33:58 2010
@@ -19,8 +19,10 @@
 package org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation;
 
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.Conversation;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationGroup;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.Window;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationScoped;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.DefaultGroup;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowGroup;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ViewAccessGroup;
 import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.AbstractConversationContextAdapter;
 import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.BeanEntry;
 import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.EditableConversation;
@@ -75,7 +77,7 @@ public class GroupedConversationContextA
     protected <T> T resolveBeanInstance(WindowContextManager conversationManager, Bean<T>
beanDescriptor)
     {
         Class<?> beanClass = beanDescriptor.getBeanClass();
-        Conversation foundConversation = getConversation(conversationManager, beanClass);
+        Conversation foundConversation = getConversation(conversationManager, beanDescriptor);
 
         //noinspection unchecked
         return (T) foundConversation.getBean(beanClass);
@@ -83,32 +85,33 @@ public class GroupedConversationContextA
 
     protected <T> void scopeBeanEntry(WindowContextManager conversationManager, BeanEntry<T>
beanEntry)
     {
-        Class<?> beanClass = beanEntry.getBean().getBeanClass();
-        Conversation foundConversation = getConversation(conversationManager, beanClass);
+        Bean<?> bean = beanEntry.getBean();
+        Conversation foundConversation = getConversation(conversationManager, bean);
 
-        ((EditableConversation) foundConversation).addBean(beanClass, beanEntry);
+        ((EditableConversation) foundConversation).addBean(bean.getBeanClass(), beanEntry);
     }
 
-    private Conversation getConversation(WindowContextManager conversationManager, Class<?>
beanClass)
+    private Conversation getConversation(WindowContextManager conversationManager, Bean<?>
beanClass)
     {
         Class conversationGroup = getConversationGroup(beanClass);
 
         return conversationManager.getCurrentWindowContext().getConversation(conversationGroup);
     }
 
-    private Class getConversationGroup(Class<?> beanClass)
+    private Class getConversationGroup(Bean<?> bean)
     {
-        ConversationGroup conversationGroupAnnotation = beanClass.getAnnotation(ConversationGroup.class);
+        Class groupClass = bean.getBeanClass().getAnnotation(ConversationScoped.class).value();
 
-        if (conversationGroupAnnotation != null)
+        if(DefaultGroup.class.isAssignableFrom(groupClass) || ViewAccessGroup.class.isAssignableFrom(groupClass))
         {
-            return conversationGroupAnnotation.value();
+            return bean.getBeanClass();
         }
 
-        if (beanClass.isAnnotationPresent(Window.class))
+        if(WindowGroup.class.isAssignableFrom(groupClass))
         {
-            return Window.class;
+            return WindowGroup.class;
         }
-        return beanClass;
+
+        return groupClass;
     }
 }
\ No newline at end of file



Mime
View raw message