Changeset 251

Show
Ignore:
Timestamp:
09-03-10 15:53:46 (4 years ago)
Author:
tabma
Message:

- TemplateStudyField? and MappingColumn? changed fieldnames
- session header is now a map with MappingColumn? objects containing all selected settings

Location:
trunk
Files:
1 added
3 modified
1 copied

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 
  • trunk/grails-app/domain/dbnp/importer/MappingColumn.groovy

    r247 r251  
    1313 
    1414        String name 
    15         dbnp.studycapturing.TemplateFieldType type 
     15        dbnp.studycapturing.TemplateFieldType templatefieldtype 
    1616        Class entity 
    1717        String property 
     
    2525 
    2626    String toString() { 
    27         return name + "/" + type + "/" + entity + "/" + property + "/" + celltype + "/" + index + "/" + value 
     27        return "Name:" + name + "/Type:" + templatefieldtype + "/Entity:" + entity + "/Property:" + property + "/Celltype:" + celltype + "/Index:" + index + "/Value:" + value 
    2828    } 
    2929} 
  • trunk/grails-app/domain/dbnp/studycapturing/TemplateStudyField.groovy

    • Property svn:keywords changed from Rev Date Author to Date Author Rev
  • trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy

    r247 r251  
    2222                        [type:3, name:"Protocol"], [type:4, name:"Sample"]] 
    2323 
    24     def standardcelltypes = [[type:0, name:"Numeric"], [type:1, name:"String"], [type:2, name:"Formula"], 
    25                          [type:3, name:"Blank"], [type:4, name:"Boolean"], [type:5, name:"Error"]] 
     24    def standardcelltypes = [ 
     25                         [type:0, name:"Numeric"], [type:1, name:"String"], [type:2, name:"Formula"], 
     26                         [type:3, name:"Blank"], [type:4, name:"Boolean"], [type:5, name:"Error"], [type:6, name:"Date"], 
     27                         [type:7, name:"Float"], [type:8, name:"Double"], [type:9, name:"List of items"], [type:10, name:"Ontologyterm"] 
     28                     ] 
    2629 
    2730    /**