2212 |
arthur |
1 |
package org.tela_botanica.del.client.modeles;
|
|
|
2 |
|
|
|
3 |
import java.util.ArrayList;
|
|
|
4 |
import java.util.HashMap;
|
|
|
5 |
import java.util.List;
|
|
|
6 |
import java.util.Map;
|
|
|
7 |
|
|
|
8 |
import com.google.gwt.user.client.Window;
|
|
|
9 |
|
|
|
10 |
public class Image {
|
|
|
11 |
|
|
|
12 |
private String idImage;
|
|
|
13 |
private Observation observation;
|
|
|
14 |
private String url;
|
|
|
15 |
private String urlFormat;
|
|
|
16 |
private String miniature;
|
|
|
17 |
private List<String> motsClefs;
|
|
|
18 |
|
|
|
19 |
public String getUrl() {
|
|
|
20 |
return url;
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
public String getMiniature() {
|
|
|
24 |
return miniature;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
public String getUrlFormat(String format) {
|
|
|
28 |
return urlFormat.replaceAll("%s%", format);
|
|
|
29 |
}
|
|
|
30 |
|
|
|
31 |
public void setUrlFormat(String urlFormat) {
|
|
|
32 |
this.urlFormat = urlFormat;
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
public void setUrl(String url) {
|
|
|
36 |
this.url = url;
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
public void setMiniature(String url) {
|
|
|
40 |
miniature = url;
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
public String getIdImage() {
|
|
|
44 |
return idImage;
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
public void setIdImage(String idImage) {
|
|
|
48 |
this.idImage = idImage;
|
|
|
49 |
}
|
|
|
50 |
|
|
|
51 |
// Impossible d'utiliser le type générique Map ici, pourquoi ? je ne sais pas !
|
|
|
52 |
private HashMap<String, HashMap<String, VoteProtocole>> votesProtocoles = new HashMap<String, HashMap<String, VoteProtocole>>();
|
|
|
53 |
|
|
|
54 |
public void ajouterVoteProtocole(VoteProtocole voteProcotole) {
|
|
|
55 |
getVotesProtocoles(voteProcotole.getIdProtocole()).put(voteProcotole.getContributeur(), voteProcotole);
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
public void supprimerVoteProtocole(String idProtocole, String idContributeur) {
|
|
|
59 |
if(utilisateurAVotePourProtocole(idProtocole, idContributeur)) {
|
|
|
60 |
votesProtocoles.get(idProtocole).remove(idContributeur);
|
|
|
61 |
}
|
|
|
62 |
}
|
|
|
63 |
|
|
|
64 |
public boolean utilisateurAVotePourProtocole(String idProtocole, String idContributeur) {
|
|
|
65 |
boolean aVote = false;
|
|
|
66 |
if (votesProtocoles.containsKey(idProtocole) && votesProtocoles.get(idProtocole).containsKey(idContributeur)) {
|
|
|
67 |
aVote = true;
|
|
|
68 |
}
|
|
|
69 |
return aVote;
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
public HashMap<String, VoteProtocole> getVotesProtocoles(String id_protocole) {
|
|
|
73 |
if(!votesProtocoles.containsKey(""+id_protocole) || votesProtocoles.get(""+id_protocole) == null) {
|
|
|
74 |
votesProtocoles.put(""+id_protocole, new HashMap<String, VoteProtocole>());
|
|
|
75 |
}
|
|
|
76 |
return votesProtocoles.get(id_protocole+"");
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
public HashMap<String, VoteProtocole> getVotesProtocoles(int id_protocole) {
|
|
|
80 |
return getVotesProtocoles(id_protocole+"");
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
public HashMap<String, HashMap<String, VoteProtocole>> getListeVotesProtocoles() {
|
|
|
84 |
return votesProtocoles;
|
|
|
85 |
}
|
|
|
86 |
|
|
|
87 |
public void setVoteProtocoles(HashMap<String, HashMap<String, VoteProtocole>> voteProtocoles) {
|
|
|
88 |
this.votesProtocoles = voteProtocoles;
|
|
|
89 |
}
|
|
|
90 |
|
|
|
91 |
public void setVoteProtocoles(String id_protocole, HashMap<String, VoteProtocole> voteProtocoles) {
|
|
|
92 |
this.votesProtocoles.put(id_protocole, voteProtocoles);
|
|
|
93 |
}
|
|
|
94 |
|
|
|
95 |
public Observation getObservation() {
|
|
|
96 |
return observation;
|
|
|
97 |
}
|
|
|
98 |
|
|
|
99 |
public void setObservation(Observation observation) {
|
|
|
100 |
this.observation = observation;
|
|
|
101 |
}
|
|
|
102 |
|
|
|
103 |
public List<String> getMotsClefs() {
|
|
|
104 |
return motsClefs;
|
|
|
105 |
}
|
|
|
106 |
|
|
|
107 |
public void setMotsClefs(List<String> motsClefs) {
|
|
|
108 |
this.motsClefs = motsClefs;
|
|
|
109 |
}
|
|
|
110 |
|
|
|
111 |
public void ajouterMotsClef(String motsClefs) {
|
|
|
112 |
if (this.motsClefs == null) {
|
|
|
113 |
this.motsClefs = new ArrayList<String>();
|
|
|
114 |
}
|
|
|
115 |
this.motsClefs.add(motsClefs);
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
public boolean estADeterminer() {
|
|
|
119 |
return observation == null || observation.estADeterminer() || motsClefs.contains("aDeterminer");
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
}
|