You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ba...@apache.org on 2002/05/08 20:16:35 UTC
cvs commit: jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl PersistentProxy.java
baliuka 02/05/08 11:16:35
Modified: simplestore/src/java/org/apache/commons/simplestore/persistence/impl
PersistentProxy.java
Log:
Revision Changes Path
1.30 +21 -11 jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/PersistentProxy.java
Index: PersistentProxy.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/persistence/impl/PersistentProxy.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- PersistentProxy.java 8 May 2002 18:04:48 -0000 1.29
+++ PersistentProxy.java 8 May 2002 18:16:34 -0000 1.30
@@ -77,7 +77,7 @@
* baliuka@mwm.lt</a>
*@author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">
* g-froehlich@gmx.de</a>
- *@version $Id: PersistentProxy.java,v 1.29 2002/05/08 18:04:48 baliuka Exp $
+ *@version $Id: PersistentProxy.java,v 1.30 2002/05/08 18:16:34 baliuka Exp $
*/
public class PersistentProxy
implements MetaObject, org.apache.commons.simplestore.tools.Constants ,
@@ -322,32 +322,42 @@
throw new ValidationException(obj,method,obj2[0],validator.toString());
}
- Object value = getProperty(index);
+ Object oldValue = getProperty(index);
- if( value == null && obj2[0] == null ){
+ if( oldValue == null && obj2[0] == null ){
return null;
- }else if( ( value != null )&& value.equals(obj2[0]) ){
+ }else if( ( oldValue != null ) && oldValue.equals(obj2[0]) ){
return null;
}
- Object key = new KeyPair(m_clazz,new KeyPair(new Integer(index),value));
+ Object newValue = obj2[0];
+
+ if( m_metaClass.isReference(method) ){
+ if( obj2[0] != null ){
+ newValue = ((Persistent)obj2[0]).getOID();
+ }
+
+ setProperty(index, newValue );
+ }else{
+ setProperty(index, obj2[0]);
+
+ }
+
+
+ Object key = new KeyPair(m_clazz,new KeyPair(new Integer(index),oldValue));
java.util.Set set = (java.util.Set)m_context.getCache().get(key);
if( set != null )set.remove(m_object);
key = new KeyPair(m_clazz,
- new KeyPair(new Integer(index),obj2[0]));
+ new KeyPair(new Integer(index),newValue));
set = (java.util.Set)m_context.getCache().get(key);
if( set != null )set.add(m_object);
+
- if( obj2[0] != null && m_metaClass.isReference(method) ){
- setProperty(index, ((Persistent)obj2[0]).getOID());
- }else{
- setProperty(index, obj2[0]);
- }
setState(true,DIRTY);
return null;
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>