Changeset 328 for trunk/grails-app/services/dbnp/importer
- Timestamp:
- Apr 7, 2010, 11:24:56 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/dbnp/importer/ImporterService.groovy
r322 r328 200 200 201 201 /** 202 * @param datamatrix two dimensional array containing entities with values read from Excel file 202 * Method to store a matrix containing the entities in a record like structure. Every row in the table 203 * contains one or more entity objects (which contain fields with values). So actually a row represents 204 * a record with fields from one or more different entities. 205 * 206 * @param study entity Study 207 * @param datamatrix two dimensional array containing entities with values read from Excel file * 203 208 */ 204 def savedata(datamatrix) { 209 def savedata(Study study, datamatrix) { 210 study.refresh() 211 205 212 datamatrix.each { record -> 206 213 record.each { entity -> … … 210 217 break 211 218 case Subject : print "Persisting Subject `" + entity.name + "`: " 212 persistEntity(entity) 219 persistEntity(entity) 220 study.addToSubjects(entity) 213 221 break 214 222 case Event : print "Persisting Event `" + entity.eventdescription + "`: " … … 225 233 } 226 234 } 227 } 235 } 228 236 } 229 237 … … 234 242 * 235 243 */ 236 def persistEntity(entity) { 237 println entity.dump() 238 if (entity.save(flush:true)) { //.merge? 239 println "OK" 244 def persistEntity(entity) { 245 if (entity.save(flush:true)) { //.merge? 240 246 } else entity.errors.allErrors.each { 241 247 println it
Note: See TracChangeset
for help on using the changeset viewer.