Changeset 1422


Ignore:
Timestamp:
Jan 20, 2011, 6:32:41 PM (12 years ago)
Author:
work@…
Message:
  • fixed importer issue with the authentication service not being available in static scope
  • log was also not available in static scope
  • changed logging from println to log.info
Location:
trunk/grails-app
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy

    r1421 r1422  
    249249                                if (saveEntities(flow, params)) {
    250250                                        //if (ImporterService.saveDatamatrix(flow.importer_study, flow.importer_importeddata)) {
    251                                         log.error ".import wizard succesfully persisted all entities"
     251                                        //log.error ".import wizard succesfully persisted all entities"
    252252                                        //def session = sessionFactory.getCurrentSession()
    253253                                        //session.clear()
     
    521521                //def (validatedSuccesfully, updatedEntities, failedToPersist) =
    522522                //try {
    523                 ImporterService.saveDatamatrix(flow.importer_study, flow.importer_importeddata, authenticationService)
     523                ImporterService.saveDatamatrix(flow.importer_study, flow.importer_importeddata, authenticationService, log)
    524524
    525525                //}
  • trunk/grails-app/services/dbnp/importer/ImporterService.groovy

    r1421 r1422  
    257257                                                        // Update the entity field
    258258                                                        entity.setFieldValue(cell.mappingcolumn.property, correctedvalue)
    259                                                         //println "Adjusted " + cell.mappingcolumn.property + " to " + correctedvalue
     259                                                        //log.info "Adjusted " + cell.mappingcolumn.property + " to " + correctedvalue
    260260                                                }
    261261                                                catch (Exception e) {
    262                                                         //println "Could not map corrected ontology: " + cell.mappingcolumn.property + " to " + correctedvalue
     262                                                        //log.info "Could not map corrected ontology: " + cell.mappingcolumn.property + " to " + correctedvalue
    263263                                                }
    264264                                        }
     
    276276         * @param datamatrix two dimensional array containing entities with values read from Excel file
    277277         */
    278         static saveDatamatrix(Study study, datamatrix, authenticationService) {
     278        static saveDatamatrix(Study study, datamatrix, authenticationService, log) {
    279279                def validatedSuccesfully = 0
    280280                def entitystored = null
     
    287287                        record.each { entity ->
    288288                                switch (entity.getClass()) {
    289                                         case Study: println "Persisting Study `" + entity + "`: "
     289                                        case Study: log.info "Persisting Study `" + entity + "`: "
    290290                                                entity.owner = authenticationService.getLoggedInUser()
    291291                                                persistEntity(entity)
    292292                                                break
    293                                         case Subject: println "Persisting Subject `" + entity + "`: "
     293                                        case Subject: log.info "Persisting Subject `" + entity + "`: "
    294294
    295295                                                // is the current entity not already in the database?
     
    302302
    303303                                                break
    304                                         case Event: println "Persisting Event `" + entity + "`: "
     304                                        case Event: log.info "Persisting Event `" + entity + "`: "
    305305                                                study.addToEvents(entity)
    306306                                                break
    307                                         case Sample: println "Persisting Sample `" + entity + "`: "
     307                                        case Sample: log.info "Persisting Sample `" + entity + "`: "
    308308
    309309                                                // is this sample validatable (sample name unique for example?)
     
    311311
    312312                                                break
    313                                         case SamplingEvent: println "Persisting SamplingEvent `" + entity + "`: "
     313                                        case SamplingEvent: log.info "Persisting SamplingEvent `" + entity + "`: "
    314314                                                study.addToSamplingEvents(entity)
    315315                                                break
    316                                         default: println "Skipping persisting of `" + entity.getclass() + "`"
     316                                        default: log.info "Skipping persisting of `" + entity.getclass() + "`"
    317317                                                break
    318318                                } // end switch
     
    391391         */
    392392        boolean persistEntity(entity) {
    393                 println ".import wizard persisting ${entity}"
     393                log.info ".import wizard persisting ${entity}"
    394394
    395395                try {
Note: See TracChangeset for help on using the changeset viewer.