Ignore:
Timestamp:
Apr 7, 2010, 11:24:56 AM (11 years ago)
Author:
tabma
Message:
  • study can be selected, imported data fancier postview, lazy loading bug fixed (hopefully)
File:
1 edited

Legend:

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

    r322 r328  
    200200
    201201    /**
    202      * @param datamatrix two dimensional array containing entities with values read from Excel file
     202     * Method to store a matrix containing the entities in a record like structure. Every row in the table
     203     * contains one or more entity objects (which contain fields with values). So actually a row represents
     204     * a record with fields from one or more different entities.
     205     *
     206     * @param study entity Study
     207     * @param datamatrix two dimensional array containing entities with values read from Excel file     *
    203208     */   
    204     def savedata(datamatrix) {
     209    def savedata(Study study, datamatrix) {
     210        study.refresh()
     211       
    205212        datamatrix.each { record ->
    206213            record.each { entity ->
     
    210217                                    break
    211218                    case Subject :  print "Persisting Subject `" + entity.name + "`: "
    212                                     persistEntity(entity)
     219                                    persistEntity(entity)                                   
     220                                    study.addToSubjects(entity)
    213221                                    break
    214222                    case Event   :  print "Persisting Event `" + entity.eventdescription + "`: "
     
    225233                }
    226234            }
    227         }       
     235        }
    228236    }
    229237
     
    234242     *
    235243     */
    236     def persistEntity(entity) {
    237         println entity.dump()
    238         if (entity.save(flush:true)) {  //.merge?
    239             println "OK"
     244    def persistEntity(entity) {
     245        if (entity.save(flush:true)) {  //.merge?           
    240246        } else entity.errors.allErrors.each {
    241247                println it
Note: See TracChangeset for help on using the changeset viewer.