[Castore-commits] GroupeBean.java 1.3 1.4 GroupeBeanFactory.java 1.3 1.4

Arnaud Thimel thimel at adullact1.hosting.cri74.org
Mer 14 Juin 17:24:31 CEST 2006


Update of /cvsroot/castore/castore-presentation/src/java/fr/emn/castor/presentation/groupes
In directory adullact1:/tmp/cvs-serv22998/src/java/fr/emn/castor/presentation/groupes

Modified Files:
	GroupeBean.java GroupeBeanFactory.java 
Log Message:
- Changement de logique : ce bean représente désormais un groupe plutôt que la page 'MesGroupes'

Index: GroupeBeanFactory.java
===================================================================
RCS file: /cvsroot/castore/castore-presentation/src/java/fr/emn/castor/presentation/groupes/GroupeBeanFactory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GroupeBeanFactory.java	13 Jun 2006 12:07:15 -0000	1.3
--- GroupeBeanFactory.java	14 Jun 2006 15:24:28 -0000	1.4
***************
*** 39,52 ****
  package fr.emn.castor.presentation.groupes;
  
! import static fr.emn.castor.groupes.GroupesConstants.GROUPE_UTILISATEUR_TYPE;
! import static fr.emn.castor.groupes.GroupesConstants.TYPE_GROUPE_NATIF;
! import static fr.emn.castor.groupes.GroupesConstants.TYPE_GROUPE_PERSO;
! import static fr.emn.castor.users.UsersConstants.INFO_PROFIL_GROUPES_APPARTENANCE;
! import static fr.emn.castor.users.UsersConstants.INFO_PROFIL_GROUPES_PERSO;
  
- import java.util.ArrayList;
  import java.util.Collection;
! import java.util.Iterator;
! import java.util.List;
  import java.util.Map;
  
--- 39,48 ----
  package fr.emn.castor.presentation.groupes;
  
! import static fr.emn.castor.groupes.GroupesConstants.GROUPE_UTILISATEUR_DESCRIPTION;
! import static fr.emn.castor.groupes.GroupesConstants.GROUPE_UTILISATEUR_NOM;
! import static fr.emn.castor.groupes.GroupesConstants.GROUPE_UTILISATEUR_UTILISATEURS;
  
  import java.util.Collection;
! import java.util.LinkedHashMap;
  import java.util.Map;
  
***************
*** 59,64 ****
  
  /**
!  * Classe servant à générer le groupeBean pour l'adaptation de l'information aux
!  * entrées sorties avec les Facades.
   * 
   * @author $Author$
--- 55,60 ----
  
  /**
!  * Classe servant a generer le GroupeBean pour l'adaptation de l'information aux
!  * entrees sorties avec les Facades.
   * 
   * @author $Author$
***************
*** 71,132 ****
  
      /**
!      * methode permettant d'obtenir un GroupeBean.
       * 
!      * @param message le message courant.
!      * @param userOnLine l'utilisateur en ligne.
       * @return une instance de GroupeBean
       */
!     public GroupeBean getGroupeBean(String message, String userOnLine) {
!         GroupeBean groupe = new GroupeBean();
!         // recuperation du message courant
!         groupe.setMessageCourant(message);
!         Collection<Map<String, Object>> groupesNatifs = new ArrayList<Map<String, Object>>();
!         Collection<Map<String, Object>> groupesPersos = new ArrayList<Map<String, Object>>();
!         Collection<Map<String, Object>> groupesCreateur = new ArrayList<Map<String, Object>>();
!         // get the login of the user online
!         IUser profilFacade = CoreProxy.getModuleUtilisateur(userOnLine);
!         Map profilMap = profilFacade.getProfilMap(userOnLine);
!         IGroupe groupeFacade = CoreProxy.getModuleGroupe(userOnLine);
  
!         if (!profilMap.isEmpty()) {
!             Iterator<String> iter = ((List<String>) profilMap
!                 .get(INFO_PROFIL_GROUPES_APPARTENANCE)).iterator();
!             while (iter.hasNext()) {
!                 String groupId = iter.next();
  
!                 Map<String, Object> element = groupeFacade
!                     .getGroupe(groupId);
!                 if (!element.isEmpty()) {
!                     String type = (String) element
!                         .get(GROUPE_UTILISATEUR_TYPE);
!                     if (type.equals(TYPE_GROUPE_PERSO)) {
!                         groupesPersos.add(element);
!                     } else if (type.equals(TYPE_GROUPE_NATIF)) {
!                         groupesNatifs.add(element);
!                     } else {
!                         if (log.isFatalEnabled()) {
!                             log.fatal("type de groupe inconnu ! : " + type);
!                         }
!                     }
!                 } else {
!                     if (log.isDebugEnabled()) {
!                         log.debug("impossible de trouver le groupe "
!                                 + groupId + " de l'utilisateur.");
!                     }
!                 }
!             }
!             // on recherche les groupes dont l'utilisateur est le createur
!             Iterator<String> iterCreateurGroupes = ((List<String>) profilMap
!                 .get(INFO_PROFIL_GROUPES_PERSO)).iterator();
!             while (iterCreateurGroupes.hasNext()) {
!                 String groupeId = iterCreateurGroupes.next();
!                 groupesCreateur.add(groupeFacade.getGroupe(groupeId));
              }
          }
!         groupe.setGroupesNatifs(groupesNatifs);
!         groupe.setGroupesPersos(groupesPersos);
!         groupe.setGroupesCreateur(groupesCreateur);
!         return groupe;
      }
  
