[Castore-commits] JDOUserEventFactory.java 1.9 1.10

Stéphane Bouchet sbouchet at adullact1.hosting.cri74.org
Mer 19 Avr 16:09:24 CEST 2006


Update of /cvsroot/castore/castore-core/src/java/fr/emn/castor/users/jdo
In directory adullact1:/tmp/cvs-serv11060/src/java/fr/emn/castor/users/jdo

Modified Files:
	JDOUserEventFactory.java 
Log Message:
Refactoring Iterator -> List (en partie)

Index: JDOUserEventFactory.java
===================================================================
RCS file: /cvsroot/castore/castore-core/src/java/fr/emn/castor/users/jdo/JDOUserEventFactory.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** JDOUserEventFactory.java	29 Mar 2006 13:14:25 -0000	1.9
--- JDOUserEventFactory.java	19 Apr 2006 14:09:22 -0000	1.10
***************
*** 45,48 ****
--- 45,49 ----
  import java.util.HashMap;
  import java.util.Iterator;
+ import java.util.List;
  import java.util.Map;
  
***************
*** 152,156 ****
                      // - validation de document
                      this.newValidation(row);
!                 } else if (event.equals("documents.validation.nouvelleEtape")) {
                      //nouvelle etape dans la validation
                      this.updateListOfDocToValidate(row);
--- 153,158 ----
                      // - validation de document
                      this.newValidation(row);
!                 } else if (event
!                     .equals("documents.validation.nouvelleEtape")) {
                      //nouvelle etape dans la validation
                      this.updateListOfDocToValidate(row);
***************
*** 253,257 ****
              // test 3 : sur le groupe des superviseurs
              if (docFac.finishedValidationForGroupOrUser(
!                 Constants.SESSION_SUPERVISOR_KEY, idDoc).equals(Constants.TRUE)) {
                  if (log.isDebugEnabled()) {
                      log.debug("Validation terminee pour : "
--- 255,260 ----
              // test 3 : sur le groupe des superviseurs
              if (docFac.finishedValidationForGroupOrUser(
!                 Constants.SESSION_SUPERVISOR_KEY, idDoc).equals(
!                 Constants.TRUE)) {
                  if (log.isDebugEnabled()) {
                      log.debug("Validation terminee pour : "
***************
*** 272,280 ****
          // prochains validateurs
          //pour cela, on recupere l'etape suivante
!         Iterator listeValidateurs = docFac.getValidatorsListForDocument(idDoc);
!         while (listeValidateurs.hasNext()) {
!             String unValidateur = (String) listeValidateurs.next();
!             this.addNewDocAValider(unValidateur, idDoc);
!         }
      }
  
--- 275,280 ----
          // prochains validateurs
          //pour cela, on recupere l'etape suivante
!         String validateur = docFac.getValidatorsListForDocument(idDoc);
!         this.addNewDocAValider(validateur, idDoc);
      }
  
***************
*** 285,293 ****
       * @throws UsersException si une erreur survient.
       */
!     private void addNewSuppressionDoc(final String idDoc) throws UsersException {
          if (log.isDebugEnabled()) {
              log.debug("Begin of addNewSuppressionDoc.");
          }
!         // il faut retrouver l'utilisateur soumetteur de ce deocument
          String userId = fr.emn.castor.documents.Facade
              .getInstance().getSoumetteurName(idDoc);
--- 285,294 ----
       * @throws UsersException si une erreur survient.
       */
!     private void addNewSuppressionDoc(final String idDoc)
!             throws UsersException {
          if (log.isDebugEnabled()) {
              log.debug("Begin of addNewSuppressionDoc.");
          }
!         // il faut retrouver l'utilisateur soumetteur de ce document
          String userId = fr.emn.castor.documents.Facade
              .getInstance().getSoumetteurName(idDoc);
***************
*** 471,480 ****
          PersistenceManager pm = JDOFactory.getPersistenceManager();
          UserProfil userProfil = getUserProfil(pm, userId);
!         Iterator<String> groupsWithUser = Facade
!             .getInstance().getGroupesWithUser(userId);
!         ArrayList<String> groupList = new ArrayList<String>();
!         while (groupsWithUser.hasNext()) {
!             groupList.add(groupsWithUser.next());
!         }
          Transaction tx = pm.currentTransaction();
          try {
--- 472,477 ----
          PersistenceManager pm = JDOFactory.getPersistenceManager();
          UserProfil userProfil = getUserProfil(pm, userId);
!         List<String> groupList = Facade.getInstance().getGroupesWithUser(
!             userId);
          Transaction tx = pm.currentTransaction();
          try {
***************
*** 573,577 ****
          String idGroup = (String) row.get(UsersConstants.GROUP_ID);
          if (log.isDebugEnabled()) {
!             log.debug("First step : delete this group in the creator profil");
          }
          PersistenceManager pm = JDOFactory.getPersistenceManager();
--- 570,575 ----
          String idGroup = (String) row.get(UsersConstants.GROUP_ID);
          if (log.isDebugEnabled()) {
!             log
!                 .debug("First step : delete this group in the creator profil");
          }
          PersistenceManager pm = JDOFactory.getPersistenceManager();
***************
*** 622,626 ****
                          AbstractUser user = (AbstractUser) usersIter.next();
                          tx.begin();
!                         user.getUserProfil().removeGroupeAppartenance(idGroup);
                          tx.commit();
                      }
--- 620,625 ----
                          AbstractUser user = (AbstractUser) usersIter.next();
                          tx.begin();
!                         user.getUserProfil().removeGroupeAppartenance(
!                             idGroup);
                          tx.commit();
                      }
***************
*** 687,696 ****
                              + userId);
                  }
!                 Iterator<String> groupsWithUser = Facade
                      .getInstance().getGroupesWithUser(userId);
-                 ArrayList<String> groupList = new ArrayList<String>();
-                 while (groupsWithUser.hasNext()) {
-                     groupList.add(groupsWithUser.next());
-                 }
                  Transaction tx = pm.currentTransaction();
                  try {
--- 686,691 ----
                              + userId);
                  }
!                 List<String> groupList = Facade
                      .getInstance().getGroupesWithUser(userId);
                  Transaction tx = pm.currentTransaction();
                  try {
***************
*** 729,739 ****
                              + userId + ")");
                  }
!                 Iterator groupsWithUser = Facade
                      .getInstance().getGroupesWithUser(userId);
!                 ArrayList<String> groupList = new ArrayList<String>();
!                 while (groupsWithUser.hasNext()) {
!                     String groupId = (String) groupsWithUser.next();
!                     groupList.add(groupId);
!                 }
                  Transaction tx = pm.currentTransaction();
                  try {
--- 724,730 ----
                              + userId + ")");
                  }
!                 List<String> groupList = Facade
                      .getInstance().getGroupesWithUser(userId);
! 
                  Transaction tx = pm.currentTransaction();
                  try {
***************
*** 803,811 ****
              //en plus de mettre à jour le profil du soumetteur,
              //il faut mettre à jour celui des validateurs
!             Iterator listeValidators = fr.emn.castor.documents.Facade
                  .getInstance().getValidatorsListForDocument(idDoc);
!             while (listeValidators.hasNext()) {
!                 this.addNewDocAValider((String) listeValidators.next(), idDoc);
!             }
          } else if (stateOfDoc.equals(UsersConstants.PRIVATE)) {
              if (log.isDebugEnabled()) {
--- 794,800 ----
              //en plus de mettre à jour le profil du soumetteur,
              //il faut mettre à jour celui des validateurs
!             String validator = fr.emn.castor.documents.Facade
                  .getInstance().getValidatorsListForDocument(idDoc);
!             this.addNewDocAValider(validator, idDoc);
          } else if (stateOfDoc.equals(UsersConstants.PRIVATE)) {
              if (log.isDebugEnabled()) {
***************
*** 961,966 ****
       */
      public void removeDocsAValider(final String idDoc) {
-         //TODO BUG ici
- 
          //suppression de la liste des valideurs potentiels
          PersistenceManager pm = JDOFactory.getPersistenceManager();
--- 950,953 ----
***************
*** 975,980 ****
                  Validator temp = (Validator) validators.next();
                  temp.removeDocAValider(idDoc);
!             } //suppression de la liste des groupes de valideurs
! 
              docGroupProfil.removeDocAValider(idDoc);
              supGroupProfil.removeDocAValider(idDoc);
--- 962,967 ----
                  Validator temp = (Validator) validators.next();
                  temp.removeDocAValider(idDoc);
!             }
!             //suppression de la liste des groupes de valideurs
              docGroupProfil.removeDocAValider(idDoc);
              supGroupProfil.removeDocAValider(idDoc);
***************
*** 1090,1095 ****
          } catch (UsersException e1) {
              if (log.isErrorEnabled()) {
!                 log.error("Erreur lors de la recherche de l'état du document"
!                         + e1);
              }
          }
--- 1077,1083 ----
          } catch (UsersException e1) {
              if (log.isErrorEnabled()) {
!                 log
!                     .error("Erreur lors de la recherche de l'état du document"
!                             + e1);
              }
          }
***************
*** 1101,1109 ****
                  if (validator.equals(Constants.SESSION_DOCUMENTALIST_KEY)) {
                      groupProfil = getDocumentalistsProfil();
!                 } else if (validator.equals(Constants.SESSION_SUPERVISOR_KEY)) {
                      groupProfil = getSupervisorsProfil();
                  } else {
                      if (log.isFatalEnabled()) {
!                         log.fatal("Erreur de recuperation du profil du groupe");
                      }
                      return;
--- 1089,1099 ----
                  if (validator.equals(Constants.SESSION_DOCUMENTALIST_KEY)) {
                      groupProfil = getDocumentalistsProfil();
!                 } else if (validator
!                     .equals(Constants.SESSION_SUPERVISOR_KEY)) {
                      groupProfil = getSupervisorsProfil();
                  } else {
                      if (log.isFatalEnabled()) {
!                         log
!                             .fatal("Erreur de recuperation du profil du groupe");
                      }
                      return;




Plus d'informations sur la liste de diffusion Castore-commits