1 | /* |
---|
2 | * Created on 25 avr. 2005 |
---|
3 | * |
---|
4 | * TODO To change the template for this generated file go to |
---|
5 | * Window - Preferences - Java - Code Style - Code Templates |
---|
6 | */ |
---|
7 | package com.medias.megapoli.trade; |
---|
8 | |
---|
9 | import com.medias.xml.metadata.Contact; |
---|
10 | |
---|
11 | /** |
---|
12 | * @author pignot |
---|
13 | * |
---|
14 | * TODO To change the template for this generated type comment go to |
---|
15 | * Window - Preferences - Java - Code Style - Code Templates |
---|
16 | */ |
---|
17 | public class PersonneAdapter { |
---|
18 | |
---|
19 | public static Contact dbPersonneToMetaContact (com.medias.database.objects.Personne dbContact) { |
---|
20 | Contact contact = new Contact (); |
---|
21 | |
---|
22 | contact.setNom(dbContact.getPersonneNom()); |
---|
23 | contact.setPrenom(dbContact.getPersonnePrenom()); |
---|
24 | contact.setOrganisme(dbContact.getOrganisme().getOrganismeNom()); |
---|
25 | contact.setMail(dbContact.getPersonneMail()); |
---|
26 | if (dbContact.getCommentaire() != null) { |
---|
27 | contact.setRole(dbContact.getCommentaire().getCommentaireTxt()); |
---|
28 | } |
---|
29 | contact.setMailOrganisme(dbContact.getOrganisme().getOrganismeMail()); |
---|
30 | if (dbContact.getOrganisme().getCommentaire() != null) { |
---|
31 | contact.setDescriptionOrganisme(dbContact.getOrganisme().getCommentaire().getCommentaireTxt()); |
---|
32 | contact.setUrlOrganisme(dbContact.getOrganisme().getCommentaire().getCommentaireUrl()); |
---|
33 | } |
---|
34 | String adresse = dbContact.getOrganisme().getAdresse().getAdresseRue()+" "+dbContact.getOrganisme().getAdresse().getAdresseZip()+" "+dbContact.getOrganisme().getAdresse().getAdresseVille()+" "+dbContact.getOrganisme().getAdresse().getAdressePays(); |
---|
35 | contact.setAdresse(adresse); |
---|
36 | return contact; |
---|
37 | } |
---|
38 | |
---|
39 | |
---|
40 | // public static ArrayList<Contact> dbPersonnesToMetaContacts (List<?> dbContacts) { |
---|
41 | // ArrayList<Contact> result = new ArrayList<Contact> (); |
---|
42 | // |
---|
43 | // Iterator<?> it = dbContacts.iterator(); |
---|
44 | // while (it.hasNext()) { |
---|
45 | // result.add(dbPersonneToMetaContact ((com.medias.database.objects.Personne)it.next())); |
---|
46 | // } |
---|
47 | // |
---|
48 | // return result; |
---|
49 | // } |
---|
50 | } |
---|