- Timestamp:
- Feb 1, 2011, 5:33:41 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/dbnp/importer/ImporterService.groovy
r1457 r1469 151 151 152 152 (0..header.size() - 1).each { columnindex -> 153 def c = sheet.getRow(rowindex).getCell(columnindex, Row.CREATE_NULL_AS_BLANK)154 row.add(c)153 if (sheet.getRow(rowindex)) 154 row.add( sheet.getRow(rowindex).getCell(columnindex, Row.CREATE_NULL_AS_BLANK) ) 155 155 } 156 156 … … 277 277 record.each { entity -> 278 278 switch (entity.getClass()) { 279 case Study: log.info " Persisting Study `" + entity + "`: "279 case Study: log.info ".importer wizard, persisting Study `" + entity + "`: " 280 280 entity.owner = authenticationService.getLoggedInUser() 281 persistEntity(entity) 282 break 283 case Subject: log.info "Persisting Subject `" + entity + "`: " 281 282 if (study.validate()) { 283 if (!entity.save(flush:true)) { 284 log.error ".importer wizard, study could not be saved: " + entity 285 throw new Exception('.importer wizard, study could not be saved: ' + entity) 286 } 287 } else { 288 log.error ".importer wizard, study could not be validated: " + entity 289 throw new Exception('.importer wizard, study could not be validated: ' + entity) 290 } 291 292 break 293 case Subject: log.info ".importer wizard, persisting Subject `" + entity + "`: " 284 294 285 295 // is the current entity not already in the database? … … 292 302 293 303 break 294 case Event: log.info " Persisting Event `" + entity + "`: "304 case Event: log.info ".importer wizard, persisting Event `" + entity + "`: " 295 305 study.addToEvents(entity) 296 306 break 297 case Sample: log.info " Persisting Sample `" + entity + "`: "307 case Sample: log.info ".importer wizard, persisting Sample `" + entity + "`: " 298 308 299 309 // is this sample validatable (sample name unique for example?) … … 301 311 302 312 break 303 case SamplingEvent: log.info " Persisting SamplingEvent `" + entity + "`: "313 case SamplingEvent: log.info ".importer wizard, persisting SamplingEvent `" + entity + "`: " 304 314 study.addToSamplingEvents(entity) 305 315 break 306 default: log.info " Skipping persisting of `" + entity.getclass() + "`"316 default: log.info ".importer wizard, skipping persisting of `" + entity.getclass() + "`" 307 317 break 308 318 } // end switch … … 381 391 */ 382 392 boolean persistEntity(entity) { 383 log.info ".import wizard persisting ${entity}"384 385 try { 393 /*log.info ".import wizard persisting ${entity}" 394 395 try { 386 396 entity.save(flush: true) 387 397 return true … … 393 403 } 394 404 395 return true 405 return true*/ 406 //println "persistEntity" 396 407 } 397 408
Note: See TracChangeset
for help on using the changeset viewer.