Changeset 561
- Timestamp:
- Jun 14, 2010, 1:00:46 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/application.properties
r542 r561 9 9 app.name=gscf 10 10 app.servlet.version=2.4 11 app.version=0. 2.511 app.version=0.3.0 12 12 plugins.crypto=2.0 13 13 plugins.db-util=0.4 -
trunk/grails-app/conf/BootStrap.groovy
r554 r561 56 56 ncboVersionedId: '42693' 57 57 ).with { if (!validate()) { errors.each { println it} } else save()} 58 58 59 // add CHEBI ontology which is used in Mouse genotype template field 60 def chebiOntology = new Ontology( 61 name: 'Chemical entities of biological interest', 62 description: 'A structured classification of chemical compounds of biological relevance.', 63 url: 'http://www.ebi.ac.uk/chebi', 64 versionNumber: '1.68', 65 ncboId: '1007', 66 ncboVersionedId: '42878' 67 ).with { if (!validate()) { errors.each { println it} } else save()} 68 59 69 // add Terms 60 70 println ".adding mouse term" … … 100 110 ontology: nciOntology, 101 111 accession: 'C14424' 112 ).with { if (!validate()) { errors.each { println it} } else save()} 113 114 def glucoseTerm = new Term( 115 name: 'Glucose', 116 ontology: chebiOntology, 117 accession: 'CHEBI:17234' 102 118 ).with { if (!validate()) { errors.each { println it} } else save()} 103 119 … … 552 568 .with { if (!validate()) { errors.each { println it} } else save()} 553 569 570 def protocolField = new TemplateField( 571 name: 'Protocol', 572 type: TemplateFieldType.FILE, 573 entity: Event, 574 comment: 'You can upload a protocol here which describes the procedure which was used when carrying out the event' 575 ) 576 .with { if (!validate()) { errors.each { println it} } else save()} 577 554 578 // diet treatment template 555 579 println ".adding diet treatement template" … … 564 588 entity: Event, 565 589 listEntries: [ 566 new TemplateFieldListItem(name:' 10% fat (palm oil)'),567 new TemplateFieldListItem(name: ' 45% fat (palm oil)')590 new TemplateFieldListItem(name:'low fat'), 591 new TemplateFieldListItem(name: 'high fat') 568 592 ] 569 593 ) 570 594 ) 595 .addToFields(protocolField) 571 596 .with { if (!validate()) { errors.each { println it} } else save()} 572 597 … … 574 599 println ".adding boost treatment template" 575 600 def boostTreatmentTemplate = new Template( 576 name: ' Leptin treatment',601 name: 'Compound challenge', 577 602 entity: dbnp.studycapturing.Event 578 603 ) … … 580 605 new TemplateField( 581 606 name: 'Compound', 582 type: TemplateFieldType. STRINGLIST,607 type: TemplateFieldType.ONTOLOGYTERM, 583 608 entity: Event, 584 listEntries: [ 585 new TemplateFieldListItem(name:'Vehicle'), 586 new TemplateFieldListItem(name: 'Leptin') 587 ] 588 ) 589 ) 609 ontologies: [chebiOntology] 610 ) 611 ) 612 .addToFields( 613 new TemplateField( 614 name: 'Control', 615 type: TemplateFieldType.BOOLEAN, 616 entity: Event 617 ) 618 ) 619 .addToFields(protocolField) 590 620 .with { if (!validate()) { errors.each { println it} } else save()} 591 621 … … 594 624 def fastingTreatment = new Template( 595 625 name: 'Fasting treatment', 596 description: 'Fasting Protocol NuGO PPSH',626 description: 'Fasting for a specific amount of time', 597 627 entity: dbnp.studycapturing.Event 598 628 ) … … 600 630 new TemplateField( 601 631 name: 'Fasting period', 602 type: TemplateFieldType. STRING,632 type: TemplateFieldType.RELTIME, 603 633 entity: Event 604 634 ) … … 611 641 name: 'Sample Protocol', 612 642 entity: SamplingEvent, 613 type: TemplateFieldType.STRING 643 type: TemplateFieldType.FILE, 644 comment: 'You can upload a protocol here which describes the procedure which was used when carrying out the sampling event' 614 645 ) 615 646 .with { if (!validate()) { errors.each { println it} } else save()} … … 701 732 .addToFields( 702 733 new TemplateField( 703 name: 'Des ription',734 name: 'Description', 704 735 type: TemplateFieldType.STRING, 705 736 entity: SamplingEvent … … 724 755 725 756 // Add example studies 726 if ( !(grails.util.GrailsUtil.environment == GrailsApplication.ENV_TEST)) {757 if (grails.util.GrailsUtil.environment == GrailsApplication.ENV_DEVELOPMENT) { 727 758 println ".adding NuGO PPS3 leptin example study..." 728 759 def mouseStudy = new Study( … … 744 775 template: dietTreatmentTemplate 745 776 ) 746 .setFieldValue( 'Diet',' 10% fat (palm oil)')777 .setFieldValue( 'Diet','low fat') 747 778 .with { if (!validate()) { errors.each { println it} } else save()} 748 779 … … 752 783 template: dietTreatmentTemplate 753 784 ) 754 .setFieldValue( 'Diet',' 45% fat (palm oil)' )785 .setFieldValue( 'Diet','high fat' ) 755 786 .with { if (!validate()) { errors.each { println it} } else save()} 756 787 … … 760 791 template: boostTreatmentTemplate 761 792 ) 762 .setFieldValue( 'Co mpound','Vehicle' )793 .setFieldValue( 'Control','true' ) 763 794 .with { if (!validate()) { errors.each { println it} } else save()} 764 795 … … 768 799 template: boostTreatmentTemplate 769 800 ) 770 .setFieldValue( 'Co mpound','Leptin' )801 .setFieldValue( 'Control','false' ) 771 802 .with { if (!validate()) { errors.each { println it} } else save()} 772 803 … … 776 807 template: dietTreatmentTemplate 777 808 ) 778 .setFieldValue( 'Diet',' 10% fat (palm oil)')809 .setFieldValue( 'Diet','low fat') 779 810 .with { if (!validate()) { errors.each { println it} } else save()} 780 811 … … 784 815 template: dietTreatmentTemplate 785 816 ) 786 .setFieldValue( 'Diet',' 45% fat (palm oil)' )817 .setFieldValue( 'Diet','high fat' ) 787 818 .with { if (!validate()) { errors.each { println it} } else save()} 788 819 … … 792 823 template: boostTreatmentTemplate 793 824 ) 794 .setFieldValue( 'Co mpound','Vehicle' )825 .setFieldValue( 'Control','true' ) 795 826 .with { if (!validate()) { errors.each { println it} } else save()} 796 827 … … 800 831 template: boostTreatmentTemplate 801 832 ) 802 .setFieldValue( 'Co mpound','Leptin' )833 .setFieldValue( 'Control','false' ) 803 834 .with { if (!validate()) { errors.each { println it} } else save()} 804 835 -
trunk/grails-app/domain/dbnp/studycapturing/TemplateEntity.groovy
r559 r561 418 418 TemplateField field = getField(this.giveFields(), fieldName) 419 419 420 if( field.type == TemplateFieldType.BOOLEAN ) { 421 println( 'Boolean: ' + fieldName + " - " + value ); 420 // Convenience setter for boolean fields 421 if( field.type == TemplateFieldType.BOOLEAN && value && value.class == String ) { 422 if (value.equals("true")) { 423 value = true 424 } 425 else if (value.equals("false")) { 426 value = false 427 } 428 else { 429 throw new IllegalArgumentException("Boolean string not recognized: ${value} when setting field ${fieldName}") 430 } 422 431 } 423 432 424 433 // Convenience setter for template string list fields: find TemplateFieldListItem by name 425 434 if (field.type == TemplateFieldType.STRINGLIST && value && value.class == String) { 426 // Kees insensitive pattern matching ;)427 435 def escapedLowerCaseValue = value.toLowerCase().replaceAll("([^a-z0-9])", "_") 428 436 value = field.listEntries.find { … … 562 570 def store = getStore(field.type) 563 571 564 // If some value is entered (or 0 ), then save the value572 // If some value is entered (or 0 or BOOLEAN false), then save the value 565 573 // otherwise, it should not be present in the store, so 566 574 // it is unset if it is. 567 if (value || value == 0 ) {575 if (value || value == 0 || ( field.type == TemplateFieldType.BOOLEAN && value == false)) { 568 576 println ".setting [" + ((super) ? super.class : '??') + "] template field: [" + fieldName + "] ([" + value.toString() + "] of type [" + value.class + "])" 569 577 -
trunk/grails-app/views/common/_topnav.gsp
r526 r561 9 9 <ul class="subnav"> 10 10 <li><g:link controller="study" action="list">View studies</g:link></li> 11 <li><g:link controller="wizard" action="index">Create study</g:link></li>12 <li><g:link controller=" wizard" action="index">Edit study</g:link></li>11 <li><g:link controller="wizard" action="index">Create/edit study</g:link></li> 12 <li><g:link controller="importer" action="index">Import study data</g:link></li> 13 13 </ul> 14 14 </li> … … 28 28 </ul> 29 29 </li> 30 <li><g:link controller="importer" action="index">Import data</g:link></li>31 30 <g:if env="development"> 32 31 <li><g:link controller="query" action="index">Query database</g:link></li>
Note: See TracChangeset
for help on using the changeset viewer.