Ignore:
Timestamp:
Nov 2, 2010, 4:48:11 PM (10 years ago)
Author:
t.w.abma@…
Message:
  • initial "failed cells" logic figured out, now extracts cells from the datamatrix which were not able to be stored in an entity
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/services/dbnp/importer/ImporterService.groovy

    r1045 r1050  
    230230        }
    231231        return table   
     232    }
     233
     234    /** Method to extract failed cells from the datamatrix. Failed cells are cell values
     235     * which could not be stored in an entity (e.g. Humu Supiuns in an ontology field).
     236     *
     237     * @param datamatrix two dimensional array containing entities and possibly also failed cells
     238     * @return array of failed cells
     239     * */
     240    def getFailedCells(datamatrix) {
     241       def failedcells = []
     242       
     243       datamatrix.each { record ->
     244            record.each { column ->
     245                column.each {
     246                    if (it.getClass().getName().equals('java.util.LinkedHashMap$Entry')) {
     247                        println it.key
     248                        println it.value
     249                        failedcells.add(it)
     250                    }
     251                }
     252            }
     253        }
     254
     255        return failedcells
    232256    }
    233257   
     
    424448                                    // leave the field empty and let the user choose the ontology manually in a later step
    425449                                    failed.put(mc, value)
     450                                    println "failed ("+mc.templatefieldtype+"`" + value + "`"
    426451                                }
    427452                        } // end
     
    431456        // a failed column means that using the entity.setFieldValue() threw an exception
    432457        //record.add(failed)
    433        
    434458        return record
    435459    }
Note: See TracChangeset for help on using the changeset viewer.