Changeset 375 for trunk/grails-app/conf


Ignore:
Timestamp:
Apr 23, 2010, 11:26:57 AM (12 years ago)
Author:
keesvb
Message:

added giveDomainFields to TemplateEntity? entities, fixed some problems in BootStrap?

File:
1 edited

Legend:

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

    r370 r375  
    248248                        def genotypeTypeField = new TemplateField(
    249249                                name: 'Genotype type',type: TemplateFieldType.STRINGLIST,
    250                                 listEntries: [new TemplateFieldListItem(name:'transgenic'),
     250                                listEntries: [new TemplateFieldListItem(name:'wildtype'),
     251                                        new TemplateFieldListItem(name:'transgenic'),
    251252                                        new TemplateFieldListItem(name:'knock-out'),
    252253                                        new TemplateFieldListItem(name:'knock-in')])
     
    259260                        def studyTemplate = new Template(
    260261                                name: 'Academic study', entity: dbnp.studycapturing.Study)
    261                                 //.addToFields(new TemplateField(name: 'Description',type: TemplateFieldType.TEXT))
     262                                .addToFields(new TemplateField(name: 'Description',type: TemplateFieldType.TEXT))
    262263                                .addToFields(new TemplateField(name: 'Study code',type: TemplateFieldType.STRING))
    263264                                .addToFields(new TemplateField(name: 'Objectives',type: TemplateFieldType.TEXT))
     
    339340
    340341                        // Human sample template
     342                        println ".adding human sample template..."
    341343                        def humanSampleTemplate = new Template(
    342344                                name: 'Human tissue sample', entity: dbnp.studycapturing.Sample)
     
    348350
    349351                        //Plant template
     352                        println ".adding plant template..."
    350353                        def plantTemplate = new Template(
    351354                                name: 'Plant template', entity: dbnp.studycapturing.Subject)
     
    389392                        .with { if (!validate()) { errors.each { println it} } else save()}
    390393
     394                        println ".adding plant sample template..."
    391395                        def plantSampleTemplate = new Template(
    392396                                name: 'Plant sample', entity: dbnp.studycapturing.Sample)
     
    398402
    399403
    400                         // Event template
     404                        // Event templates
     405                        println ".adding event templates..."
    401406                        def dietTreatmentTemplate = new Template(
    402407                                name: 'Diet treatment ', entity: dbnp.studycapturing.Event)
    403408                        .addToFields(sampleDescriptionField)
    404409                        .addToFields(new TemplateField(
    405                                 name: 'Diet', type: TemplateFieldType.STRING))
     410                                name: 'Diet', type: TemplateFieldType.STRINGLIST,
     411                                listEntries: [new TemplateFieldListItem(name:'10% fat (palm oil)'),new TemplateFieldListItem(name: '45% fat (palm oil)')]))
    406412                        .with { if (!validate()) { errors.each { println it} } else save()}
    407413
     
    410416                        .addToFields(sampleDescriptionField)
    411417                        .addToFields(new TemplateField(
    412                                 name: 'Compound', type: TemplateFieldType.STRING))
     418                                name: 'Compound', type: TemplateFieldType.STRING,
     419                                listEntries: [new TemplateFieldListItem(name:'Vehicle'),new TemplateFieldListItem(name: 'Leptin')]))
    413420                        .with { if (!validate()) { errors.each { println it} } else save()}
    414421
     
    456463                        */
    457464                        // studies
     465                        println ".adding NuGO PPS3 leptin example study..."
    458466                        def exampleStudy = new Study(
    459467                                template: studyTemplate,
     
    464472                                startDate: Date.parse('yyyy-MM-dd','2007-12-11')
    465473                        )
    466                         //.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." )
    467474                        .with { if (!validate()) { errors.each { println it} } else save()}
    468475
     476                        exampleStudy.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." )
     477                        exampleStudy.save()
     478
     479                        println ".adding NuGO PPSH example study..."
    469480                        def exampleHumanStudy = new Study(
    470                                 template: humanTemplate,
     481                                template: studyTemplate,
    471482                                title:"Human example template",
    472483                                code:"Human example code",
     
    475486                                startDate: Date.parse('yyyy-MM-dd','2007-12-11')
    476487                        )
    477                         //.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." )
    478488                        .with { if (!validate()) { errors.each { println it} } else save()}
     489
     490                        exampleHumanStudy.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." )
     491                        exampleHumanStudy.save()
    479492
    480493                        def evLF = new Event(
     
    483496                                template: dietTreatmentTemplate
    484497                        )
    485                         .setFieldValue( 'Diet','10% fat (palm oil)' )
    486498                        .with { if (!validate()) { errors.each { println it} } else save()}
     499                        evLF.setFieldValue( 'Diet','10% fat (palm oil)' )
     500                        evLF.save(flush:true)
     501                        // TODO: find out why Diet is not set and Compound is
    487502
    488503                        def evHF = new Event(
     
    625640                                .setFieldValue("Age (weeks)", 17)
    626641                                .setFieldValue("Cage", "" + (int)(x/2))
    627                                 .with { if (!validate()) { errors.each { println it} } else save()}
     642                                .with { if (!validate()) { errors.each { println it} } else save(flush:true)}
    628643
    629644                                exampleStudy.addToSubjects(currentSubject)
Note: See TracChangeset for help on using the changeset viewer.