- Timestamp:
- Nov 4, 2010, 4:49:53 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/dbnp/importer/ImporterService.groovy
r1058 r1083 237 237 * 238 238 * @param datamatrix two dimensional array containing entities and possibly also failed cells 239 * @return array of failed cells in [ rownum:n, value:xxx] format239 * @return array of failed cells in [mappingcolumn, hssfcell] format 240 240 * */ 241 241 def getFailedCells(datamatrix) { … … 244 244 datamatrix.each { record -> 245 245 record.each { column -> 246 column.each { 246 column.each { 247 247 if (it.getClass().getName().equals('java.util.LinkedHashMap$Entry')) { 248 248 failedcells.add(it) … … 253 253 254 254 return failedcells 255 } 256 257 /** Method to put failed cells back into the datamatrix. Failed cells are cell values 258 * which could not be stored in an entity (e.g. Humu Supiuns in an ontology field). 259 * 260 * @param datamatrix two dimensional array containing entities and possibly also failed cells 261 * @param failedcells map of failed cells in [mappingcolumn, hssfcell] format 262 * @param correctedcells map of corrected cells 263 **/ 264 def saveCorrectedCells(datamatrix, failedcells, correctedcells) { 265 /*failedcells.each { 266 println it 267 }*/ 268 def newdatamatrix = [] 269 270 // Remove failed cells 'entity' / clean up datamatrix 271 datamatrix.each { record -> 272 def newrecord = [] 273 274 record.each { entity -> 275 // LinkedHashMap means a "mappingcolumn:hssfcell" object is inside the record (= failed to map to entity) 276 if (!entity.getClass().getName().equals('java.util.LinkedHashMap')) 277 newrecord.add(entity) 278 } 279 280 newdatamatrix.add(newrecord) 281 } 282 283 newdatamatrix.each { record -> 284 record.each { entity -> 285 entity.giveFields().each { field -> 286 println "das"+ field 287 } 288 } 289 } 290 291 println "-----" 292 correctedcells.each { 293 println it.dump() 294 } 255 295 } 256 296 … … 446 486 } // end switch 447 487 } catch (IllegalArgumentException iae) { 448 // leave the field empty and let the user choose the ontology manually in a later step449 failed.put(mc, [rownum:excelrow.getRowNum(), value:value])488 // store the mapping column and the cell in an array 489 failed.put(mc, cell) 450 490 //println "failed ("+mc.templatefieldtype+"`" + value + "`" 451 491 }
Note: See TracChangeset
for help on using the changeset viewer.