[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...
Gavin King
gavin.king at jboss.com
Tue Oct 31 15:09:22 EST 2006
User: gavin
Date: 06/10/31 15:09:22
Modified: src/main/org/jboss/seam/interceptors
ConversationInterceptor.java
ManagedEntityIdentityInterceptor.java
Log:
introduced <page switch=disabled/>
breaking changes to how conversation switching works
fix a bug where destroy methods caused an exception in ManagedEntityIdentityInterceptor
Revision Changes Path
1.52 +13 -18 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.51
retrieving revision 1.52
diff -u -b -r1.51 -r1.52
--- ConversationInterceptor.java 13 Oct 2006 05:30:26 -0000 1.51
+++ ConversationInterceptor.java 31 Oct 2006 20:09:22 -0000 1.52
@@ -1,4 +1,4 @@
-//$Id: ConversationInterceptor.java,v 1.51 2006/10/13 05:30:26 gavin Exp $
+//$Id: ConversationInterceptor.java,v 1.52 2006/10/31 20:09:22 gavin Exp $
package org.jboss.seam.interceptors;
import java.lang.reflect.Method;
@@ -47,25 +47,20 @@
throw new IllegalStateException("begin method invoked from a long running conversation, try using @Begin(join=true)");
}
- String outcome = getOutcomeForConversationId(method);
- if (outcome!=null)
+ if ( redirectToExistingConversation(method) )
{
- if ( !method.getReturnType().equals(String.class) )
- {
- throw new IllegalStateException("begin method return type was not a string");
- }
- return outcome;
+ return null;
}
-
+ else
+ {
Object result = invocation.proceed();
-
beginConversationIfNecessary(method, result);
endConversationIfNecessary(method, result);
return result;
-
+ }
}
- public String getOutcomeForConversationId(Method method)
+ public boolean redirectToExistingConversation(Method method)
{
String id = null;
if ( method.isAnnotationPresent(Begin.class) )
@@ -91,11 +86,11 @@
}
else
{
- return ce.select();
+ return ce.switchConversation();
}
}
- return null;
+ return false;
}
private boolean isMissingJoin(Method method) {
1.11 +10 -5 jboss-seam/src/main/org/jboss/seam/interceptors/ManagedEntityIdentityInterceptor.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ManagedEntityIdentityInterceptor.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/interceptors/ManagedEntityIdentityInterceptor.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- ManagedEntityIdentityInterceptor.java 19 Oct 2006 22:12:37 -0000 1.10
+++ ManagedEntityIdentityInterceptor.java 31 Oct 2006 20:09:22 -0000 1.11
@@ -74,9 +74,14 @@
public Object aroundInvoke(InvocationContext ctx) throws Exception
{
entityIdsToRefs(ctx);
- Object result = ctx.proceed();
+ try
+ {
+ return ctx.proceed();
+ }
+ finally
+ {
entityRefsToIds(ctx);
- return result;
+ }
}
public void entityRefsToIds(InvocationContext ctx) throws Exception
@@ -112,13 +117,13 @@
if (persistenceContext instanceof EntityManager)
{
EntityManager em = (EntityManager) persistenceContext;
- managed = em.contains(value);
+ managed = em.isOpen() && em.contains(value);
id = managed ? PersistenceProvider.instance().getId(value, em) : null;
}
else
{
Session session = (Session) persistenceContext;
- managed = session.contains(value);
+ managed = session.isOpen() && session.contains(value);
id = managed ? session.getIdentifier(value) : null;
}
if (managed)
More information about the jboss-cvs-commits
mailing list