- Timestamp:
- Jun 4, 2010, 11:20:48 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/conf/BootStrap.groovy
r524 r525 352 352 353 353 def fastingTreatment = new Template( 354 name: 'Fasting treatment', 355 description: 'Fasting Protocol NuGO PPSH', 356 entity: dbnp.studycapturing.Event) 357 .addToFields(new TemplateField( 358 name: 'Fasting period', 359 type: TemplateFieldType.STRING)) 360 .with { if (!validate()) { errors.each { println it} } else save()} 354 name: 'Fasting treatment', 355 description: 'Fasting Protocol NuGO PPSH', 356 entity: dbnp.studycapturing.Event 357 ) 358 .addToFields( 359 new TemplateField( 360 name: 'Fasting period', 361 type: TemplateFieldType.STRING 362 ) 363 ) 364 .with { if (!validate()) { errors.each { println it} } else save()} 361 365 362 366 // SamplingEvent templates 363 364 def samplingProtocolField = new TemplateField( 365 name: 'Sample Protocol',type: TemplateFieldType.STRING) 366 .with { if (!validate()) { errors.each { println it} } else save()} 367 def samplingProtocolField = new TemplateField( 368 name: 'Sample Protocol', 369 type: TemplateFieldType.STRING 370 ) 371 .with { if (!validate()) { errors.each { println it} } else save()} 367 372 368 373 def liverSamplingEventTemplate = new Template( … … 593 598 .addToPersons( studyperson1 ) 594 599 .addToPersons( studyperson2 ) 595 596 600 .addToPublications( publication1 ) 601 .addToPublications( publication2 ) 597 602 .save() 598 603 … … 633 638 def y = 1 634 639 11.times { 635 def currentSubject = new Subject( 636 name: "" + y++, 637 species: humanTerm, 638 template: humanTemplate) 640 def currentSubject = new Subject( 641 name: "" + y++, 642 species: humanTerm, 643 template: humanTemplate 644 ) 639 645 .setFieldValue("Gender", (Math.random() > 0.5) ? "Male" : "Female") 640 646 .setFieldValue("DOB", new java.text.SimpleDateFormat("dd-mm-yy").parse("01-02-19" + (10 + (int) (Math.random() * 80)))) … … 645 651 .with { if (!validate()) { errors.each { println it} } else save()} 646 652 647 rootGroup.addToSubjects currentSubject 648 rootGroup.save() 649 650 def currentSample = new Sample( 651 name: currentSubject.name + '_B', 652 material: bloodTerm, 653 parentSubject: currentSubject, 654 parentEvent: bloodSamplingEvent); 655 656 humanStudy.addToSubjects(currentSubject).addToSamples(currentSample).with { if (!validate()) { errors.each { println it} } else save()} 653 rootGroup.addToSubjects currentSubject 654 rootGroup.save() 655 656 def currentSample = new Sample( 657 name: currentSubject.name + '_B', 658 material: bloodTerm, 659 parentSubject: currentSubject, 660 parentEvent: bloodSamplingEvent 661 ); 662 663 humanStudy.addToSubjects(currentSubject).addToSamples(currentSample).with { if (!validate()) { errors.each { println it} } else save()} 657 664 } 658 665 … … 742 749 humanStudy.save() 743 750 744 751 mouseStudy.addToAssays(lipidAssayRef); 745 752 mouseStudy.save() 746 753 … … 749 756 750 757 // Ontologies must be connected to the templatefields in runtime 751 752 TemplateEntity.getField( Subject.domainFields, 'species').ontologies = [Ontology.findByNcboId(1132)]753 TemplateEntity.getField( Sample.domainFields, 'material').ontologies = [Ontology.findByNcboId(1005)]758 // because the Ontology.findByNcboId is not available otherwise 759 TemplateEntity.getField(Subject.domainFields, 'species').ontologies = [Ontology.findByNcboId(1132)] 760 TemplateEntity.getField(Sample.domainFields, 'material').ontologies = [Ontology.findByNcboId(1005)] 754 761 755 762 }
Note: See TracChangeset
for help on using the changeset viewer.