Changeset 661

Show
Ignore:
Timestamp:
19-07-10 16:10:09 (4 years ago)
Author:
tabma
Message:

- fixed property assignment by using lookup from new entity object method getFieldType

Location:
trunk/grails-app
Files:
2 modified

Legend:

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

    r660 r661  
    212212 
    213213        // Find actual Template object from the chosen template name 
    214         def template = Template.get(session.imported_template_id) 
     214        def template = Template.get(session.importer_template_id) 
    215215 
    216216        params.columnproperty.index.each { columnindex, property -> 
     
    224224                session.importer_header[columnindex.toInteger()].property = property 
    225225                // Look up the template field type of the target TemplateField and store it also in the map 
    226                 session.importer_header[columnindex.toInteger()].templatefieldtype = entityObj.giveFields()[property].type 
     226                session.importer_header[columnindex.toInteger()].templatefieldtype = entityObj.getFieldType(property) 
    227227 
    228228                //if it's an identifier set the mapping column true or false 
  • trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy

    r572 r661  
    658658                } 
    659659        } 
     660 
     661                    /** 
     662         * Look up the type of a certain template subject field 
     663         * @param String fieldName The name of the template field 
     664         * @return String       The type (static member of TemplateFieldType) of the field, or null of the field does not exist 
     665         */ 
     666        def TemplateFieldType getFieldType(String fieldName) { 
     667                def field = this.giveFields().find { 
     668                        it.name == fieldName 
     669                } 
     670                field?.type 
     671        } 
    660672}