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

JCorporate Ltd jcorp at jcorp2.servlets.net
Thu Aug 12 23:07:56 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-serv21978/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj

Modified Files:
	DBObject.java 
Log Message:
add method so that methods like 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.201
retrieving revision 1.202
diff -C2 -d -r1.201 -r1.202
*** DBObject.java	12 Aug 2004 20:05:22 -0000	1.201
--- DBObject.java	13 Aug 2004 06:07:54 -0000	1.202
***************
*** 380,383 ****
--- 380,384 ----
  
          setDataContext(getDataContext());
+         cacheIsChangedComparison();
          setStatus(BaseDataObject.STATUS_CURRENT);
  
***************
*** 523,527 ****
  
      /**
!      * 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 {
--- 524,530 ----
  
      /**
!      * reset 'original' value and isChanged flags on all fields, establishing a baseline for comparison.
!      * call when add(), retrieve, or update() has occurred, and currentValue of data fields should be
!      * considered 'original value' for purposes of determining 'isChanged'
       */
      public void cacheIsChangedComparison() throws DBException {
***************
*** 1217,1221 ****
          } /* if */
  
! 
          setStatus(BaseDataObject.STATUS_CURRENT);
          notifyListeners(EVENT_ADD);
--- 1220,1224 ----
          } /* if */
  
!         cacheIsChangedComparison();
          setStatus(BaseDataObject.STATUS_CURRENT);
          notifyListeners(EVENT_ADD);
***************
*** 2296,2299 ****
--- 2299,2303 ----
              }
  
+             cacheIsChangedComparison();
              setStatus(BaseDataObject.STATUS_CURRENT);
  
***************
*** 4065,4069 ****
  
      /**
!      *
       * @param dto The filled out data transfer object
       * @throws DBException
--- 4069,4073 ----
  
      /**
!      * fill fields with values found in dto; REPLACES any data field already present.
       * @param dto The filled out data transfer object
       * @throws DBException
***************
*** 4098,4101 ****
--- 4102,4106 ----
  //
  //        fieldData = new HashMap(dto.getTableFields());
+         cacheIsChangedComparison();
          setStatus(BaseDataObject.STATUS_CURRENT);
      }
***************
*** 5569,5572 ****
--- 5574,5579 ----
          }
  
+         // after retrieve, we know that 'current' values are now the baseline for comparison
+         cacheIsChangedComparison();
          setStatus(BaseDataObject.STATUS_CURRENT);
  
***************
*** 5675,5678 ****
--- 5682,5689 ----
                          } /* if anyFieldsToRetrieve */
  
+ 
+                         // we know that 'current' values are now the baseline for comparison
+                         cacheIsChangedComparison();
+ 
                          //
                          //Set it to current since the Cache contains
***************
*** 7080,7085 ****
          }
  
-         // after update, we know that 'current' values are now the baseline for comparison
-         cacheIsChangedComparison();
      }
  
--- 7091,7094 ----
***************
*** 7130,7133 ****
--- 7139,7144 ----
  
  
+         // after update, we know that 'current' values are now the baseline for comparison
+         cacheIsChangedComparison();
          setStatus(BaseDataObject.STATUS_CURRENT);
          notifyListeners(EVENT_UPDATE);



More information about the cvs mailing list