- Timestamp:
- Jul 16, 2010, 1:47:33 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/groovy/dbnp/rest/common/CommunicationManager.groovy
r649 r657 186 186 // register rest resource that returns the results of a full text query on SAM 187 187 // parameters: query. A string for fulltext search on SAM 188 // return value: results map. It contains two keys 'studyIds', and ' assays'. 'studyIds'189 // key maps to a list of Study domain objects of GSCF. ' assays' mapto a190 // list of pairs. Each pair consists of a n Assaydomain object of GSCF and191 // additional assayinformation from SAM provided as a map.188 // return value: results map. It contains two keys 'studyIds', and 'samples'. 'studyIds' 189 // key maps to a list of Study domain objects of GSCF. 'samples' maps to a 190 // list of pairs. Each pair consists of a Sample domain object of GSCF and 191 // additional sample information from SAM provided as a map. 192 192 // Example of a returned map: 193 193 // ["studies":[NuGO PPS human study], 194 // "assays":[[["isIntake":false, "isDrug":false, "correctionMethod":"test Correction Method 1", "detectableLimit":1, "isNew":false, 195 // "class":"data.SimpleAssay", "externalAssayID":"1", "id":1, "measurements":null, "unit":"Insulin", "inSerum":false, 196 // "name":"test Simple Assay 1", "referenceValues":"test Reference Values 1"], dbnp.studycapturing.Assay : 1]]] 194 // "samples":[[ [...], dbnp.studycapturing.Sample: 1]]] 197 195 def closure = { map -> 198 196 def studies = [] 199 def assays= []197 def samples = [] 200 198 def studiesHQ = "from dbnp.studycapturing.Study as s where s.code=?" 201 199 map['studyIds'].each { studies.add( dbnp.studycapturing.Study.find(studiesHQ,[it]) ) } 202 map[' assays'].each { samAssay->203 def assayID = samAssay['externalAssayID']204 def assayHQ = "from dbnp.studycapturing.Assay as a where a.externalAssayID='${assayID}'"205 def assay = dbnp.studycapturing.Assay.find(assayHQ)206 assays.add( [samAssay,assay] )200 map['Samples'].each { samSample -> 201 def sampleID = samSample['externalSampleID'] 202 def sampleHQ = "from dbnp.studycapturing.Sample as a where a.externalSampleID='${sampleID}'" 203 def sample = dbnp.studycapturing.Sample.find(sampleHQ) 204 samples.add( [samSample,sample] ) 207 205 } 208 return [studies:studies, assays:assays]206 return [studies:studies, samples:samples] 209 207 } 210 208
Note: See TracChangeset
for help on using the changeset viewer.