[seam-commits] Seam SVN: r8912 - trunk/src/main/org/jboss/seam/persistence.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Sep 4 12:17:20 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-09-04 12:17:19 -0400 (Thu, 04 Sep 2008)
New Revision: 8912

Modified:
   trunk/src/main/org/jboss/seam/persistence/ManagedEntityIdentityInterceptor.java
Log:
ws

Modified: trunk/src/main/org/jboss/seam/persistence/ManagedEntityIdentityInterceptor.java
===================================================================
--- trunk/src/main/org/jboss/seam/persistence/ManagedEntityIdentityInterceptor.java	2008-09-04 15:57:45 UTC (rev 8911)
+++ trunk/src/main/org/jboss/seam/persistence/ManagedEntityIdentityInterceptor.java	2008-09-04 16:17:19 UTC (rev 8912)
@@ -10,47 +10,54 @@
 import org.jboss.seam.transaction.Transaction;
 
 /**
- * Swizzles entity references around each invocation, maintaining
- * referential integrity even across passivation of the stateful 
- * bean or Seam-managed extended persistence context, and allowing 
- * for more efficient replication.
+ * Swizzles entity references around each invocation, maintaining referential
+ * integrity even across passivation of the stateful bean or Seam-managed
+ * extended persistence context, and allowing for more efficient replication.
  * 
  * @author Gavin King
- *
+ * 
  */
- at Interceptor(around=BijectionInterceptor.class)
+ at Interceptor(around = BijectionInterceptor.class)
 public class ManagedEntityIdentityInterceptor extends AbstractInterceptor
 {
-    
-    private static ManagedEntityStateManager managedEntityStateManager = new ManagedEntityStateManager();
-   
-    private boolean reentrant;
-    //TODO: cache the non-ignored fields, probably on Component
-    
-    public boolean isInterceptorEnabled()
-    {
-       return getComponent().getScope() == CONVERSATION;
-    }
-   
-    @AroundInvoke
-    public Object aroundInvoke(InvocationContext ctx) throws Exception
-    {
-        if (reentrant) {
+
+   private static ManagedEntityStateManager managedEntityStateManager = new ManagedEntityStateManager();
+
+   private boolean reentrant;
+
+   // TODO: cache the non-ignored fields, probably on Component
+
+   public boolean isInterceptorEnabled()
+   {
+      return getComponent().getScope() == CONVERSATION;
+   }
+
+   @AroundInvoke
+   public Object aroundInvoke(InvocationContext ctx) throws Exception
+   {
+      if (reentrant)
+      {
+         return ctx.proceed();
+      }
+      else
+      {
+         reentrant = true;
+         managedEntityStateManager.entityIdsToRefs(ctx.getTarget(), getComponent());
+         try
+         {
             return ctx.proceed();
-        } else {
-            reentrant = true;
-            managedEntityStateManager.entityIdsToRefs(ctx.getTarget(), getComponent());
-            try  {
-                return ctx.proceed();
-            } finally {
-                if (!isTransactionRolledBackOrMarkedRollback()) {
-                    managedEntityStateManager.entityRefsToIds(ctx.getTarget(), getComponent());
-                    reentrant = false;
-                }
+         }
+         finally
+         {
+            if (!isTransactionRolledBackOrMarkedRollback())
+            {
+               managedEntityStateManager.entityRefsToIds(ctx.getTarget(), getComponent());
+               reentrant = false;
             }
-        }
-    }
-    
+         }
+      }
+   }
+
    private static boolean isTransactionRolledBackOrMarkedRollback()
    {
       try
@@ -62,6 +69,5 @@
          return false;
       }
    }
-   
-   
+
 }




More information about the seam-commits mailing list