[cvs] expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/dbobj DefaultUserInfo.java

JCorporate Ltd jcorp at jcorp2.servlets.net
Fri Jun 25 01:02:15 PDT 2004


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

Modified Files:
	DefaultUserInfo.java 
Log Message:
improve logic for efficiency in update() override


Index: DefaultUserInfo.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/dbobj/DefaultUserInfo.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** DefaultUserInfo.java	23 Jun 2004 18:58:10 -0000	1.42
--- DefaultUserInfo.java	25 Jun 2004 08:02:12 -0000	1.43
***************
*** 1284,1294 ****
      private void checkEmailAddrAlreadyUsed(boolean isUpdate) throws DBException {
  
          if ( isUpdate ) {
              // update case may be shortcircuited, thus requiring no db access
              String onlychanged = Setup.getValueUnrequired(getDataContext(), UPDATE_CHANGED_ONLY);
              if (StringUtil.toBoolean(onlychanged)) {
!                 // ok, setting says that this app only updates for changed fields; is our field changed?
!                 // if not, don't waste time checking for whether we are unique
!                 if ( !getDataField(EMAIL_ADDRESS).isChanged() ) return;
              }
          }
--- 1284,1307 ----
      private void checkEmailAddrAlreadyUsed(boolean isUpdate) throws DBException {
  
+         // If this site uses email as login name, force login name equal to email
+         boolean useEmailAsLogin = false;
+ 
+         try {
+             useEmailAsLogin = ConfigManager.getContext(getDataContext()).useEmailAsLogin();
+         } catch (ConfigurationException ce) {
+             throw new DBException(ce);
+         }
+ 
          if ( isUpdate ) {
              // update case may be shortcircuited, thus requiring no db access
              String onlychanged = Setup.getValueUnrequired(getDataContext(), UPDATE_CHANGED_ONLY);
              if (StringUtil.toBoolean(onlychanged)) {
!                 // ok, setting says that this app only updates the field which are changed
!                 // if email/login not changed, don't waste time checking for whether they are unique
!                 if ( getDataField(EMAIL_ADDRESS).isChanged() || (!useEmailAsLogin && getDataField(LOGIN).isChanged()) ) {
!                     // go on through tests below
!                 } else {
!                     return; // shortcircuit tests--fields haven't changed
!                 }
              }
          }
***************
*** 1313,1324 ****
          }
  
-         // If this site uses email as login name, force login name equal to email
-         boolean useEmailAsLogin = false;
- 
-         try {
-             useEmailAsLogin = ConfigManager.getContext(getDataContext()).useEmailAsLogin();
-         } catch (ConfigurationException ce) {
-             throw new DBException(ce);
-         }
          if (useEmailAsLogin) {
              if (getField(LOGIN).equals("")) {
--- 1326,1329 ----



More information about the cvs mailing list