Changeset 854 for trunk/grails-app/conf
- Timestamp:
- Aug 27, 2010, 5:02:09 PM (13 years ago)
- Location:
- trunk/grails-app/conf
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrapStudies.groovy
r850 r854 170 170 startDate: Date.parse('yyyy-MM-dd','2008-01-02'), 171 171 owner: owner 172 ).with { if (!validate()) { errors.each { println it} } else save( flush:true)}172 ).with { if (!validate()) { errors.each { println it} } else save()} 173 173 174 174 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() 176 176 177 177 def evLF = new Event( … … 255 255 .addToSamplingEvents(evS) 256 256 .addToSamplingEvents(evS4) 257 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}257 .with { if (!validate()) { errors.each { println it} } else save()} 258 258 259 259 // 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()} 262 262 263 263 def LFBV1 = new EventGroup(name:"10% fat + vehicle for 1 week") … … 317 317 // (this is possibly a Grails or Hibernate bug) 318 318 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()} 320 320 321 321 // 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() } 330 330 331 331 // Create sample … … 338 338 ); 339 339 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()} 341 341 currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) ) 342 342 } … … 352 352 .addToEventGroups(HFBV4) 353 353 .addToEventGroups(HFBL4) 354 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}354 .with { if (!validate()) { errors.each { println it} } else save()} 355 355 356 356 // Add persons and publications to study … … 363 363 .addToPublications( publication1 ) 364 364 .addToPublications( publication2 ) 365 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}365 .with { if (!validate()) { errors.each { println it} } else save()} 366 366 367 367 // Add example human study … … 379 379 ) 380 380 .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()} 382 382 383 383 def rootGroup = new EventGroup(name: 'Root group'); … … 404 404 rootGroup.addToSamplingEvents bloodSamplingEventBefore 405 405 rootGroup.addToSamplingEvents bloodSamplingEventAfter 406 rootGroup.save( flush:true)406 rootGroup.save() 407 407 408 408 def y = 1 … … 421 421 422 422 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()} 424 424 425 425 rootGroup.addToSubjects currentSubject 426 rootGroup.save( flush:true)426 rootGroup.save() 427 427 428 428 def currentSample = new Sample( … … 435 435 436 436 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()} 438 438 currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) ) 439 439 … … 447 447 448 448 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()} 450 450 currentSample.setFieldValue( "Text on vial", "T" + (Math.random() * 100L) ) 451 451 } … … 462 462 .addToPersons( studyperson3 ) 463 463 .addToPublications( publication2 ) 464 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}464 .with { if (!validate()) { errors.each { println it} } else save()} 465 465 466 466 println ".adding assay references to mouse example study..." … … 471 471 platform: 'clinical measurements', 472 472 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()} 474 474 475 475 // Add metabolomics assay reference … … 478 478 platform: 'GCMS/LCMS', 479 479 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()} 481 481 482 482 def lipidAssayRef = new Assay( … … 502 502 mouseStudy.addToAssays(lipidAssayRef); 503 503 mouseStudy.addToAssays(metAssayRef); 504 mouseStudy.save( flush:true)504 mouseStudy.save() 505 505 506 506 println ".adding assay references to human example study..." … … 552 552 humanStudy.addToAssays(metAssayRefA) 553 553 humanStudy.addToAssays(metAssayRefB) 554 humanStudy.save( flush:true)554 humanStudy.save() 555 555 556 556 } -
trunk/grails-app/conf/BootStrapTemplates.groovy
r853 r854 30 30 ncboId: '1132', 31 31 ncboVersionedId: '38802' 32 ).with { if (!validate()) { errors.each { println it} } else save( flush:true)}32 ).with { if (!validate()) { errors.each { println it} } else save()} 33 33 34 34 // add Sample>material ontology … … 41 41 ncboId: '1005', 42 42 ncboVersionedId: '40643' 43 ).with { if (!validate()) { errors.each { println it} } else save( flush:true)}43 ).with { if (!validate()) { errors.each { println it} } else save()} 44 44 45 45 // add NCI ontology which is used in Mouse genotype template field … … 51 51 ncboId: '1032', 52 52 ncboVersionedId: '42693' 53 ).with { if (!validate()) { errors.each { println it} } else save( flush:true)}53 ).with { if (!validate()) { errors.each { println it} } else save()} 54 54 55 55 // add CHEBI ontology which is used in Mouse genotype template field … … 61 61 ncboId: '1007', 62 62 ncboVersionedId: '42878' 63 ).with { if (!validate()) { errors.each { println it} } else save( flush:true)}63 ).with { if (!validate()) { errors.each { println it} } else save()} 64 64 65 65 } … … 76 76 name: 'Gender',type: TemplateFieldType.STRINGLIST, entity: Subject, 77 77 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()} 79 79 80 80 def ageField = new TemplateField( 81 81 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()} 83 83 84 84 def genotypeField = new TemplateField( 85 85 name: 'Genotype', type: TemplateFieldType.STRING,entity: Subject, 86 86 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()} 88 88 89 89 def genotypeTypeField = new TemplateField( … … 94 94 new TemplateFieldListItem(name:'knock-in')], 95 95 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()} 97 97 98 98 def varietyField = new TemplateField( 99 99 name: 'Variety', type: TemplateFieldType.STRING,entity: Subject, 100 100 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()} 102 102 103 103 def ecotypeField = new TemplateField( … … 105 105 comment: 'a type or subspecies of life that is especially well adapted to a certain environment' 106 106 ) 107 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}107 .with { if (!validate()) { errors.each { println it} } else save()} 108 108 109 109 … … 121 121 .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?)')) 122 122 .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()} 124 124 125 125 // Mouse template … … 145 145 .addToFields(new TemplateField( 146 146 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()} 148 148 149 149 // Human template … … 175 175 .addToFields(new TemplateField( 176 176 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()} 178 178 179 179 println ".adding sample remarks field" … … 183 183 entity: Sample 184 184 ) 185 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}185 .with { if (!validate()) { errors.each { println it} } else save()} 186 186 187 187 println ".adding sample vial textfield" … … 191 191 entity: Sample 192 192 ) 193 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}193 .with { if (!validate()) { errors.each { println it} } else save()} 194 194 195 195 // Human tissue sample template … … 209 209 ) 210 210 ) 211 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}211 .with { if (!validate()) { errors.each { println it} } else save()} 212 212 213 213 // Human blood sample template … … 227 227 ) 228 228 ) 229 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}229 .with { if (!validate()) { errors.each { println it} } else save()} 230 230 231 231 /* … … 242 242 .addToFields(new TemplateField(name: 'Light Intensity',type: TemplateFieldType.STRING)) 243 243 .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()} 245 245 */ 246 246 … … 316 316 .addToFields(new TemplateField( 317 317 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()} 319 319 320 320 println ".adding open-field plant template..." … … 337 337 .addToFields(new TemplateField( 338 338 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()} 340 340 341 341 //Plant template … … 392 392 .addToFields(new TemplateField( 393 393 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()} 395 395 396 396 println ".adding plant sample template..." … … 401 401 .addToFields(sampleRemarksField) 402 402 .addToFields(sampleVialTextField) 403 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}403 .with { if (!validate()) { errors.each { println it} } else save()} 404 404 405 405 println ".adding material prep template" … … 441 441 ) 442 442 ) 443 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}443 .with { if (!validate()) { errors.each { println it} } else save()} 444 444 445 445 def protocolField = new TemplateField( … … 449 449 comment: 'You can upload a protocol here which describes the procedure which was used when carrying out the event' 450 450 ) 451 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}451 .with { if (!validate()) { errors.each { println it} } else save()} 452 452 453 453 // diet treatment template … … 469 469 ) 470 470 .addToFields(protocolField) 471 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}471 .with { if (!validate()) { errors.each { println it} } else save()} 472 472 473 473 // boost treatment template … … 493 493 ) 494 494 .addToFields(protocolField) 495 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}495 .with { if (!validate()) { errors.each { println it} } else save()} 496 496 497 497 // fasting treatment template … … 509 509 ) 510 510 ) 511 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}511 .with { if (!validate()) { errors.each { println it} } else save()} 512 512 513 513 // SamplingEvent templates … … 519 519 comment: 'You can upload a protocol here which describes the procedure which was used when carrying out the sampling event' 520 520 ) 521 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}521 .with { if (!validate()) { errors.each { println it} } else save()} 522 522 523 523 // liver sampling event template … … 537 537 ) 538 538 ) 539 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}539 .with { if (!validate()) { errors.each { println it} } else save()} 540 540 541 541 // blood sampling … … 555 555 ) 556 556 ) 557 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}557 .with { if (!validate()) { errors.each { println it} } else save()} 558 558 559 559 // plant sample extraction event template … … 586 586 ) 587 587 ) 588 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}588 .with { if (!validate()) { errors.each { println it} } else save()} 589 589 590 590 // plant sampling event template … … 627 627 ) 628 628 ) 629 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}629 .with { if (!validate()) { errors.each { println it} } else save()} 630 630 631 631 … … 638 638 type: TemplateFieldType.STRING 639 639 ); 640 assayDescriptionField.with { if (!validate()) { errors.each { println it} } else save( flush:true)}640 assayDescriptionField.with { if (!validate()) { errors.each { println it} } else save()} 641 641 642 642 println ".adding clinical chemistry assay template" … … 647 647 ) 648 648 .addToFields(assayDescriptionField) 649 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}649 .with { if (!validate()) { errors.each { println it} } else save()} 650 650 651 651 println ".adding metabolomics assay template" … … 669 669 ]) 670 670 ) 671 .with { if (!validate()) { errors.each { println it} } else save( flush:true)}671 .with { if (!validate()) { errors.each { println it} } else save()} 672 672 } 673 673
Note: See TracChangeset
for help on using the changeset viewer.