Changeset 854 for trunk/grails-app/conf


Ignore:
Timestamp:
Aug 27, 2010, 5:02:09 PM (13 years ago)
Author:
keesvb
Message:

deleted flush:true from saves in bootstrap (slows down enormously)

Location:
trunk/grails-app/conf
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/conf/BootStrapStudies.groovy

    r850 r854  
    170170                        startDate: Date.parse('yyyy-MM-dd','2008-01-02'),
    171171                        owner: owner
    172                 ).with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     172                ).with { if (!validate()) { errors.each { println it} } else save()}
    173173
    174174                mouseStudy.setFieldValue('Description', "C57Bl/6 mice were fed a high fat (45 en%) or low fat (10 en%) diet after a four week run-in on low fat diet.");// After 1 week 10 mice that received a low fat diet were given an IP leptin challenge and 10 mice of the low-fat group received placebo injections. The same procedure was performed with mice that were fed the high-fat diet. After 4 weeks the procedure was repeated. In total 80 mice were culled." )
    175                 mouseStudy.save(flush:true)
     175                mouseStudy.save()
    176176
    177177                def evLF = new Event(
     
    255255                .addToSamplingEvents(evS)
    256256                .addToSamplingEvents(evS4)
    257                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     257                .with { if (!validate()) { errors.each { println it} } else save()}
    258258
    259259                // Extra check if the SamplingEvents are saved correctly
    260                 evS.with { if (!validate()) { errors.each { println it} } else save(flush:true)}
    261                 evS4.with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     260                evS.with { if (!validate()) { errors.each { println it} } else save()}
     261                evS4.with { if (!validate()) { errors.each { println it} } else save()}
    262262
    263263                def LFBV1 = new EventGroup(name:"10% fat + vehicle for 1 week")
     
    317317                        // (this is possibly a Grails or Hibernate bug)
    318318                        mouseStudy.addToSubjects(currentSubject)
    319                         currentSubject.with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     319                        currentSubject.with { if (!validate()) { errors.each { println it} } else save()}
    320320
    321321                        // Add subject to appropriate EventGroup
    322                         if (x > 70) { HFBL4.addToSubjects(currentSubject).save(flush:true) }
    323                         else if (x > 60) { HFBV4.addToSubjects(currentSubject).save(flush:true) }
    324                         else if (x > 50) { LFBL4.addToSubjects(currentSubject).save(flush:true) }
    325                         else if (x > 40) { LFBV4.addToSubjects(currentSubject).save(flush:true) }
    326                         else if (x > 30) { HFBL1.addToSubjects(currentSubject).save(flush:true) }
    327                         else if (x > 20) { HFBV1.addToSubjects(currentSubject).save(flush:true) }
    328                         else if (x > 10) { LFBL1.addToSubjects(currentSubject).save(flush:true) }
    329                         else             { LFBV1.addToSubjects(currentSubject).save(flush:true) }
     322                        if (x > 70) { HFBL4.addToSubjects(currentSubject).save() }
     323                        else if (x > 60) { HFBV4.addToSubjects(currentSubject).save() }
     324                        else if (x > 50) { LFBL4.addToSubjects(currentSubject).save() }
     325                        else if (x > 40) { LFBV4.addToSubjects(currentSubject).save() }
     326                        else if (x > 30) { HFBL1.addToSubjects(currentSubject).save() }
     327                        else if (x > 20) { HFBV1.addToSubjects(currentSubject).save() }
     328                        else if (x > 10) { LFBL1.addToSubjects(currentSubject).save() }
     329                        else             { LFBV1.addToSubjects(currentSubject).save() }
    330330
    331331                        // Create sample
     
    338338                        );
    339339                        mouseStudy.addToSamples(currentSample)
    340                         currentSample.with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     340                        currentSample.with { if (!validate()) { errors.each { println it} } else save()}
    341341                        currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) )
    342342                }
     
    352352                .addToEventGroups(HFBV4)
    353353                .addToEventGroups(HFBL4)
    354                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     354                .with { if (!validate()) { errors.each { println it} } else save()}
    355355
    356356                // Add persons and publications to study
     
    363363        .addToPublications( publication1 )
    364364        .addToPublications( publication2 )
    365                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     365                .with { if (!validate()) { errors.each { println it} } else save()}
    366366
    367367                // Add example human study
     
    379379                )
    380380                .setFieldValue( 'Description', "Human study performed at RRI; centres involved: RRI, IFR, TUM, Maastricht U." )
    381                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     381                .with { if (!validate()) { errors.each { println it} } else save()}
    382382
    383383                def rootGroup = new EventGroup(name: 'Root group');
     
    404404                rootGroup.addToSamplingEvents bloodSamplingEventBefore
    405405                rootGroup.addToSamplingEvents bloodSamplingEventAfter
    406                 rootGroup.save(flush:true)
     406                rootGroup.save()
    407407
    408408                def y = 1
     
    421421
    422422                        humanStudy.addToSubjects(currentSubject)
    423                         currentSubject.with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     423                        currentSubject.with { if (!validate()) { errors.each { println it} } else save()}
    424424
    425425                        rootGroup.addToSubjects currentSubject
    426                         rootGroup.save(flush:true)
     426                        rootGroup.save()
    427427
    428428                        def currentSample = new Sample(
     
    435435
    436436                        humanStudy.addToSamples(currentSample)
    437                         currentSample.with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     437                        currentSample.with { if (!validate()) { errors.each { println it} } else save()}
    438438                        currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) )
    439439
     
    447447
    448448                        humanStudy.addToSamples(currentSample)
    449                         currentSample.with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     449                        currentSample.with { if (!validate()) { errors.each { println it} } else save()}
    450450                        currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) )
    451451                }
     
    462462                .addToPersons( studyperson3 )
    463463                .addToPublications( publication2 )
    464                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     464                .with { if (!validate()) { errors.each { println it} } else save()}
    465465
    466466                println ".adding assay references to mouse example study..."
     
    471471                        platform: 'clinical measurements',
    472472                        url: 'http://sam.nmcdsp.org'
    473                 ).with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     473                ).with { if (!validate()) { errors.each { println it} } else save()}
    474474
    475475                // Add metabolomics assay reference
     
    478478                        platform: 'GCMS/LCMS',
    479479                        url: 'http://nmcdsp.nmcdsp.org'
    480                 ).with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     480                ).with { if (!validate()) { errors.each { println it} } else save()}
    481481
    482482                def lipidAssayRef = new Assay(
     
    502502                mouseStudy.addToAssays(lipidAssayRef);
    503503                mouseStudy.addToAssays(metAssayRef);
    504                 mouseStudy.save(flush:true)
     504                mouseStudy.save()
    505505
    506506                println ".adding assay references to human example study..."
     
    552552                humanStudy.addToAssays(metAssayRefA)
    553553                humanStudy.addToAssays(metAssayRefB)
    554                 humanStudy.save(flush:true)
     554                humanStudy.save()
    555555
    556556        }
  • trunk/grails-app/conf/BootStrapTemplates.groovy

    r853 r854  
    3030                        ncboId: '1132',
    3131                        ncboVersionedId: '38802'
    32                 ).with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     32                ).with { if (!validate()) { errors.each { println it} } else save()}
    3333
    3434                // add Sample>material ontology
     
    4141                        ncboId: '1005',
    4242                        ncboVersionedId: '40643'
    43                 ).with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     43                ).with { if (!validate()) { errors.each { println it} } else save()}
    4444
    4545                // add NCI ontology which is used in Mouse genotype template field
     
    5151                        ncboId: '1032',
    5252                        ncboVersionedId: '42693'
    53                 ).with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     53                ).with { if (!validate()) { errors.each { println it} } else save()}
    5454
    5555                // add CHEBI ontology which is used in Mouse genotype template field
     
    6161                        ncboId: '1007',
    6262                        ncboVersionedId: '42878'
    63                 ).with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     63                ).with { if (!validate()) { errors.each { println it} } else save()}
    6464               
    6565        }
     
    7676                        name: 'Gender',type: TemplateFieldType.STRINGLIST, entity: Subject,
    7777                        listEntries: [new TemplateFieldListItem(name:'Male'),new TemplateFieldListItem(name: 'Female'),new TemplateFieldListItem(name: 'Unknown')])
    78                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     78                .with { if (!validate()) { errors.each { println it} } else save()}
    7979
    8080                def ageField = new TemplateField(
    8181                        name: 'Age',type: TemplateFieldType.INTEGER,entity: Subject,unit: 'years',comment: 'Either include age at the start of the study or date of birth (if known)')
    82                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     82                .with { if (!validate()) { errors.each { println it} } else save()}
    8383
    8484                def genotypeField = new TemplateField(
    8585                        name: 'Genotype', type: TemplateFieldType.STRING,entity: Subject,
    8686                        comment: 'If present, indicate the genetic variance of the subject (e.g., mutagenized populations,knock-out/in,transgene etc)')
    87                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     87                .with { if (!validate()) { errors.each { println it} } else save()}
    8888
    8989                 def genotypeTypeField = new TemplateField(
     
    9494                                new TemplateFieldListItem(name:'knock-in')],
    9595                        comment: 'If a genotype was specified, please indicate here the type of the genotype')
    96                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     96                .with { if (!validate()) { errors.each { println it} } else save()}
    9797
    9898                def varietyField = new TemplateField(
    9999                        name: 'Variety', type: TemplateFieldType.STRING,entity: Subject,
    100100                        comment: 'taxonomic category consisting of members of a species that differ from others of the same species in minor but heritable characteristics')
    101                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     101                .with { if (!validate()) { errors.each { println it} } else save()}
    102102
    103103                def ecotypeField = new TemplateField(
     
    105105                         comment: 'a type or subspecies of life that is especially well adapted to a certain environment'
    106106                )
    107                  .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     107                 .with { if (!validate()) { errors.each { println it} } else save()}
    108108
    109109
     
    121121                .addToFields(new TemplateField(name: 'Institute',type: TemplateFieldType.STRING,entity: Study,comment:'In which institute was the study performed; indicate the full address information (to be replaced by persons-affiliations?)'))
    122122                .addToFields(new TemplateField(name: 'Study protocol',type: TemplateFieldType.FILE,entity: Study,comment:'Optionally attach a file in which the protocol in the study is described'))
    123                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     123                .with { if (!validate()) { errors.each { println it} } else save()}
    124124
    125125                // Mouse template
     
    145145                .addToFields(new TemplateField(
    146146                        name: 'Weight', type: TemplateFieldType.DOUBLE, unit: 'gram',entity: Subject,comment:'If known indicate the weight of the subject in grams at the start of the study'))
    147                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     147                .with { if (!validate()) { errors.each { println it} } else save()}
    148148
    149149                // Human template
     
    175175                .addToFields(new TemplateField(
    176176                        name: 'Run-in-food',type: TemplateFieldType.TEXT,entity: Subject, comment:'If defined, give a short description of the food used before the measurements'))
    177                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     177                .with { if (!validate()) { errors.each { println it} } else save()}
    178178
    179179                println ".adding sample remarks field"
     
    183183                    entity: Sample
    184184                )
    185                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     185                .with { if (!validate()) { errors.each { println it} } else save()}
    186186
    187187                println ".adding sample vial textfield"
     
    191191                    entity: Sample
    192192                )
    193                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     193                .with { if (!validate()) { errors.each { println it} } else save()}
    194194
    195195                // Human tissue sample template
     
    209209                        )
    210210                )
    211                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     211                .with { if (!validate()) { errors.each { println it} } else save()}
    212212
    213213                // Human blood sample template
     
    227227                        )
    228228                )
    229                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     229                .with { if (!validate()) { errors.each { println it} } else save()}
    230230
    231231                /*
     
    242242                .addToFields(new TemplateField(name: 'Light Intensity',type: TemplateFieldType.STRING))
    243243                .addToFields(new TemplateField(name: 'Harvest Delay',type: TemplateFieldType.STRING))
    244                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     244                .with { if (!validate()) { errors.each { println it} } else save()}
    245245                 */
    246246
     
    316316                .addToFields(new TemplateField(
    317317                        name: 'Additional info', entity: Subject, type: TemplateFieldType.TEXT))
    318                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     318                .with { if (!validate()) { errors.each { println it} } else save()}
    319319
    320320                println ".adding open-field plant template..."
     
    337337                .addToFields(new TemplateField(
    338338                        name: 'Harvest delay', entity: Subject, type: TemplateFieldType.TEXT))
    339                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     339                .with { if (!validate()) { errors.each { println it} } else save()}
    340340
    341341                //Plant template
     
    392392                .addToFields(new TemplateField(
    393393                        name: 'Harvest delay', type: TemplateFieldType.TEXT, entity: Subject))
    394                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     394                .with { if (!validate()) { errors.each { println it} } else save()}
    395395
    396396                println ".adding plant sample template..."
     
    401401                .addToFields(sampleRemarksField)
    402402                .addToFields(sampleVialTextField)
    403                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     403                .with { if (!validate()) { errors.each { println it} } else save()}
    404404
    405405                println ".adding material prep template"
     
    441441                        )
    442442                )
    443                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     443                .with { if (!validate()) { errors.each { println it} } else save()}
    444444
    445445                def protocolField = new TemplateField(
     
    449449                        comment: 'You can upload a protocol here which describes the procedure which was used when carrying out the event'
    450450                )
    451                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     451                .with { if (!validate()) { errors.each { println it} } else save()}
    452452
    453453                // diet treatment template
     
    469469                )
    470470                .addToFields(protocolField)
    471                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     471                .with { if (!validate()) { errors.each { println it} } else save()}
    472472
    473473                // boost treatment template
     
    493493                )
    494494                .addToFields(protocolField)
    495                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     495                .with { if (!validate()) { errors.each { println it} } else save()}
    496496
    497497                // fasting treatment template
     
    509509                        )
    510510                )
    511                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     511                .with { if (!validate()) { errors.each { println it} } else save()}
    512512
    513513                // SamplingEvent templates
     
    519519                        comment: 'You can upload a protocol here which describes the procedure which was used when carrying out the sampling event'
    520520                )
    521                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     521                .with { if (!validate()) { errors.each { println it} } else save()}
    522522
    523523                // liver sampling event template
     
    537537                        )
    538538                )
    539                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     539                .with { if (!validate()) { errors.each { println it} } else save()}
    540540
    541541                // blood sampling
     
    555555                        )
    556556                )
    557                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     557                .with { if (!validate()) { errors.each { println it} } else save()}
    558558
    559559                // plant sample extraction event template
     
    586586                        )
    587587                )
    588                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     588                .with { if (!validate()) { errors.each { println it} } else save()}
    589589
    590590                // plant sampling event template
     
    627627                        )
    628628                )
    629                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     629                .with { if (!validate()) { errors.each { println it} } else save()}
    630630
    631631
     
    638638                                type: TemplateFieldType.STRING
    639639                );
    640                 assayDescriptionField.with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     640                assayDescriptionField.with { if (!validate()) { errors.each { println it} } else save()}
    641641
    642642                println ".adding clinical chemistry assay template"
     
    647647                )
    648648                .addToFields(assayDescriptionField)
    649                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     649                .with { if (!validate()) { errors.each { println it} } else save()}
    650650
    651651                println ".adding metabolomics assay template"
     
    669669                            ])
    670670                )
    671                 .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
     671                .with { if (!validate()) { errors.each { println it} } else save()}
    672672        }
    673673
Note: See TracChangeset for help on using the changeset viewer.