[Suiviobsmer-commits] r996 - trunk/wao-business/src/main/java/fr/ifremer/wao/service
Author: bleny Date: 2011-02-08 15:20:03 +0000 (Tue, 08 Feb 2011) New Revision: 996 Log: add some comments Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2011-02-08 14:48:56 UTC (rev 995) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceContactImpl.java 2011-02-08 15:20:03 UTC (rev 996) @@ -362,10 +362,32 @@ if (sendNotification) { + // we will send a mail with a body like + //Bonjour, + // + //Un observateur du programme Obsmer a renseigné dans WAO l'information suivante : + // + //Navire : L'ARMILANT (487836) + //Marée : 25/10/2010 00:00 - 26/10/2010 00:00 + //Métier : 2010_0037 Manche Ouest (Manche, Mer du Nord) Secteur Brest Granville centré autour de St malo OTB_DEF 80-90 Chalutage de fond côtier sole, seiche + // + //Capture accidentelle : + //deux tritons et une sirène + // + //Cordialement, + // + //Le programme Obsmer + //http://www.ifremer.fr/wao + String object = WaoUtils.translate(n_("wao.business.mammalsCapture.mail.subject")); + // building 3 string, components of the body + + // the boat and its number String boat = contact.getBoat().getName() + " (" + contact.getBoat().getImmatriculation() + ")"; + + // the time of the capture (it's between tide begin and end) String time = ""; if (contact.getObservationBeginDate() != null) { time = WaoUtils.formatDateTime(contact.getObservationBeginDate()) + " "; @@ -373,8 +395,9 @@ if (contact.getObservationEndDate() != null) { time += WaoUtils.formatDateTime(contact.getObservationEndDate()); } + + // some details from the sample row, facade, etc. SampleRow sampleRow = contact.getSampleRow(); - List<String> facadesNames = new ArrayList<String>(); for (FishingZone fishingZone : sampleRow.getFishingZone()) { facadesNames.add(fishingZone.getSectorName() + " (" + fishingZone.getFacadeName() + ")"); @@ -386,6 +409,7 @@ + " " + sampleRow.getProfession().getLibelle() + " " + sampleRow.getProfession().getSpecies(); + // constructing the whole mail String body = WaoUtils.translate(n_("wao.business.mammalsCapture.mail.message"), boat, time, profession, contact.getMammalsInfo()); @@ -393,7 +417,7 @@ log.debug("will send email with object '" + object + "' and body \n" + body); } - + // now trying to find to what user we need to send the mail WaoUserDAO userDao = WaoDAOHelper.getWaoUserDAO(transaction); // users contains all the user we need to notify for the capture List<WaoUser> waoUsers = userDao.findAllByMammalsNotifications(true); @@ -402,6 +426,7 @@ log.debug("notification will be sent to " + waoUsers.size() + " users"); } + // sending the same e-mail to all of them for (WaoUser waoUser : waoUsers) { String userLogin = waoUser.getLogin(); if (StringUtil.isEmail(userLogin)) {
participants (1)
-
bleny@users.labs.libre-entreprise.org