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

JCorporate Ltd jcorp at jcorp2.servlets.net
Thu Sep 9 15:50:38 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-serv24793/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/dbobj

Modified Files:
	RegistrationDBObject.java 
Log Message:
when deleting, check registration object map because  coder MAY have used custom UidField name


Index: RegistrationDBObject.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/services/dbobj/RegistrationDBObject.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** RegistrationDBObject.java	1 Oct 2003 01:18:37 -0000	1.11
--- RegistrationDBObject.java	9 Sep 2004 22:50:36 -0000	1.12
***************
*** 82,86 ****
   * information is deleted when a User is deleted.
   * @author Michael Rimov
-  * @version $Revision$ on  $Date$
   */
  abstract public class RegistrationDBObject extends SecuredDBObject
--- 82,85 ----
***************
*** 177,181 ****
          }
          regobj.setDataContext(user.getDataContext());
!         regobj.setField("ExpUid", user.getUid());
  
          RegistrationDBObject oneMember = null;
--- 176,189 ----
          }
          regobj.setDataContext(user.getDataContext());
! 
!         // coder MAY have used custom UidField name
!         String uidFieldName = getUidFieldName(user);
! 
!         try {
!             regobj.setField(uidFieldName, user.getUid());
!         } catch (Exception e) {
!             //  coder may not have realized that expresso objects (also in map) use 'ExpUid'
!             regobj.setField("ExpUid", user.getUid()); // ok to throw
!         }
  
          RegistrationDBObject oneMember = null;
***************
*** 198,201 ****
--- 206,229 ----
          } /* for each group member listing */
  
+     }
+ 
+     private String getUidFieldName(User user) throws DBException {
+         String uidFieldName = "ExpUid";
+         RegistrationDomain rd = new RegistrationDomain();
+         rd.setDataContext(user.getDataContext());
+         rd.setField("Name", user.getRegistrationDomain());
+ 
+         if (!rd.find()) {
+             throw new DBException("User '+ " + user.getLoginName() + " specifies registration domain name = '" + user.getRegistrationDomain() + "' but cannot find this domain.");
+         }
+ 
+         RegistrationObjectMap rom = new RegistrationObjectMap(SecuredDBObject.SYSTEM_ACCOUNT);
+         rom.setDataContext(getDataContext());
+         rom.setField("RegDomId", rd.getField("RegDomId"));
+ 
+         if ( rom.find() ) {
+             uidFieldName = rom.getField("UidField");
+         }
+         return uidFieldName;
      }
  



More information about the cvs mailing list