! }
--- 67,103 ----
  
      /**
!      * Methode permettant d'obtenir un GroupeBean.
       * 
!      * @param groupId l'ientifiant du groupe concerne
!      * @param userOnLine l'utilisateur en ligne
       * @return une instance de GroupeBean
       */
!     public GroupeBean getGroupeBean(String groupId, String userOnLine) {
!         GroupeBean groupBean = new GroupeBean(groupId);
  
!         IGroupe grpFac = CoreProxy.getModuleGroupe(userOnLine);
  
!         Map<String, Object> groupMap = grpFac.getGroupe(groupId);
! 
!         String name = (String)groupMap.get(GROUPE_UTILISATEUR_NOM);
!         groupBean.setGroupName(name);
! 
!         String description = (String)groupMap.get(GROUPE_UTILISATEUR_DESCRIPTION);
!         groupBean.setGroupDesc(description);
! 
!         Map<String, String> usersAndNames = new LinkedHashMap<String, String>();
!         Collection<String> users =
!             (Collection<String>)groupMap.get(GROUPE_UTILISATEUR_UTILISATEURS);
!         if (users != null) {
!             IUser userFac = CoreProxy.getModuleUtilisateur(userOnLine);
!             for (String userId : users) {
!                 String userName = userFac.getUserNameAndFirstName(userId);
!                 usersAndNames.put(userId, userName);
              }
          }
!         groupBean.setUsersInGroup(usersAndNames);
! 
!         return groupBean;
      }
  
! } //GroupeBeanFactory

Index: GroupeBean.java
===================================================================
RCS file: /cvsroot/castore/castore-presentation/src/java/fr/emn/castor/presentation/groupes/GroupeBean.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** GroupeBean.java	13 Jun 2006 12:07:15 -0000	1.3
--- GroupeBean.java	14 Jun 2006 15:24:28 -0000	1.4
***************
*** 39,44 ****
  package fr.emn.castor.presentation.groupes;
  
! import java.util.ArrayList;
! import java.util.Collection;
  
  /**
--- 39,43 ----
  package fr.emn.castor.presentation.groupes;
  
! import java.util.Map;
  
  /**
***************
*** 51,75 ****
  
      /**
!      * message courant a afficher apres une action reussie.
!      */
!     private String messageCourant;
! 
!     /**
!      * les groupes natifs
!      */
!     private Collection groupesNatifs = new ArrayList();
! 
!     /**
!      * les groupes personnels
!      */
!     private Collection groupesPersos = new ArrayList();
! 
!     /**
!      * les groupes createurs
!      */
!     private Collection groupesCreateur = new ArrayList();
! 
!     /**
!      * l'id du groupe
       */
      private String groupId;
--- 50,54 ----
  
      /**
!      * L'identifaint du groupe
       */
      private String groupId;
***************
*** 78,139 ****
       * Le nom du groupe.
       */
!     private String groupName = null;
! 
!     /** Les utilisateurs inscrits. */
!     private Collection usersInGroup = new ArrayList();
! 
!     /**
!      *  La description du groupe. 
!      */
!     private String groupDesc = null;
! 
!     /**
!      * Get listOfMyGroupes
!      * @return a collection of the groupes the user has created
!      */
!     public Collection getGroupesNatifs() {
!         return this.groupesNatifs;
!     }
  
      /**
!      * Set listOfMyGroupes
!      * @param <code>a collection of the groupes the user has created</code>
       */
