Ignore:
Timestamp:
Oct 1, 2010, 11:46:02 AM (6 years ago)
Author:
jahn
Message:

Adjusted to new covention of using '...Token' instead of 'extenal...ID'.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/RestController.groovy

    r903 r904  
    11/**
    2  * RestControler
     2 * RestController
    33 *
    44 * This controler provides a REST service.
     
    8080        * Provide a list of all studies owned by the supplied user.
    8181        *
    82         * @return JSON object list containing 'externalStudyID', and 'name' (title) for each study
     82        * @return JSON object list containing 'studyToken', and 'name' (title) for each study
    8383        */
    8484        def getStudies = {
     
    8686                def user = params.user
    8787                Study.findAllByOwner(requestUser).each { study ->
    88                         studies.push( [ 'externalStudyID': study.code, 'title':study.title, 'studyToken':study.code ] )
     88                        studies.push( [ 'title':study.title, 'studyToken':study.code ] )
    8989                }
    9090                render studies as JSON
     
    9797        * Provide a list of all subjects belonging to a study.
    9898        *
    99         * @param externalStudyID String The external study id (code) of the target GSCF Study object
     99        * @param studyToken String The external study id (code) of the target GSCF Study object
    100100        * @return JSON object list of subject names
    101101        */
    102102        def getSubjects = {
    103103                List subjects = []
    104                 if( params.externalStudyID ) {
    105                         def id = params.externalStudyID
     104                if( params.studyToken ) {
     105                        def id = params.studyToken
    106106                        def study = Study.find( "from Study as s where s.code=?", [id])
    107107                        if(study) study.subjects.each { subjects.push it.name }
     
    117117        *
    118118        * Example call of the getAssays REST resource:
    119         * http://localhost:8080/gscf/rest/getAssays?externalStudyID=PPSH&moduleURL=http://localhost:8182/sam
    120         *
    121         * @param externalStudyID String The external study id (code) of the target GSCF Study object
     119        * http://localhost:8080/gscf/rest/getAssays?studyToken=PPSH&moduleURL=http://localhost:8182/sam
     120        *
     121        * @param stuyToken String The external study id (code) of the target GSCF Study object
    122122        * @param moduleURL String The base URL of the calling dbNP module
    123123        * @return list of assays in the study as JSON object list, filtered to only contain assays
    124         *         for the specified module, with 'externalAssayID' and 'name' for each assay
     124        *         for the specified module, with 'assayToken' and 'name' for each assay
    125125        */
    126126        def getAssays = {
    127127                List assays = []
    128                 if( params.externalStudyID || params.studyToken ) {
    129                         def id = params.studyToken ?: params.externalStudyID
     128                if( params.studyToken ) {
     129                        def id = params.studyToken
    130130                        def study = Study.find( "from Study as s where s.code=?", [id] )
    131131                        if(study && study.owner == requestUser) study.assays.each{ assay ->
    132                                 if (assay.module.url.equals(params.moduleURL)) {
    133                                 def map = ['name':assay.name, 'externalAssayID':assay.externalAssayID, 'assayToken':assay.externalAssayID]
     132                                //if (assay.module.url.equals(params.moduleURL)) {
     133                                def map = ['name':assay.name, 'assayToken':assay.externalAssayID]
    134134                                        assays.push( map )
    135                                 }
     135                                //}
    136136                        }
    137137                }
     
    145145        * Provide all samples of a given Assay. The result is an enriched list with additional information for each sample.
    146146        *
    147         * @param externalAssayID String (externalAssayID of some Assay in GSCF)
     147        * @param assayToken String (assayToken of some Assay in GSCF)
    148148        * @return As a JSON object list, for each sample in that assay:
    149149        * @return 'name' (Sample name, which is unique)
     
    155155        def getSamples = {
    156156                def items = []
    157                 if( params.externalAssayID ) {
    158                         def assay = Assay.find( "from Assay as a where externalAssayID=?",[params.externalAssayID])
     157                if( params.assayToken ) {
     158                        def assay = Assay.find( "from Assay as a where externalAssayID=?",[params.assayToken])
    159159                        assay.getSamples().each { sample ->
    160160                                def item = [
     
    241241        * One specific sample of a given Assay.
    242242        *
    243         * @param externalAssayID String (externalAssayID of some Assay in GSCF)
     243        * @param assayToken String (id of some Assay in GSCF)
    244244        * @return As a JSON object list, for each sample in that assay:
    245245        * @return 'name' (Sample name, which is unique)
Note: See TracChangeset for help on using the changeset viewer.