Changeset 3489
- Timestamp:
- 09/09/10 12:03:42 (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molgenis_projects/molgenis4phenotype/handwritten/java/plugin/yearlyreportplugin/VWAReport4.java
r3488 r3489 46 46 List<Integer> aliveEndOfPrevYearList = new ArrayList<Integer>(); 47 47 List<Integer> aliveEndOfThisYearList = new ArrayList<Integer>(); 48 List<Integer> col3List = new ArrayList<Integer>(); 49 List<Integer> col4List = new ArrayList<Integer>(); 50 List<Integer> col5List = new ArrayList<Integer>(); 51 List<Integer> col6List = new ArrayList<Integer>(); 52 List<Integer> col7List = new ArrayList<Integer>(); 53 List<Integer> col8List = new ArrayList<Integer>(); 54 List<Integer> col9List = new ArrayList<Integer>(); 55 List<Integer> col10List = new ArrayList<Integer>(); 56 List<Integer> col11List = new ArrayList<Integer>(); 57 List<Integer> col12List = new ArrayList<Integer>(); 58 List<Integer> col13List = new ArrayList<Integer>(); 59 List<Integer> col14List = new ArrayList<Integer>(); 60 List<Integer> col15List = new ArrayList<Integer>(); 61 List<Integer> col16List = new ArrayList<Integer>(); 62 List<Integer> col17List = new ArrayList<Integer>(); 48 63 49 64 List<ObservationTarget> animalList = ct.GetAllAnimals(); … … 57 72 58 73 // Check AnimalType 74 String animalType = ""; 59 75 int featid = ct.GetObservableFeatureId("AnimalType"); 60 76 Query q = db.query(ObservedValue.class); … … 63 79 List<ObservedValue> valueList = q.find(); 64 80 if (valueList.size() > 0) { 65 StringanimalType = valueList.get(0).getValue();81 animalType = valueList.get(0).getValue(); 66 82 // Ignore animals that are not of the correct type for this report 67 83 if ((animalType.equals("A. Gewoon dier") && !type.equals("A")) || … … 132 148 if (skipAnimal) continue; 133 149 150 // Get source and source type for animals that came in this year 151 boolean col3 = false; 152 boolean col4 = false; 153 boolean col5 = false; 154 boolean col6 = false; 155 boolean col7 = false; 156 boolean col8 = false; 157 boolean col9 = false; 158 if (aliveEndOfPrevYear == false) { 159 featid = ct.GetObservableFeatureId("Source"); 160 q = db.query(ObservedValue.class); 161 q.addRules(new QueryRule("observationTarget", Operator.EQUALS, targetid)); 162 q.addRules(new QueryRule("observableFeature", Operator.EQUALS, featid)); 163 valueList = q.find(); 164 if (valueList.size() > 0) { 165 int sourceid = valueList.get(0).getRelatedObservationTarget(); 166 featid = ct.GetObservableFeatureId("SourceType"); 167 q = db.query(ObservedValue.class); 168 q.addRules(new QueryRule("observationTarget", Operator.EQUALS, sourceid)); 169 q.addRules(new QueryRule("observableFeature", Operator.EQUALS, featid)); 170 valueList = q.find(); 171 if (valueList.size() > 0) { 172 String sourcetype = valueList.get(0).getValue(); 173 if (sourcetype.equals("Eigen fok binnen uw organisatorische werkeenheid")) col3 = true; 174 if (sourcetype.equals("Andere organisatorische werkeenheid vd instelling")) col4 = true; 175 if (sourcetype.equals("Geregistreerde fok/aflevering in Nederland")) col5 = true; 176 if (sourcetype.equals("Van EU-lid-staten")) col6 = true; 177 if (sourcetype.equals("Niet-geregistreerde fok/afl in Nederland")) col7 = true; 178 if (sourcetype.equals("Niet-geregistreerde fok/afl in andere EU-lid-staat")) col8 = true; 179 if (sourcetype.equals("Andere herkomst")) col9 = true; 180 } 181 } 182 } 183 184 // Check AnimalType to see if it's been caught from the wild 185 boolean col10 = false; 186 if (aliveEndOfPrevYear == false && animalType.equals("C. Wildvang")) { 187 col10 = true; 188 } 189 190 // Get animals that were removed this year 191 boolean col11 = false; 192 boolean col12 = false; 193 boolean col13 = false; 194 boolean col14 = false; 195 boolean col15 = false; 196 boolean col16 = false; 197 boolean col17 = false; 198 if (aliveEndOfThisYear == false) { 199 // Not in an experiment at all? 200 featid = ct.GetObservableFeatureId("Experiment"); 201 q = db.query(ObservedValue.class); 202 q.addRules(new QueryRule("observationTarget", Operator.EQUALS, targetid)); 203 q.addRules(new QueryRule("observableFeature", Operator.EQUALS, featid)); 204 valueList = q.find(); 205 if (valueList.size() == 0) { 206 col11 = true; 207 } 208 209 // While in or after experiment? 210 featid = ct.GetObservableFeatureId("ActualAnimalEndStatus"); 211 q = db.query(ObservedValue.class); 212 q.addRules(new QueryRule("observationTarget", Operator.EQUALS, targetid)); 213 q.addRules(new QueryRule("observableFeature", Operator.EQUALS, featid)); 214 valueList = q.find(); 215 if (valueList.size() > 0) { 216 String endstatus = valueList.get(0).getValue(); 217 if (endstatus.equals("A. Dood in het kader van de proef")) col12 = true; 218 if (endstatus.equals("B. Gedood na beeindiging van de proef") || endstatus.equals("C. Na einde proef in leven gelaten")) col13 = true; 219 } 220 } 221 134 222 // Get species 135 223 featid = ct.GetObservableFeatureId("Species"); … … 142 230 if (!speciesIdList.contains(speciesid)) { // new species 143 231 speciesIdList.add(speciesid); 144 // Plus, store numbers on status for right species232 // Plus, store numbers on status etc. for right species 145 233 if (aliveEndOfThisYear) { 146 234 aliveEndOfThisYearList.add(1); … … 152 240 } else { 153 241 aliveEndOfPrevYearList.add(0); 242 } 243 if (col3) { 244 col3List.add(1); 245 } else { 246 col3List.add(0); 247 } 248 if (col4) { 249 col4List.add(1); 250 } else { 251 col4List.add(0); 252 } 253 if (col5) { 254 col5List.add(1); 255 } else { 256 col5List.add(0); 257 } 258 if (col6) { 259 col6List.add(1); 260 } else { 261 col6List.add(0); 262 } 263 if (col7) { 264 col7List.add(1); 265 } else { 266 col7List.add(0); 267 } 268 if (col8) { 269 col8List.add(1); 270 } else { 271 col8List.add(0); 272 } 273 if (col9) { 274 col9List.add(1); 275 } else { 276 col9List.add(0); 277 } 278 if (col10) { 279 col10List.add(1); 280 } else { 281 col10List.add(0); 282 } 283 if (col11) { 284 col11List.add(1); 285 } else { 286 col11List.add(0); 287 } 288 if (col12) { 289 col12List.add(1); 290 } else { 291 col12List.add(0); 292 } 293 if (col13) { 294 col13List.add(1); 295 } else { 296 col13List.add(0); 297 } 298 if (col14) { 299 col14List.add(1); 300 } else { 301 col14List.add(0); 302 } 303 if (col15) { 304 col15List.add(1); 305 } else { 306 col15List.add(0); 307 } 308 if (col16) { 309 col16List.add(1); 310 } else { 311 col16List.add(0); 312 } 313 if (col17) { 314 col17List.add(1); 315 } else { 316 col17List.add(0); 154 317 } 155 318 } else { // species already in list … … 162 325 Integer tmp = aliveEndOfThisYearList.get(specid); 163 326 aliveEndOfThisYearList.set(specid, tmp + 1); 327 } 328 if (col3) { 329 Integer tmp = col3List.get(specid); 330 col3List.set(specid, tmp + 1); 331 } 332 if (col4) { 333 Integer tmp = col4List.get(specid); 334 col4List.set(specid, tmp + 1); 335 } 336 if (col5) { 337 Integer tmp = col5List.get(specid); 338 col5List.set(specid, tmp + 1); 339 } 340 if (col6) { 341 Integer tmp = col6List.get(specid); 342 col6List.set(specid, tmp + 1); 343 } 344 if (col7) { 345 Integer tmp = col7List.get(specid); 346 col7List.set(specid, tmp + 1); 347 } 348 if (col8) { 349 Integer tmp = col8List.get(specid); 350 col8List.set(specid, tmp + 1); 351 } 352 if (col9) { 353 Integer tmp = col9List.get(specid); 354 col9List.set(specid, tmp + 1); 355 } 356 if (col10) { 357 Integer tmp = col10List.get(specid); 358 col10List.set(specid, tmp + 1); 359 } 360 if (col11) { 361 Integer tmp = col11List.get(specid); 362 col11List.set(specid, tmp + 1); 363 } 364 if (col12) { 365 Integer tmp = col12List.get(specid); 366 col12List.set(specid, tmp + 1); 367 } 368 if (col13) { 369 Integer tmp = col13List.get(specid); 370 col13List.set(specid, tmp + 1); 371 } 372 if (col14) { 373 Integer tmp = col14List.get(specid); 374 col14List.set(specid, tmp + 1); 375 } 376 if (col15) { 377 Integer tmp = col15List.get(specid); 378 col15List.set(specid, tmp + 1); 379 } 380 if (col16) { 381 Integer tmp = col16List.get(specid); 382 col16List.set(specid, tmp + 1); 383 } 384 if (col17) { 385 Integer tmp = col17List.get(specid); 386 col17List.set(specid, tmp + 1); 164 387 } 165 388 } … … 188 411 matrix[idx][0] = species; 189 412 matrix[idx][1] = aliveEndOfPrevYearList.get(idx).toString(); 190 // For now, fill rest of matrix with empties 191 for (int col = 2; col < nrCol - 1; col++) { 192 matrix[idx][col] = ""; 193 } 194 matrix[idx][nrCol - 1] = aliveEndOfThisYearList.get(idx).toString(); 413 matrix[idx][2] = col3List.get(idx).toString(); 414 matrix[idx][3] = col4List.get(idx).toString(); 415 matrix[idx][4] = col5List.get(idx).toString(); 416 matrix[idx][5] = col6List.get(idx).toString(); 417 matrix[idx][6] = col7List.get(idx).toString(); 418 matrix[idx][7] = col8List.get(idx).toString(); 419 matrix[idx][8] = col9List.get(idx).toString(); 420 matrix[idx][9] = col10List.get(idx).toString(); 421 matrix[idx][10] = col11List.get(idx).toString(); 422 matrix[idx][11] = col12List.get(idx).toString(); 423 matrix[idx][12] = col13List.get(idx).toString(); 424 matrix[idx][13] = col14List.get(idx).toString(); 425 matrix[idx][14] = col15List.get(idx).toString(); 426 matrix[idx][15] = col16List.get(idx).toString(); 427 matrix[idx][16] = col17List.get(idx).toString(); 428 matrix[idx][17] = aliveEndOfThisYearList.get(idx).toString(); 195 429 idx++; 196 430 } … … 203 437 @Override 204 438 public String toString() { 205 String output = "<br /><p><strong> Report 4" + type + " for the year " + year+ "</strong></p>";439 String output = "<br /><p><strong>JAARSTAAT AAN- EN AFVOER DIEREN registratiejaar " + year + " - Registratieformulier 4" + type + "</strong></p>"; 206 440 output += "<br /><table border='1' cellpadding='5' cellspacing='5'>"; 207 441 output += "<tr>"; 208 442 for (int col = 1; col <= nrCol; col++) { 209 output += ("<th>" + col + "</th>"); 443 output += "<th"; 444 if (col == 10 || col == 17) output += " style='border-right-width:2'"; 445 output += (">" + col + "</th>"); 210 446 } 447 output += "</tr>"; 448 output += "<tr>"; 449 output += "<td>Codenummer/diersoort en/of naam</td>"; 450 output += "<td>aanwezig op 1 jan. " + year + "</td>"; 451 output += "<td>eigen fok</td>"; 452 output += "<td>organisatorische eenheid RuG</td>"; 453 output += "<td>gereg. fok NL</td>"; 454 output += "<td>gereg. fok EU</td>"; 455 output += "<td>niet-gereg. fok NL</td>"; 456 output += "<td>niet-gereg. fok EU</td>"; 457 output += "<td>andere herkomst</td>"; 458 output += "<td style='border-right-width:2'>wilde fauna</td>"; 459 output += "<td>dood of gedood<br />voor het begin van de proef</td>"; 460 output += "<td>dood of gedood<br />tijdens de proef</td>"; 461 output += "<td>dood of gedood<br />na afloop van de proef</td>"; 462 output += "<td>levend afgevoerd<br />andere organisatorische eenheid RuG</td>"; 463 output += "<td>levend afgevoerd<br />gereg. onderzoeksinstelling NL</td>"; 464 output += "<td>levend afgevoerd<br />gereg. onderzoeksinstelling EU</td>"; 465 output += "<td style='border-right-width:2'>levend afgevoerd<br />andere bestemming</td>"; 466 output += "<td>aanwezig op 31 dec. " + year + "</td>"; 211 467 output += "</tr>"; 212 468 for (int idx = 0; idx < speciesList.size(); idx++) { 213 469 output += "<tr>"; 214 for (int col = 0; col < nrCol; col++) { 215 output += ("<td>" + matrix[idx][col] + "</td>"); 470 for (int col = 1; col <= nrCol; col++) { 471 output += "<td"; 472 if (col == 10 || col == 17) output += " style='border-right-width:2'"; 473 output += (">" + matrix[idx][col - 1] + "</td>"); 216 474 } 217 475 output += "</tr>";
Note: See TracChangeset
for help on using the changeset viewer.