Changeset 735 for trunk/grails-app/services/dbnp
- Timestamp:
- Jul 27, 2010, 4:26:35 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/dbnp/importer/ImporterService.groovy
r732 r735 225 225 def table = [] 226 226 227 // walk through all rows 227 // walk through all rows and fill the table with records 228 228 (rowindex..sheet.getLastRowNum()).each { i -> 229 229 table.add(createRecord(template_id, sheet.getRow(i), mcmap)) 230 230 } 231 232 /*table.each {233 it.each { entity ->234 entity.giveFields().each { field ->235 print field.name + ":" + entity.getFieldValue(field.name) + "/"236 }237 println238 }239 }*/240 241 231 return table 242 232 } … … 254 244 study.refresh() 255 245 246 // go through the data matrix, read every record and validate the entity and try to persist it 256 247 datamatrix.each { record -> 257 248 record.each { entity -> … … 312 303 def template = Template.get(template_id) 313 304 def record = [] 314 def samplingevent = new SamplingEvent(template:template) 315 305 306 // Initialize all possible entities with the chosen template 316 307 def study = new Study(template: template) 317 308 def subject = new Subject(template: template) … … 320 311 def sample = new Sample(template: template) 321 312 313 // Go through the Excel row cell by cell 322 314 for (HSSFCell cell: excelrow) { 315 // get the MappingColumn information of the current cell 323 316 def mc = mcmap[cell.getColumnIndex()] 324 317 def value … … 332 325 } 333 326 327 // which entity does the current cell (field) belong to? 334 328 switch (mc.entity) { 335 329 case Study: (record.any {it.getClass() == mc.entity}) ? 0 : record.add(study)
Note: See TracChangeset
for help on using the changeset viewer.