Changeset 554


Ignore:
Timestamp:
Jun 10, 2010, 11:43:50 AM (9 years ago)
Author:
jahn
Message:

Refactored member 'code' of Study. Changed it from being template to being a proper member. This allows using as external ID in module communication.

Location:
trunk/grails-app
Files:
4 edited

Legend:

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

    r550 r554  
    215215                        )
    216216                        .addToFields(new TemplateField(name: 'Description',type: TemplateFieldType.TEXT, entity: Study,comment:'Describe here the type of subjects and the treatment, challenges and sampling.'))
     217/*
    217218                        .addToFields(new TemplateField(
    218219                                name: 'Study code',
     
    222223                                comment: 'Fill out the code by which many people will recognize your study')
    223224                        )
     225*/
    224226                        .addToFields(new TemplateField(name: 'Objectives',type: TemplateFieldType.TEXT,entity: Study,comment:'Fill out the aim or questions of the study'))
    225227                        .addToFields(new TemplateField(name: 'Consortium',type: TemplateFieldType.STRING,entity: Study,comment:'If the study was performed within a consortium (e.g. NMC, NuGO), you can indicate this here'))
     
    731733                                        ecCode:"2007117.c",
    732734                                        startDate: Date.parse('yyyy-MM-dd','2008-01-02'),
    733                                         externalStudyID: 1
    734735                                )
    735736                                .with { if (!validate()) { errors.each { println it} } else save()}
     
    939940                                        ecCode:"unknown",
    940941                                        startDate: Date.parse('yyyy-MM-dd','2008-01-14'),
    941                                         externalStudyID: 2
    942942                                )
    943943                                .setFieldValue( 'Description', "Human study performed at RRI; centres involved: RRI, IFR, TUM, Maastricht U." )
  • trunk/grails-app/controllers/RestController.groovy

    r549 r554  
    11/**
    2  * ModuleCommunicationController Controler
     2 * RestControler
    33 *
    44 * This controler provides a REST service.
     
    4242                List studies = []
    4343                Study.list().each { study ->
    44                     studies.push( [ 'externalStudyID': study.externalStudyID, 'name':study.title ] )
     44                    studies.push( [ 'externalStudyID': study.code, 'name':study.title ] )
    4545                }
    4646                render studies as JSON
     
    6161                if( params.externalStudyID ) {
    6262                        def id = Long.parseLong(params.externalStudyID)
    63                         def study = Study.find( "from Study as s where s.externalStudyID=?", [id])
     63                        def study = Study.find( "from Study as s where s.code=?", [id])
    6464                        if(study) study.subjects.each { subjects.push it.name }
    6565                }
     
    8181                if( params.externalStudyID ) {
    8282                        def id = Long.parseLong(params.externalStudyID)
    83                         def study = Study.find( "from Study as s where s.externalStudyID=?", [id])
     83                        def study = Study.find( "from Study as s where s.code=?", [id])
    8484                        if(study) study.assays.each{ assay -> assays.push assay.externalAssayID }
    8585                }
  • trunk/grails-app/domain/dbnp/studycapturing/Assay.groovy

    r540 r554  
    1010    AssayModule module
    1111    long externalAssayID // the assay ID the assay has in the external module
    12 
     12       
    1313    static hasMany = [samples : Sample]
    1414
  • trunk/grails-app/domain/dbnp/studycapturing/Study.groovy

    r540 r554  
    1313        nimble.User owner
    1414        String title
     15        String code             // also enables referencing to studies from the Simple Assay Module
    1516        Date dateCreated
    1617        Date lastUpdated
    1718        Date startDate
    18     long externalStudyID   // enables referring to studies outside of GSCF, e.g., in the Simple Assay Module
     19   
    1920
    2021        /**
     
    2829                        name: 'title',
    2930                        type: TemplateFieldType.STRING),
     31                new TemplateField(
     32                        name: 'code',
     33                        type: TemplateFieldType.STRING,
     34                        preferredIdentifier:true,
     35                        comment: 'Fill out the code by which many people will recognize your study'),
    3036                new TemplateField(
    3137                        name: 'startDate',
     
    4955        static constraints = {
    5056                owner(nullable: true, blank: true)
    51                 externalStudyID(nullable:true, blank:true)
     57                code(nullable:false, blank:true,unique:true)
    5258        }
    5359
Note: See TracChangeset for help on using the changeset viewer.