Ignore:
Timestamp:
Oct 8, 2010, 2:47:23 PM (13 years ago)
Author:
j.saito@…
Message:

Adjusted CommunicationManager? to match closer with CommunicationManager? in SAM.
Added support for "token" notation of REST services directly in Study and Assay domain classes.
Cleaned up and tested communication further.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/groovy/dbnp/rest/common/CommunicationManager.groovy

    r835 r934  
    3030    def public static DSPServerURL  = "http://localhost:8080/gscf"
    3131
    32      
     32
    3333
    3434    /**
     
    109109                        def map = [:]
    110110                    def args = strangeGroovyArgs[0]        // groovy nests the parameters of the methods in some other array
    111                         for( i in 0..(params.size-1) ) {
    112                                 def param = params[i]
    113                             map[param] = args[i]
    114                         }
     111
     112                        if(params.size > 0 )
     113                        {
     114                                for( i in 0..(params.size-1) ) {
     115                                        def param = params[i]
     116                                        map[param] = args[i]
     117                                }
     118                        }
     119
    115120                        return closure( getRestResource( serverURL, restName, map ) )
    116121                }
     
    154159        def url = GSCFServerURL + '/rest'
    155160                addRestWrapper( url , 'getStudies' )
    156                 addRestWrapper( url , 'getSubjects', ['externalStudyID'] )
    157                 addRestWrapper( url , 'getAssays',   ['externalStudyID'] )
    158                 addRestWrapper( url , 'getSamples',  ['externalAssayID'] )
    159     }
     161        addRestWrapper( url , 'getSubjects', ['studyToken'] )
     162                addRestWrapper( url , 'getAssays',   ['studyToken','moduleURL'] )
     163                addRestWrapper( url , 'getSamples',  ['assayToken'] )
     164        }
    160165
    161166
     
    173178                // register method that links to the SAM view for showing a SimpleAssay
    174179        // parameters: externalAssayID
    175                 addViewWrapper( 'getAssayShowURL', url, 'simpleAssay/showByExternalID', ['externalAssayID'] )
     180                addViewWrapper( 'getAssayShowURL', url, 'simpleAssay/show', ['externalAssayID'] )
    176181
    177182                // register method that links to the SAM view for editing a SimpleAssay
     
    192197                //                               ["studies":[NuGO PPS human study],
    193198                //               "samples":[[ [...], dbnp.studycapturing.Sample: 1]]]
    194                 def closure1 = { map ->
    195                     def studies = []
    196                     def samples = []
     199                def closure = { map ->
     200                    def studies = []   
     201                    def assays  = []   
    197202                        def studiesHQ = "from dbnp.studycapturing.Study as s where s.code=?"
    198203                        map['studyIds'].each { studies.add( dbnp.studycapturing.Study.find(studiesHQ,[it]) ) }
    199                         map['Samples'].each { samSample ->
    200                                 def sampleID = samSample['externalSampleID']
    201                             def sampleHQ = "from dbnp.studycapturing.Sample as a where a.externalSampleID='${sampleID}'"
    202                                 def sample = dbnp.studycapturing.Sample.find(sampleHQ)
    203                                 samples.add( [samSample,sample] )
    204                         }
    205                         return [studies:studies, samples:samples]
    206                 }
    207 
    208                 addRestWrapper( url+'/rest', 'getQueryResult',  ['query'], closure1 )
     204                        map['assays'].each { samAssay ->
     205                                def assayID = samAssay['externalAssayID']
     206                            def assayHQ = "from dbnp.studycapturing.Assay as a where a.externalAssayID='${assayID}'"
     207                                def assay = dbnp.studycapturing.Assay.find(assayHQ)
     208                                assays.add( [samAssay,assay] )
     209                        } 
     210                        return [studies:studies, assays:assays]
     211                }
     212
     213                addRestWrapper( url+'/rest', 'getQueryResult',  ['query'], closure )
    209214
    210215
Note: See TracChangeset for help on using the changeset viewer.