- Timestamp:
- Oct 8, 2010, 2:47:23 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/groovy/dbnp/rest/common/CommunicationManager.groovy
r835 r934 30 30 def public static DSPServerURL = "http://localhost:8080/gscf" 31 31 32 32 33 33 34 34 /** … … 109 109 def map = [:] 110 110 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 115 120 return closure( getRestResource( serverURL, restName, map ) ) 116 121 } … … 154 159 def url = GSCFServerURL + '/rest' 155 160 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 } 160 165 161 166 … … 173 178 // register method that links to the SAM view for showing a SimpleAssay 174 179 // parameters: externalAssayID 175 addViewWrapper( 'getAssayShowURL', url, 'simpleAssay/show ByExternalID', ['externalAssayID'] )180 addViewWrapper( 'getAssayShowURL', url, 'simpleAssay/show', ['externalAssayID'] ) 176 181 177 182 // register method that links to the SAM view for editing a SimpleAssay … … 192 197 // ["studies":[NuGO PPS human study], 193 198 // "samples":[[ [...], dbnp.studycapturing.Sample: 1]]] 194 def closure 1 = { map ->195 def studies = [] 196 def samples = []199 def closure = { map -> 200 def studies = [] 201 def assays = [] 197 202 def studiesHQ = "from dbnp.studycapturing.Study as s where s.code=?" 198 203 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'], closure 1)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 ) 209 214 210 215
Note: See TracChangeset
for help on using the changeset viewer.