Changeset 1421


Ignore:
Timestamp:
Jan 20, 2011, 6:13:33 PM (13 years ago)
Author:
work@…
Message:
  • fixed importer issue with the authentication service not being available in static scope
Location:
trunk/grails-app
Files:
2 edited

Legend:

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

    r1419 r1421  
    3636        // (see http://www.grails.org/plugin/grom)
    3737        def pluginManager
    38         def AuthenticationService
     38        def authenticationService
    3939        def fileService
    4040        def ImporterService
     
    9090                        flow.pages = [
    9191                                [title: 'Import file'],
    92                                 [title: 'Properties'],
    93                                 [title: 'Mappings'],
     92                                [title: 'Assign properties'],
     93                                [title: 'Check imported data'],
    9494                                //[title: 'Imported'],
    95                                 [title: 'Persist']
     95                                [title: 'Done']
    9696                        ]
    9797                        flow.cancel = true;
     
    127127
    128128                                flow.page = 1
    129                                 flow.studies = Study.findAllWhere(owner: AuthenticationService.getLoggedInUser())
     129                                flow.studies = Study.findAllWhere(owner: authenticationService.getLoggedInUser())
    130130                                flow.importer_importableentities = grailsApplication.config.gscf.domain.importableEntities
    131131
     
    140140                                // Trying to import data into an existing study?
    141141                                if (flow.importer_study)
    142                                         if (flow.importer_study.canWrite(AuthenticationService.getLoggedInUser())) {
     142                                        if (flow.importer_study.canWrite(authenticationService.getLoggedInUser())) {
    143143                                                if (fileImportPage(flow, params)) {
    144144                                                        success()
     
    521521                //def (validatedSuccesfully, updatedEntities, failedToPersist) =
    522522                //try {
    523                 ImporterService.saveDatamatrix(flow.importer_study, flow.importer_importeddata)
     523                ImporterService.saveDatamatrix(flow.importer_study, flow.importer_importeddata, authenticationService)
    524524
    525525                //}
  • trunk/grails-app/services/dbnp/importer/ImporterService.groovy

    r1417 r1421  
    3131
    3232class ImporterService {
    33         def AuthenticationService
     33        def authenticationService
    3434
    3535        boolean transactional = true
     
    276276         * @param datamatrix two dimensional array containing entities with values read from Excel file
    277277         */
    278         static saveDatamatrix(Study study, datamatrix) {
     278        static saveDatamatrix(Study study, datamatrix, authenticationService) {
    279279                def validatedSuccesfully = 0
    280280                def entitystored = null
     
    288288                                switch (entity.getClass()) {
    289289                                        case Study: println "Persisting Study `" + entity + "`: "
    290                                                 entity.owner = AuthenticationService.getLoggedInUser()
     290                                                entity.owner = authenticationService.getLoggedInUser()
    291291                                                persistEntity(entity)
    292292                                                break
Note: See TracChangeset for help on using the changeset viewer.