Changeset 415 for trunk/grails-app/controllers
- Timestamp:
- May 12, 2010, 1:23:35 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r359 r415 73 73 */ 74 74 def savepreview = { 75 def tft = null 76 def entities = request.getParameterValues("entity") 77 def templatefieldtypes = request.getParameterValues("templatefieldtype") 75 def tft = null 78 76 def identifiercolumnindex = (params.identifier!=null) ? params.identifier.toInteger() : -1 79 77 80 templatefieldtypes.each { t -> 81 def columnindex = t.split(":")[0].toInteger() 82 def templatefieldtype = t.split(":")[1] 83 84 switch (templatefieldtype) { 78 params.templatefieldtype.index.each { columnindex, _templatefieldtype -> 79 switch (_templatefieldtype) { 85 80 case "STRING" : tft = TemplateFieldType.STRING 86 81 break … … 101 96 default: break 102 97 } 103 session.importer_header[columnindex].templatefieldtype = tft 98 99 session.importer_header[columnindex.toInteger()].templatefieldtype = tft 104 100 } 105 101 106 entities.each { e -> 107 def columnindex = e.split(":")[0].toInteger() 108 def entitytype = e.split(":")[1].toInteger() 109 Class clazz 102 params.entity.index.each { columnindex, entitytype -> 103 Class clazz 110 104 111 switch (entitytype ) {105 switch (entitytype.toInteger()) { 112 106 case 0: clazz = Study 113 107 break … … 124 118 } 125 119 126 session.importer_header[columnindex ].identifier = (columnindex== identifiercolumnindex) ? true : false127 session.importer_header[columnindex ].index = columnindex128 session.importer_header[columnindex ].entity = clazz120 session.importer_header[columnindex.toInteger()].identifier = (columnindex.toInteger() == identifiercolumnindex) ? true : false 121 session.importer_header[columnindex.toInteger()].index = columnindex.toInteger() 122 session.importer_header[columnindex.toInteger()].entity = clazz 129 123 } 130 124 … … 134 128 def templates = Template.get(session.importer_template_id) 135 129 136 render(view:"step2", model:[entities: entities, header:session.importer_header, templates:templates])130 render(view:"step2", model:[entities:params.entity, header:session.importer_header, templates:templates]) 137 131 } 138 132 139 133 /** 140 * @param columnproperty array of columns and the assigned property in `column:property_id` format134 * @param columnproperty array of columns containing index and property_id 141 135 * 142 136 */ 143 def saveproperties = { 144 def columnproperties = request.getParameterValues("columnproperty") 137 def saveproperties = { 145 138 session.importer_study = Study.get(params.study.id.toInteger()) 146 139 147 columnproperties.each { cp -> 148 def columnindex = cp.split(":")[0].toInteger() 149 def property_id = cp.split(":")[1].toInteger() 150 session.importer_header[columnindex].property = TemplateField.get(property_id) 140 params.columnproperty.index.each { columnindex, property_id -> 141 session.importer_header[columnindex.toInteger()].property = TemplateField.get(property_id.toInteger()) 151 142 } 152 143 … … 158 149 159 150 def savepostview = { 160 ImporterService.save data(session.importer_study, session.importer_importeddata)151 ImporterService.saveDatamatrix(session.importer_study, session.importer_importeddata) 161 152 render(view:"step4") 162 153 }
Note: See TracChangeset
for help on using the changeset viewer.