Ignore:
Timestamp:
Mar 9, 2010, 3:53:46 PM (9 years ago)
Author:
tabma
Message:
File:
1 edited

Legend:

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

    r247 r251  
    2323import org.apache.poi.ss.usermodel.DataFormatter
    2424import dbnp.studycapturing.Template
     25import dbnp.studycapturing.Study
     26import dbnp.studycapturing.Subject
     27import dbnp.studycapturing.Event
     28import dbnp.studycapturing.Protocol
     29import dbnp.studycapturing.Sample
     30import dbnp.studycapturing.TemplateFieldType
    2531
    2632class ImporterController {
     
    5359
    5460        render (view:"step1", model:[header:header, datamatrix:datamatrix])
    55 
    5661    }
    5762
    5863    /**
    5964    * User has assigned all entities and celltypes to the columns and continues to the next step (assigning properties to columns)
     65    * All information of the columns is stored in a session as MappingColumn object
    6066    *
    6167    * @param entity list of entities and columns it has been assigned to (columnindex:entitytype format)
    6268    * @param celltype list of celltypes and columns it has been assigned to (columnindex:celltype format)
    6369    * @return properties page
     70    *
     71    * @see celltype: http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/Cell.html
    6472    */
    6573    def savepreview = {
     
    6977        celltypes.each { c ->
    7078            def temp = c.split(":")
     79            def celltype = temp[1].toInteger()
     80            def templatefieldtype = TemplateFieldType.STRING
    7181           
    72             session.header[temp[0].toInteger()].celltype =  temp[1].toInteger()
     82            session.header[temp[0].toInteger()].celltype = celltype
     83
     84            switch (celltype) {
     85                case 0 : templatefieldtype = TemplateFieldType.INTEGER
     86                         break
     87                case 1 : templatefieldtype = TemplateFieldType.STRING
     88                         break
     89                case 2 :  // formula cell type, cannot handle this
     90                         break
     91                case 3 : templatefieldtype = TemplateFieldType.STRING
     92                         break
     93                default: break
     94            }
    7395        }
    7496
     
    7698            def temp = e.split(":")
    7799            Class clazz
    78             switch (temp[1]) {
     100
     101            switch (temp[1].toInteger()) {
    79102                case 0: clazz = Study
    80103                        break
     
    87110                case 4: clazz = Sample
    88111                        break
    89                 default: clazz = String
     112                default: clazz = Object
    90113            }
     114
     115            session.header[temp[0].toInteger()].index = temp[0].toInteger()
    91116            session.header[temp[0].toInteger()].entity = clazz
    92117        }
     
    106131    def saveproperties = {
    107132
    108         /*def columnproperties  = request.getParameterValues("columnproperty")
     133        def columnproperties  = request.getParameterValues("columnproperty")
    109134        columnproperties.each { cp ->
    110135                def temp = cp.split(":")
    111                 session.header[temp[0]]
    112         }*/
     136                session.header[temp[0].toInteger()].property = temp[1].toInteger()
     137        }
     138       
    113139        for (e in session.header) {
    114140            println e
Note: See TracChangeset for help on using the changeset viewer.