source: ether_statistics/service/implementation/com/medias/megapoli/utils/NewSetMail.java @ 569

Last change on this file since 569 was 569, checked in by vmipsl, 12 years ago

Nouveau projet

File size: 4.6 KB
Line 
1package com.medias.megapoli.utils;
2
3import com.medias.Context;
4import com.medias.mail.Mail;
5
6import java.io.Serializable;
7import java.util.Hashtable;
8import java.util.Properties;
9
10/**
11 * @author combaz
12 *
13 * Created on 16 mars 2005
14 */
15public class NewSetMail extends Mail
16        implements Serializable {
17        /**
18     *
19     */
20    private static final long serialVersionUID = 1L;
21//    private static String NEWMAIL_SUBJECT = "DépÃŽt de données pour la base MEGAPOLI";
22        private String[] content;
23//      {
24/*0*///                 "Bonjour ",
25/*1*///                 "dest_nom",
26/*2*///                 ",\n\nLa section \"DépÃŽt des données\" du site web MEGAPOLI est active.\n\nLe jeu ",
27/*3*///                 "jeu_nom",
28/*4*///                 " est maintenant pris en compte dans la base.\nVous avez été désigné comme \"",
29/*5*///                 "dest_role",
30/*6*///                 "\".\n",
31/*7*///                 "\nPouvez-vous s'il vous plaît aller voir à l'adresse \"http://megapoli.sedoo.fr/InitLogon.do\"?" +
32        //      "\nVotre nom d'utilisateur est : ",
33/*8*///                 "dest_login",
34/*9*///                 ",\nVotre mot de passe est : ",
35/*10*///                        "dest_mdp",
36/*11*///                        ".\n\n1) Vérifiez si les informations de méta-données associées au jeu sont correctes (en cliquant sur le lien \"",
37/*12*///                        "jeu_nom",
38/*13*///                        "_metadata.xml\",\n2) Télécharger vos fichiers de données sur le site. C'est au même endroit que " +
39        //      "précédemment, au niveau de l'icÃŽne avec une petite flÚche : un bouton \"browse\" vous permet de choisir " +
40        //      "localement votre fichier, et un bouton \"submit\" permet de faire l'envoi.\nEn cas de problÚme, veuillez contacter " +
41        //      "le webmaster (mailto:webmaster).\n\nA bientÃŽt,\n\n",
42/*14*///                        "exp_nom"};
43        private Hashtable<String, String> roles;
44
45        /**
46         * Crée un nouveau mail de création de nouveau jeu
47         * @param from Expéditeur du mail
48         * @param to Destinataire du mail
49         */
50        public NewSetMail(String from, String to, String bcc) {
51                super(from, to, bcc);
52                this.setSubject( Context.getAnInternationalizeString( "ApplicationResources", "mail.subject" ));
53                roles = new Hashtable<String, String>();
54                roles.put("default",Context.getAnInternationalizeString("ApplicationResources", "data.upload.metadata.description.default2"));
55                roles.put("pi",Context.getAnInternationalizeString("ApplicationResources", "data.upload.metadata.description.pi"));
56                roles.put("tech",Context.getAnInternationalizeString("ApplicationResources", "data.upload.metadata.description.tech"));
57        }
58
59        /**
60         * Met à jour le contenu du mail à partir d'informations personnelles sur l'expéditeur et le destinataire.
61         * @param dest_nom
62         * @param dest_login
63         * @param dest_mdp
64         * @param dest_role
65         * @param jeu_nom
66         * @param exp_nom
67         */
68        public void createContent(Properties prop, String dest_nom, String dest_login, String dest_mdp, String dest_role, String jeu_nom, String exp_nom) {
69                this.content = new String[19];
70                this.content[0] = Context.getAnInternationalizeString("ApplicationResources", "mail.content1");
71                this.content[1] = dest_nom;
72                this.content[2] = Context.getAnInternationalizeString("ApplicationResources", "mail.content2");
73                this.content[3] = jeu_nom;
74                this.content[4] = Context.getAnInternationalizeString("ApplicationResources", "mail.content3");
75                this.content[5] = this.roles.get(dest_role);
76                this.content[6] = Context.getAnInternationalizeString("ApplicationResources", "mail.content31");
77                this.content[7] = Context.getAnInternationalizeString("ApplicationResources", "mail.content4");
78                this.content[8] = prop.getProperty("url.upload");
79                this.content[9] = Context.getAnInternationalizeString("ApplicationResources", "mail.content5");
80                this.content[10] = dest_login;
81                this.content[11] = Context.getAnInternationalizeString("ApplicationResources", "mail.content6");
82                this.content[12] = dest_mdp;
83                this.content[13] = Context.getAnInternationalizeString("ApplicationResources", "mail.content7");
84                this.content[14] = jeu_nom;
85                this.content[15] = Context.getAnInternationalizeString("ApplicationResources", "mail.content8");
86                this.content[16] = prop.getProperty("mail.webmaster");
87                this.content[17] = Context.getAnInternationalizeString("ApplicationResources", "mail.content9");
88                this.content[18] = exp_nom;
89                synchronizeContent();
90        }
91       
92        public void addReference(String nom, String role) {
93                String phrase = "\n"+nom+" "+Context.getAnInternationalizeString("ApplicationResources", "mail.content10")+this.roles.get(role)+"\".";
94                this.content[6]=this.content[6]+phrase;
95                synchronizeContent();
96        }
97       
98        /**
99         * Met à jour le texte du mail à partir du tableau de Strings content.
100         *
101         */
102        private void synchronizeContent() {
103                StringBuffer text = new StringBuffer();
104                for(int i=0; i<this.content.length;i++) {
105                        text.append(content[i]);
106                }
107                this.setContent(text.toString());
108        }
109}
Note: See TracBrowser for help on using the repository browser.