1 | package com.medias.xml.metadata; |
---|
2 | |
---|
3 | import com.medias.ConversionException; |
---|
4 | import com.medias.utils.Entity; |
---|
5 | import org.jdom.Element; |
---|
6 | |
---|
7 | /** |
---|
8 | * @author combaz |
---|
9 | * |
---|
10 | * Created on 10 févr. 2005 |
---|
11 | */ |
---|
12 | public class Description implements Entity |
---|
13 | { |
---|
14 | /** |
---|
15 | * |
---|
16 | */ |
---|
17 | private static final long serialVersionUID = 1L; |
---|
18 | private String organisme; |
---|
19 | private Contact pi; |
---|
20 | private Contact tech; |
---|
21 | // Uniquement pour partie dépÎt de données |
---|
22 | private String format; |
---|
23 | private String repartition; |
---|
24 | // Ajout pour partie accÚs aux données |
---|
25 | private ExactTime dateDeb; |
---|
26 | private ExactTime dateFin; |
---|
27 | private int nbFichiers; |
---|
28 | private int nbMesures; |
---|
29 | private int jeuId; |
---|
30 | private double lat_min; |
---|
31 | private double lon_min; |
---|
32 | private double alt_min; |
---|
33 | private double lat_max; |
---|
34 | private double lon_max; |
---|
35 | private double alt_max; |
---|
36 | |
---|
37 | public Description() { |
---|
38 | this.organisme = null; |
---|
39 | this.pi = new Contact(); |
---|
40 | this.tech = new Contact(); |
---|
41 | this.format = null; |
---|
42 | this.repartition = null; |
---|
43 | this.dateDeb = new ExactTime(); |
---|
44 | this.dateFin = new ExactTime(); |
---|
45 | this.nbFichiers = 0; |
---|
46 | this.nbMesures = 0; |
---|
47 | this.lat_min = 0; |
---|
48 | this.lon_min = 0; |
---|
49 | this.alt_min = 0; |
---|
50 | this.lat_max = 0; |
---|
51 | this.lon_max = 0; |
---|
52 | this.alt_max = 0; |
---|
53 | } |
---|
54 | |
---|
55 | public int getNbMesures() { |
---|
56 | return nbMesures; |
---|
57 | } |
---|
58 | public void setNbMesures(int nbMesures) { |
---|
59 | this.nbMesures = nbMesures; |
---|
60 | } |
---|
61 | public int getNbFichiers() { |
---|
62 | return nbFichiers; |
---|
63 | } |
---|
64 | public void setNbFichiers(int nbFichiers) { |
---|
65 | this.nbFichiers = nbFichiers; |
---|
66 | } |
---|
67 | /** |
---|
68 | * @return Returns the alt_max. |
---|
69 | */ |
---|
70 | public double getAlt_max() { |
---|
71 | return alt_max; |
---|
72 | } |
---|
73 | /** |
---|
74 | * @param alt_max The alt_max to set. |
---|
75 | */ |
---|
76 | public void setAlt_max(double alt_max) { |
---|
77 | this.alt_max = alt_max; |
---|
78 | } |
---|
79 | /** |
---|
80 | * @return Returns the alt_min. |
---|
81 | */ |
---|
82 | public double getAlt_min() { |
---|
83 | return alt_min; |
---|
84 | } |
---|
85 | /** |
---|
86 | * @param alt_min The alt_min to set. |
---|
87 | */ |
---|
88 | public void setAlt_min(double alt_min) { |
---|
89 | this.alt_min = alt_min; |
---|
90 | } |
---|
91 | /** |
---|
92 | * @return Returns the lat_max. |
---|
93 | */ |
---|
94 | public double getLat_max() { |
---|
95 | return lat_max; |
---|
96 | } |
---|
97 | /** |
---|
98 | * @param lat_max The lat_max to set. |
---|
99 | */ |
---|
100 | public void setLat_max(double lat_max) { |
---|
101 | this.lat_max = lat_max; |
---|
102 | } |
---|
103 | /** |
---|
104 | * @return Returns the lat_min. |
---|
105 | */ |
---|
106 | public double getLat_min() { |
---|
107 | return lat_min; |
---|
108 | } |
---|
109 | /** |
---|
110 | * @param lat_min The lat_min to set. |
---|
111 | */ |
---|
112 | public void setLat_min(double lat_min) { |
---|
113 | this.lat_min = lat_min; |
---|
114 | } |
---|
115 | /** |
---|
116 | * @return Returns the lon_max. |
---|
117 | */ |
---|
118 | public double getLon_max() { |
---|
119 | return lon_max; |
---|
120 | } |
---|
121 | /** |
---|
122 | * @param lon_max The lon_max to set. |
---|
123 | */ |
---|
124 | public void setLon_max(double lon_max) { |
---|
125 | this.lon_max = lon_max; |
---|
126 | } |
---|
127 | /** |
---|
128 | * @return Returns the lon_min. |
---|
129 | */ |
---|
130 | public double getLon_min() { |
---|
131 | return lon_min; |
---|
132 | } |
---|
133 | /** |
---|
134 | * @param lon_min The lon_min to set. |
---|
135 | */ |
---|
136 | public void setLon_min(double lon_min) { |
---|
137 | this.lon_min = lon_min; |
---|
138 | } |
---|
139 | /** |
---|
140 | * @return Returns the dateDeb. |
---|
141 | */ |
---|
142 | public ExactTime getDateDeb() { |
---|
143 | return dateDeb; |
---|
144 | } |
---|
145 | /** |
---|
146 | * @param dateDeb The dateDeb to set. |
---|
147 | */ |
---|
148 | public void setDateDeb(ExactTime dateDeb) { |
---|
149 | this.dateDeb = dateDeb; |
---|
150 | } |
---|
151 | /** |
---|
152 | * @return Returns the dateFin. |
---|
153 | */ |
---|
154 | public ExactTime getDateFin() { |
---|
155 | return dateFin; |
---|
156 | } |
---|
157 | /** |
---|
158 | * @param dateFin The dateFin to set. |
---|
159 | */ |
---|
160 | public void setDateFin(ExactTime dateFin) { |
---|
161 | this.dateFin = dateFin; |
---|
162 | } |
---|
163 | /** |
---|
164 | * @return Returns the format. |
---|
165 | */ |
---|
166 | public String getFormat() { |
---|
167 | return format; |
---|
168 | } |
---|
169 | /** |
---|
170 | * @param format The format to set. |
---|
171 | */ |
---|
172 | public void setFormat(String format) { |
---|
173 | this.format = format; |
---|
174 | } |
---|
175 | /** |
---|
176 | * @return Returns the organisme. |
---|
177 | */ |
---|
178 | public String getOrganisme() { |
---|
179 | return organisme; |
---|
180 | } |
---|
181 | /** |
---|
182 | * @param organisme The organisme to set. |
---|
183 | */ |
---|
184 | public void setOrganisme(String organisme) { |
---|
185 | this.organisme = organisme; |
---|
186 | } |
---|
187 | /** |
---|
188 | * @return Returns the pi. |
---|
189 | */ |
---|
190 | public Contact getPi() { |
---|
191 | return pi; |
---|
192 | } |
---|
193 | /** |
---|
194 | * @param pi The pi to set. |
---|
195 | */ |
---|
196 | public void setPi(Contact pi) { |
---|
197 | this.pi = pi; |
---|
198 | this.pi.setRole("pi"); |
---|
199 | } |
---|
200 | /** |
---|
201 | * @return Returns the repartition. |
---|
202 | */ |
---|
203 | public String getRepartition() { |
---|
204 | return repartition; |
---|
205 | } |
---|
206 | /** |
---|
207 | * @param repartition The repartition to set. |
---|
208 | */ |
---|
209 | public void setRepartition(String repartition) { |
---|
210 | this.repartition = repartition; |
---|
211 | } |
---|
212 | /** |
---|
213 | * @return Returns the tech. |
---|
214 | */ |
---|
215 | public Contact getTech() { |
---|
216 | return tech; |
---|
217 | } |
---|
218 | /** |
---|
219 | * @param tech The tech to set. |
---|
220 | */ |
---|
221 | public void setTech(Contact tech) { |
---|
222 | this.tech = tech; |
---|
223 | this.tech.setRole("tech"); |
---|
224 | } |
---|
225 | |
---|
226 | public Element toXmlElement(String title) { |
---|
227 | Element o = new Element("organisme"); |
---|
228 | o.addContent(this.organisme); |
---|
229 | Element p = this.pi.toXmlElement("pi"); |
---|
230 | Element t = this.tech.toXmlElement("technicien"); |
---|
231 | Element f = new Element("format"); |
---|
232 | f.addContent(this.format); |
---|
233 | Element r = new Element("repartition"); |
---|
234 | r.addContent(this.repartition); |
---|
235 | |
---|
236 | Element d = new Element(title); |
---|
237 | d.addContent(o); |
---|
238 | d.addContent(p); |
---|
239 | d.addContent(t); |
---|
240 | d.addContent(f); |
---|
241 | d.addContent(r); |
---|
242 | return d; |
---|
243 | } |
---|
244 | |
---|
245 | public void fromXmlElement(Element el) throws ConversionException { |
---|
246 | Element o = el.getChild("organisme"); |
---|
247 | Element p = el.getChild("pi"); |
---|
248 | Element t = el.getChild("technicien"); |
---|
249 | Element f = el.getChild("format"); |
---|
250 | Element r = el.getChild("repartition"); |
---|
251 | |
---|
252 | if((o==null)||(p==null)||(t==null)||(f==null)||(r==null)) |
---|
253 | throw new ConversionException(ConversionException.ERROR_fromXml + " Description !"); |
---|
254 | |
---|
255 | else { |
---|
256 | this.setOrganisme(o.getText()); |
---|
257 | this.pi.fromXmlElement(p); |
---|
258 | this.tech.fromXmlElement(t); |
---|
259 | this.setFormat(f.getText()); |
---|
260 | this.setRepartition(r.getText()); |
---|
261 | } |
---|
262 | } |
---|
263 | |
---|
264 | public int getJeuId() { |
---|
265 | return jeuId; |
---|
266 | } |
---|
267 | |
---|
268 | public void setJeuId(int jeuId) { |
---|
269 | this.jeuId = jeuId; |
---|
270 | } |
---|
271 | |
---|
272 | } |
---|