Changeset 1215
- Timestamp:
- Nov 30, 2010, 9:28:59 AM (13 years ago)
- Location:
- trunk/grails-app
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/importer/ImporterController.groovy
r1207 r1215 165 165 */ 166 166 167 def saveMissingProperties = { 167 def saveMissingProperties = { 168 def fielderrors = 0 169 def invalidentities = 0 168 170 169 171 session.importer_importeddata.each { table -> 170 172 table.each { entity -> 171 entity.giveFields().each { field -> 172 entity.setFieldValue (field.toString(), params["entity_" + entity.getIdentifier() + "_" + field.escapedName()]) 173 } 174 } 175 } 173 // a new entity is being traversed, if a field cannot be set, increase this counter 174 fielderrors = 0 175 176 entity.giveFields().each { field -> 177 try { 178 // try to set the value 179 entity.setFieldValue (field.toString(), params["entity_" + entity.getIdentifier() + "_" + field.escapedName()]) 180 } catch (Exception e) { 181 fielderrors++ 182 } 183 } 184 185 // a field could not be set in the entity, so the entity failed (is not validated) 186 if (fielderrors) invalidentities++ 187 188 // all fields in the entity could be set, no errors, so remove it from the failed cells 189 if (!fielderrors) { 190 session.importer_failedcells.each { record -> 191 record.importcells.each { cell -> 192 // remove the cell from the failed cells session 193 if (cell.entityidentifier == entity.getIdentifier()) { 194 record.removeFromImportcells(cell) 195 } 196 } 197 } 198 } // end of fielderrors 199 } // end of record 200 } // end of table 176 201 177 202 // a new ontology term was added, so stay at the current step otherwise go to the next step 178 203 if (params.updatefield) render(view:"step3_simple", model:[datamatrix:session.importer_importeddata, failedcells:session.importer_failedcells]) 179 else render(view:"step3", model:[datamatrix:session.importer_importeddata]) 204 else 205 if (invalidentities) 206 render(view:"step3_simple", model:[datamatrix:session.importer_importeddata, failedcells:session.importer_failedcells]) 207 else 208 render(view:"step3", model:[datamatrix:session.importer_importeddata]) 180 209 } 181 210 -
trunk/grails-app/views/importer/common/_missingproperties.gsp
r1205 r1215 57 57 58 58 element.addClass('error') 59 element.append( new Option("Invalid: ${cell.value}"," ", true, true) );59 element.append( new Option("Invalid: ${cell.value}","#invalidterm", true, true) ); 60 60 61 61 </g:each>
Note: See TracChangeset
for help on using the changeset viewer.