[cvs] expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj DBObject.java

JCorporate Ltd jcorp at jcorp2.servlets.net
Thu Aug 12 13:05:24 PDT 2004


Update of /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj
In directory jcorp2.servlets.net:/tmp/cvs-serv3563/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj

Modified Files:
	DBObject.java 
Log Message:
add method so that update() and add() can indicate when to cache the current field value as the 'original' value for purposes of isChanged() comparison


Index: DBObject.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/DBObject.java,v
retrieving revision 1.200
retrieving revision 1.201
diff -C2 -d -r1.200 -r1.201
*** DBObject.java	6 Aug 2004 19:03:39 -0000	1.200
--- DBObject.java	12 Aug 2004 20:05:22 -0000	1.201
***************
*** 516,524 ****
          } /* if */
  
! 
          setStatus(BaseDataObject.STATUS_CURRENT);
          notifyListeners(EVENT_ADD);
      } /* add() */
  
  
      /**
--- 516,536 ----
          } /* if */
  
!         // after add(), we know that 'current' values are now the baseline for comparison
!         cacheIsChangedComparison();
          setStatus(BaseDataObject.STATUS_CURRENT);
          notifyListeners(EVENT_ADD);
      } /* add() */
  
+     /**
+      * call when add() or update() has occurred, and currentValue of data fields should be considered 'original value' for purposes of determining 'isChanged'
+      */
+     public void cacheIsChangedComparison() throws DBException {
+         for (Iterator i = getMetaData().getFieldListArray().iterator(); i.hasNext();) {
+             String oneFieldName = (String) i.next();
+             DataField field = getDataField(oneFieldName);
+             field.cacheIsChangedComparison();
+         }
+     }
+ 
  
      /**
***************
*** 7067,7070 ****
--- 7079,7085 ----
              update(false);
          }
+ 
+         // after update, we know that 'current' values are now the baseline for comparison
+         cacheIsChangedComparison();
      }
  



More information about the cvs mailing list