Ignore:
Timestamp:
Mar 8, 2010, 5:53:30 PM (7 years ago)
Author:
tabma
Message:
  • columnmapping added
File:
1 edited

Legend:

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

    r215 r245  
    5757
    5858    /**
    59     * User has assigned all entities to the columns and continues to the next step (assigning properties to columns)
     59    * User has assigned all entities and celltypes to the columns and continues to the next step (assigning properties to columns)
    6060    *
    61     * @param entity list of entities
     61    * @param entity list of entities and columns it has been assigned to (columnindex:entitytype format)
     62    * @param celltype list of celltypes and columns it has been assigned to (columnindex:celltype format)
    6263    * @return properties page
    6364    */
    6465    def savepreview = {
    6566        def entities  = request.getParameterValues("entity")
     67        def celltypes = request.getParameterValues("celltype")
     68
     69        celltypes.each { c ->
     70            def temp = c.split(":")
     71           
     72            session.header[temp[0].toInteger()].celltype =  temp[1].toInteger()
     73        }
     74
     75        entities.each { e ->
     76            def temp = e.split(":")
     77            Class clazz
     78            switch (temp[1]) {
     79                case 0: clazz = Study
     80                        break
     81                case 1: clazz = Subject
     82                        break
     83                case 2: clazz = Event
     84                        break
     85                case 3: clazz = Protocol
     86                        break
     87                case 4: clazz = Sample
     88                        break
     89                default: clazz = String
     90            }
     91            session.header[temp[0].toInteger()].entity = clazz
     92        }
    6693
    6794        // currently only one template is used for all entities
     
    7299        render(view:"step2", model:[entities:entities, header:session.header, templates:templates])
    73100    }
     101
     102    /**
     103    * @param columnproperty array of columns and the assigned property in `column:property_id` format
     104    *
     105    */
     106    def saveproperties = {
     107
     108        /*def columnproperties  = request.getParameterValues("columnproperty")
     109        columnproperties.each { cp ->
     110                def temp = cp.split(":")
     111                session.header[temp[0]]
     112        }*/
     113        for (e in session.header) {
     114            println e
     115        }
     116        render ("properties saved")
     117    }
    74118}
Note: See TracChangeset for help on using the changeset viewer.