!     public void setGroupesNatifs(Collection l) {
!         this.groupesNatifs = l;
!     }
  
      /**
!      * Get listOfMyGroupes
!      * @return a collection of the groupes the user has created
       */
!     public Collection getGroupesPersos() {
!         return this.groupesPersos;
!     }
  
      /**
!      * Set listOfMyGroupes
!      * @param <code>a collection of the groupes the user has created</code>
       */
!     public void setGroupesPersos(Collection l) {
!         this.groupesPersos = l;
      }
  
      /**
!      * @return
       */
!     public Collection getGroupesCreateur() {
!         return this.groupesCreateur;
      }
  
      /**
!      * @param collection
       */
!     public void setGroupesCreateur(Collection collection) {
!         this.groupesCreateur = collection;
      }
  
      /**
!      * @return
       */
      public String getGroupId() {
--- 57,99 ----
       * Le nom du groupe.
       */
!     private String groupName;
  
      /**
!      * Les utilisateurs inscrits.
       */
!     private Map<String, String> usersInGroup;
  
      /**
!      *  La description du groupe. 
       */
!     private String groupDesc;
  
      /**
!      * Cree une nouvelle instance.
!      * @param groupId l'identifiant du groupe represente par ce GroupeBean
       */
!     public GroupeBean(String groupId) {
!         this.groupId = groupId;
      }
  
      /**
!      * Renvoie le groupDesc de cette instance.
!      * @return la valeur de l'attribut
       */
!     public String getGroupDesc() {
!         return this.groupDesc;
      }
  
      /**
!      * Modifie le groupDesc de cette instance.
!      * @param groupDesc la nouvelle valeur de l'attribut
       */
!     public void setGroupDesc(String groupDesc) {
!         this.groupDesc = groupDesc;
      }
  
      /**
!      * Renvoie le groupId de cette instance.
!      * @return la valeur de l'attribut
       */
      public String getGroupId() {
***************
*** 142,160 ****
  
      /**
!      * @param string
!      */
!     public void setGroupId(String string) {
!         this.groupId = string;
!     }
! 
!     /**
!      * @return
       */
!     public String getGroupDesc() {
!         return this.groupDesc;
      }
  
      /**
!      * @return
       */
      public String getGroupName() {
--- 102,115 ----
  
      /**
!      * Modifie le groupId de cette instance.
!      * @param groupId la nouvelle valeur de l'attribut
       */
!     public void setGroupId(String groupId) {
!         this.groupId = groupId;
      }
  
      /**
!      * Renvoie le groupName de cette instance.
!      * @return la valeur de l'attribut
       */
      public String getGroupName() {
***************
*** 163,209 ****
  
      /**
!      * @return
!      */
!     public Collection getUsersInGroup() {
!         return this.usersInGroup;
!     }
! 
!     /**
!      * @param string
!      */
!     public void setGroupDesc(String string) {
!         this.groupDesc = string;
!     }
! 
!     /**
!      * @param string
!      */
!     public void setGroupName(String string) {
!         this.groupName = string;
!     }
! 
!     /**
!      * @param collection
       */
!     public void setUsersInGroup(Collection collection) {
!         this.usersInGroup = collection;
      }
  
      /**
!      * Renvoie le message courant.
!      * 
!      * @return le message Courant.
       */
!     public String getMessageCourant() {
!         return this.messageCourant;
      }
  
      /**
!      * Modifie le messageCourant de cette instance.
!      * @param messageCourant la nouvelle valeur de l'attribut
       */
!     public void setMessageCourant(String messageCourant) {
!         this.messageCourant = messageCourant;
      }
  
! }
--- 118,143 ----
  
      /**
!      * Modifie le groupName de cette instance.
!      * @param groupName la nouvelle valeur de l'attribut
       */
!     public void setGroupName(String groupName) {
!         this.groupName = groupName;
      }
  
      /**
!      * Renvoie le usersInGroup de cette instance.
!      * @return la valeur de l'attribut
       */
!     public Map<String, String> getUsersInGroup() {
!         return this.usersInGroup;
      }
  
      /**
!      * Modifie le usersInGroup de cette instance.
!      * @param usersInGroup la nouvelle valeur de l'attribut
       */
!     public void setUsersInGroup(Map<String, String> usersInGroup) {
!         this.usersInGroup = usersInGroup;
      }
  
! } //GroupeBean




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