[jboss-cvs] jboss-seam/src/main/org/jboss/seam/persistence ...
Gavin King
gavin.king at jboss.com
Thu Jul 12 09:47:25 EDT 2007
User: gavin
Date: 07/07/12 09:47:25
Modified: src/main/org/jboss/seam/persistence
ManagedEntityIdentityInterceptor.java
Log:
fix two bugs
Revision Changes Path
1.2 +21 -2 jboss-seam/src/main/org/jboss/seam/persistence/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/persistence/ManagedEntityIdentityInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ManagedEntityIdentityInterceptor.java 25 Jun 2007 23:59:31 -0000 1.1
+++ ManagedEntityIdentityInterceptor.java 12 Jul 2007 13:47:24 -0000 1.2
@@ -7,6 +7,8 @@
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.jboss.seam.Seam;
import org.jboss.seam.annotations.In;
@@ -88,6 +90,14 @@
{
saveWrapper(bean, field, dataModel, value);
}
+ else
+ {
+ clearWrapper(field);
+ }
+ }
+ else
+ {
+ clearWrapper(field);
}
}
}
@@ -123,8 +133,12 @@
private boolean isRef(Object value)
{
- //TODO: can do better than this for lists!
- return value instanceof List || Seam.isEntityClass( value.getClass() );
+ //TODO: could do better by checking if the
+ // collection really contains an entity
+ return value instanceof List ||
+ value instanceof Map ||
+ value instanceof Set ||
+ Seam.isEntityClass( value.getClass() );
}
private Object getFieldValue(Object bean, Field field) throws Exception
@@ -165,6 +179,11 @@
}
}
+ private void clearWrapper(Field field) throws Exception
+ {
+ Contexts.getConversationContext().remove( getFieldId(field) );
+ }
+
private void getFromWrapper(Object bean, Field field, Object dataModel) throws Exception
{
Object value = Contexts.getConversationContext().get( getFieldId(field) );
More information about the jboss-cvs-commits
mailing list