Package fr.utbm.in56.annonces.dao

Examples of fr.utbm.in56.annonces.dao.AnnonceDao


   
    long idMsg = Long.decode(request.getParameter("id"));

        MessageDao dao = new MessageDao();
       
        Message m = dao.getById(idMsg);
       
        Membre membre = (Membre) request.getSession().getAttribute("membre");
       
        if(m.getDestinataire().getId() == membre.getId() ){
            m.setOuvert(true);
            dao.update(m);
           
            request.getSession().setAttribute("unread",dao.getNbUnReadMessageByMember(membre));
        }
               
        SimpleDateFormat dateformatMMDDYYYY = new SimpleDateFormat("MM/dd/yyyy");
        String stDate = dateformatMMDDYYYY.format(m.getDateEnvoi().getTime());
      
        request.getSession().setAttribute("date", stDate);       
        request.getSession().setAttribute("message", m)
        request.getSession().setAttribute("annonce", "vide");       
   
View Full Code Here


            for(Annonce a : annoncesRemove) {
                annonces.remove(a);
            }
           
            for(Annonce a : annonces) {
                Message m = new Message();
                m.setAnnonce(annonce);
                m.setDateEnvoi(Calendar.getInstance());
                m.setExpediteur(annonce.getPublicateur());
                m.setDestinataire(a.getPublicateur());
                m.setMessageAuto(true);
                m.setOuvert(false);
                m.setCorps("Bonjour. Une annonce satisfaisant les critères"
                        + " de votre annonce \"" + a.getTitre() + "\" vient d'être publiée.");
                messageDao.save(m);
            }
           
            for(Annonce a : annonces) {
                Message m = new Message();
                m.setAnnonce(a);
                m.setDateEnvoi(Calendar.getInstance());
                m.setExpediteur(a.getPublicateur());
                m.setDestinataire(annonce.getPublicateur());
                m.setMessageAuto(true);
                m.setOuvert(false);
                m.setCorps("Bonjour. Il existe déjà une annonce satisfaisant les critères"
                        + " de l'annonce que vous venez de publier.");
                messageDao.save(m);
            }

            transaction.commit();
View Full Code Here

            this.closeSession();
        }
        if(!mots.isEmpty()){
            return mots.get(0);
        }else{
            MotCle m = new MotCle();
            m.setLibelle(libelle);
           
            this.save(m);
           
            return m;
        }
