Changeset 1603 for trunk/grails-app/services
- Timestamp:
- Mar 8, 2011, 5:10:09 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/dbnp/importer/ImporterService.groovy
r1600 r1603 727 727 * @param datamatrix two dimensional array containing entities with values read from Excel file 728 728 */ 729 static saveDatamatrix(Study study, datamatrix, authenticationService, log) {729 static saveDatamatrix(Study study, importerEntityType, datamatrix, authenticationService, log) { 730 730 def validatedSuccesfully = 0 731 731 def entitystored = null 732 732 733 733 // Study passed? Sync data 734 if (study != null ) study.refresh()734 if (study != null && importerEntityType != 'Study') study.refresh() 735 735 736 736 // go through the data matrix, read every record and validate the entity and try to persist it … … 741 741 entity.owner = authenticationService.getLoggedInUser() 742 742 743 if ( study.validate()) {743 if (entity.validate()) { 744 744 if (!entity.save(flush:true)) { 745 745 log.error ".importer wizard, study could not be saved: " + entity … … 747 747 } 748 748 } else { 749 println "---"750 study.errors.getAllErrors().each {751 println it.dump()752 }753 println "---//"754 749 log.error ".importer wizard, study could not be validated: " + entity 755 750 throw new Exception('.importer wizard, study could not be validated: ' + entity) … … 787 782 788 783 // validate study 789 if (study.validate()) { 790 if (!study.save(flush: true)) { 791 //this.appendErrors(flow.study, flash.wizardErrors) 792 throw new Exception('.importer wizard [saveDatamatrix] error while saving study') 784 if (importerEntityType != 'Study') { 785 if (study.validate()) { 786 if (!study.save(flush: true)) { 787 //this.appendErrors(flow.study, flash.wizardErrors) 788 throw new Exception('.importer wizard [saveDatamatrix] error while saving study') 789 } 790 } else { 791 throw new Exception('.importer wizard [saveDatamatrix] study does not validate') 793 792 } 794 } else {795 throw new Exception('.importer wizard [saveDatamatrix] study does not validate')796 793 } 797 794
Note: See TracChangeset
for help on using the changeset viewer.