View Full Code Here

                   
                    String motcle = annonceForm.getMotsCles();
                   
                    String[] tabMotcle = motcle.split(";");
                   
                    MotCle m;
                    MotCleDao motDao = new MotCleDao();
                   
                    for(int i=0; i<tabMotcle.length; i++){
                        m = motDao.getAndCreateByLibelle(tabMotcle[i]);
                        motscles.add(m);
View Full Code Here

        if(regionDao.getAll().isEmpty() || departementDao.getAll().isEmpty()) {
           
            ArrayList<Region> regions = new ArrayList<Region>();
            ArrayList<Departement> departements = new ArrayList<Departement>();

            regions.add(new Region("Alsace"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Bas-Rhin"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Haut-Rhin"));

            regions.add(new Region("Aquitaine"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Dordogne"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Gironde"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Landes"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Lot-et-Garonne"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Pyrénées-Atlantiques"));

            regions.add(new Region("Auvergne"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Allier"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Cantal"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Haute-Loire"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Puy-de-Dôme"));

            regions.add(new Region("Basse-Normandie"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Calvados"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Manche"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Orne"));

            regions.add(new Region("Bourgogne"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Côte-d'Or"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Nièvre"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Saône-et-Loire"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Yonne"));

            regions.add(new Region("Bretagne"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Côtes-d'Armor"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Finistère"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Ile-et-Vilaine"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Morbihan"));

            regions.add(new Region("Centre"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Cher"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Eure-et-Loir"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Indre"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Indre-et-Loir"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Loir-et-Cher"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Loiret"));

            regions.add(new Region("Champagne-Ardenne"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Ardennes"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Aube"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Marne"));
            departements.add(new Departement(regions.get(regions.size() - 1), "haute-Marne"));

            regions.add(new Region("Corse"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Haute-Corse"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Basse-corse"));

            regions.add(new Region("Franche-Comté"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Doubs"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Jura"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Haute-Saône"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Territoire de Belfort"));

            regions.add(new Region("Haute-Normandie"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Seine-Maritime"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Eure"));

            regions.add(new Region("Île-de-France"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Paris"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Seine-et-Marne"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Yvelines"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Essone"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Hauts-de-Seine"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Seine-Saint-Denis"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Val-de-Marne"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Val-d'Oise"));

            regions.add(new Region("Languedoc-Roussillon"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Aude"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Gard"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Hérault"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Lozère"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Pyrénées-Orientales"));

            regions.add(new Region("Limousin"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Corrèze"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Creuse"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Haute-Vienne"));

            regions.add(new Region("Lorraine"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Meurthe-et-Moselle"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Meuse"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Moselle"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Vosges"));

            regions.add(new Region("Midi-Pyrénées"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Ariège"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Aveyron"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Haute-Garonne"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Gers"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Lot"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Hautes-Pyrénées"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Tarn"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Tarn-et-Garonne"));

            regions.add(new Region("Nord-Pas-de-Calais"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Nord"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Pas-de-Calais"));

            regions.add(new Region("Pays de la Loire"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Loire-Atlantique"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Maine-et-Loire"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Mayenne"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Sarthe"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Vendée"));

            regions.add(new Region("Picardie"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Laon"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Beauvais"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Amiens"));

            regions.add(new Region("Poitou-Charentes"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Charente"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Charente-Maritime"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Deux-Sèvres"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Vienne"));

            regions.add(new Region("PACA"));

            departements.add(new Departement(regions.get(regions.size() - 1), "Alpes-de-Haute-Provence"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Hautes-Alpes"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Alpes-Maritimes"));
            departements.add(new Departement(regions.get(regions.size() - 1), "Bouches-du-Rhone"));
View Full Code Here

    private void initRegions(Session session){
       
        ArrayList<Region> regions = new ArrayList<Region>();
        ArrayList<Departement> departements = new ArrayList<Departement>();
       
        regions.add(new Region("Alsace"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Bas-Rhin"));
        departements.add(new Departement(regions.get(regions.size()-1),"Haut-Rhin"));
       
        regions.add(new Region("Aquitaine"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Dordogne"));
        departements.add(new Departement(regions.get(regions.size()-1),"Gironde"));
        departements.add(new Departement(regions.get(regions.size()-1),"Landes"));
        departements.add(new Departement(regions.get(regions.size()-1),"Lot-et-Garonne"));
        departements.add(new Departement(regions.get(regions.size()-1),"Pyrénées-Atlantiques"));
       
        regions.add(new Region("Auvergne"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Allier"));
        departements.add(new Departement(regions.get(regions.size()-1),"Cantal"));
        departements.add(new Departement(regions.get(regions.size()-1),"Haute-Loire"));
        departements.add(new Departement(regions.get(regions.size()-1),"Puy-de-Dôme"));
       
        regions.add(new Region("Basse-Normandie"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Calvados"));
        departements.add(new Departement(regions.get(regions.size()-1),"Manche"));
        departements.add(new Departement(regions.get(regions.size()-1),"Orne"));
       
        regions.add(new Region("Bourgogne"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Côte-d'Or"));
        departements.add(new Departement(regions.get(regions.size()-1),"Nièvre"));
        departements.add(new Departement(regions.get(regions.size()-1),"Saône-et-Loire"));
        departements.add(new Departement(regions.get(regions.size()-1),"Yonne"));
       
        regions.add(new Region("Bretagne"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Côtes-d'Armor"));
        departements.add(new Departement(regions.get(regions.size()-1),"Finistère"));
        departements.add(new Departement(regions.get(regions.size()-1),"Ile-et-Vilaine"));
        departements.add(new Departement(regions.get(regions.size()-1),"Morbihan"));
       
        regions.add(new Region("Centre"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Cher"));
        departements.add(new Departement(regions.get(regions.size()-1),"Eure-et-Loir"));
        departements.add(new Departement(regions.get(regions.size()-1),"Indre"));
        departements.add(new Departement(regions.get(regions.size()-1),"Indre-et-Loir"));
        departements.add(new Departement(regions.get(regions.size()-1),"Loir-et-Cher"));
        departements.add(new Departement(regions.get(regions.size()-1),"Loiret"));
       
        regions.add(new Region("Champagne-Ardenne"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Ardennes"));
        departements.add(new Departement(regions.get(regions.size()-1),"Aube"));
        departements.add(new Departement(regions.get(regions.size()-1),"Marne"));
        departements.add(new Departement(regions.get(regions.size()-1),"haute-Marne"));
       
        regions.add(new Region("Corse"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Haute-Corse"));
        departements.add(new Departement(regions.get(regions.size()-1),"Basse-corse"));
       
        regions.add(new Region("Franche-Comté"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Doubs"));
        departements.add(new Departement(regions.get(regions.size()-1),"Jura"));
        departements.add(new Departement(regions.get(regions.size()-1),"Haute-Saône"));
        departements.add(new Departement(regions.get(regions.size()-1),"Territoire de Belfort"));
       
        regions.add(new Region("Haute-Normandie"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Seine-Maritime"));
        departements.add(new Departement(regions.get(regions.size()-1),"Eure"));       
       
        regions.add(new Region("Île-de-France"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Paris"));
        departements.add(new Departement(regions.get(regions.size()-1),"Seine-et-Marne"));
        departements.add(new Departement(regions.get(regions.size()-1),"Yvelines"));
        departements.add(new Departement(regions.get(regions.size()-1),"Essone"));
        departements.add(new Departement(regions.get(regions.size()-1),"Hauts-de-Seine"));
        departements.add(new Departement(regions.get(regions.size()-1),"Seine-Saint-Denis"));
        departements.add(new Departement(regions.get(regions.size()-1),"Val-de-Marne"));
        departements.add(new Departement(regions.get(regions.size()-1),"Val-d'Oise"));
       
        regions.add(new Region("Languedoc-Roussillon"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Aude"));
        departements.add(new Departement(regions.get(regions.size()-1),"Gard"));
        departements.add(new Departement(regions.get(regions.size()-1),"Hérault"));
        departements.add(new Departement(regions.get(regions.size()-1),"Lozère"));
        departements.add(new Departement(regions.get(regions.size()-1),"Pyrénées-Orientales"));
       
        regions.add(new Region("Limousin"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Corrèze"));
        departements.add(new Departement(regions.get(regions.size()-1),"Creuse"));
        departements.add(new Departement(regions.get(regions.size()-1),"Haute-Vienne"));
       
        regions.add(new Region("Lorraine"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Meurthe-et-Moselle"));
        departements.add(new Departement(regions.get(regions.size()-1),"Meuse"));
        departements.add(new Departement(regions.get(regions.size()-1),"Moselle"));
        departements.add(new Departement(regions.get(regions.size()-1),"Vosges"));
       
        regions.add(new Region("Midi-Pyrénées"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Ariège"));
        departements.add(new Departement(regions.get(regions.size()-1),"Aveyron"));
        departements.add(new Departement(regions.get(regions.size()-1),"Haute-Garonne"));
        departements.add(new Departement(regions.get(regions.size()-1),"Gers"));
        departements.add(new Departement(regions.get(regions.size()-1),"Lot"));
        departements.add(new Departement(regions.get(regions.size()-1),"Hautes-Pyrénées"));
        departements.add(new Departement(regions.get(regions.size()-1),"Tarn"));
        departements.add(new Departement(regions.get(regions.size()-1),"Tarn-et-Garonne"));
       
        regions.add(new Region("Nord-Pas-de-Calais"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Nord"));
        departements.add(new Departement(regions.get(regions.size()-1),"Pas-de-Calais"));
       
        regions.add(new Region("Pays de la Loire"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Loire-Atlantique"));
        departements.add(new Departement(regions.get(regions.size()-1),"Maine-et-Loire"));
        departements.add(new Departement(regions.get(regions.size()-1),"Mayenne"));
        departements.add(new Departement(regions.get(regions.size()-1),"Sarthe"));
        departements.add(new Departement(regions.get(regions.size()-1),"Vendée"));
       
        regions.add(new Region("Picardie"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Laon"));
        departements.add(new Departement(regions.get(regions.size()-1),"Beauvais"));
        departements.add(new Departement(regions.get(regions.size()-1),"Amiens"));
       
        regions.add(new Region("Poitou-Charentes"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Charente"));
        departements.add(new Departement(regions.get(regions.size()-1),"Charente-Maritime"));
        departements.add(new Departement(regions.get(regions.size()-1),"Deux-Sèvres"));
        departements.add(new Departement(regions.get(regions.size()-1),"Vienne"));
       
        regions.add(new Region("PACA"));
       
        departements.add(new Departement(regions.get(regions.size()-1),"Alpes-de-Haute-Provence"));
        departements.add(new Departement(regions.get(regions.size()-1),"Hautes-Alpes"));
        departements.add(new Departement(regions.get(regions.size()-1),"Alpes-Maritimes"));
        departements.add(new Departement(regions.get(regions.size()-1),"Bouches-du-Rhone"));
View Full Code Here

       
        DepartementDao dDao = new DepartementDao();
        RegionDao rDao = new RegionDao();
        AnnonceDao dao = new AnnonceDao();
       
        Region r = rDao.getById(idRegion);
        Set<Departement> depts = dDao.getdepartementsByRegion(r);
       
        Set<Annonce> annonces = dao.getAnnonces(depts);
       
        request.getSession().setAttribute("annonces", annonces);       
View Full Code Here

    private void initStatuts() {
       
        StatutDao statutDao = new StatutDao();
       
        if(statutDao.getAll().isEmpty()) {
            statutDao.save(new Statut("EN_COURS", "Annonce en cours"));
            statutDao.save(new Statut("ANNULEE", "Annonce annulée"));
            statutDao.save(new Statut("TERMINEE", "Annonce terminée"));
        }
    }
View Full Code Here

  @Override
  public ActionForward execute(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
   
    AnnonceForm annonceForm = (AnnonceForm) form;
               
                MembreDao dao = new MembreDao();

                Membre membre = (Membre)request.getSession().getAttribute("membre");
               
                if(membre != null){
                   
                    AnnonceDao anDao = new AnnonceDao();
                    DepartementDao depDao = new DepartementDao();
                    CategorieDao catDao = new CategorieDao();
                   
                    Annonce annonce = new Annonce();
                   
                    annonce.setPublicateur(membre);
                    annonce.setDateDepot(Calendar.getInstance());
                   
                    annonce.setDepartement(depDao.getById(annonceForm.getDepartement()));
                    annonce.setOffre((boolean) annonceForm.isOffre());
                   
                    annonce.setTitre(annonceForm.getTitre());
                    annonce.setDescription(annonceForm.getDescription());
                    annonce.setPrix(annonceForm.getPrix());
                   
                    annonce.setCategorie(catDao.getById(annonceForm.getCategorie()));
                   
                    Set<MotCle> motscles = new HashSet<MotCle>();
                   
                    String motcle = annonceForm.getMotsCles();
                   
                    String[] tabMotcle = motcle.split(";");
                   
                    MotCle m;
                    MotCleDao motDao = new MotCleDao();
View Full Code Here

  @Override
  public ActionForward execute(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
   
    ChercherForm chercherForm = (ChercherForm) form;
       
        HttpSession session = request.getSession();
        AnnonceDao annoncesDao = new AnnonceDao();
        DepartementDao departementDao = new DepartementDao();
        CategorieDao categorieDao = new CategorieDao();
       
        Departement departement = departementDao.getById(chercherForm.getDepartement());
        Categorie categorie = categorieDao.getById(chercherForm.getCategorie());
       
        session.setAttribute("annonces", annoncesDao.getAnnonces(
                chercherForm.getPrixMin(),
                chercherForm.getPrixMax(),
                chercherForm.getRecherche(),
                chercherForm.isOffre(),
                departement,
                categorie));
   
    return mapping.findForward("default");
  }
View Full Code Here

TOP

Related Classes of fr.utbm.in56.annonces.dao.AnnonceDao

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.