Changeset 934
- Timestamp:
- Oct 8, 2010, 2:47:23 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/RestController.groovy
r910 r934 86 86 def user = params.user 87 87 Study.findAllByOwner(requestUser).each { study -> 88 studies.push( [ 'title':study.title, 'studyToken':study. code] )88 studies.push( [ 'title':study.title, 'studyToken':study.getToken()] ) 89 89 } 90 90 render studies as JSON … … 131 131 if(study && study.owner == requestUser) study.assays.each{ assay -> 132 132 //if (assay.module.url.equals(params.moduleURL)) { 133 def map = ['name':assay.name, 'assayToken':assay. externalAssayID]133 def map = ['name':assay.name, 'assayToken':assay.getToken()] 134 134 assays.push( map ) 135 135 //} … … 159 159 assay.getSamples().each { sample -> 160 160 def item = [ 161 'sampleToken' 162 'material' 163 'subject' 164 'event' 165 'startTime' 161 'sampleToken' : sample.name, 162 'material' : sample.material.name, 163 'subject' : sample.parentSubject.name, 164 'event' : sample.parentEvent.template.name, 165 'startTime' : sample.parentEvent.getStartTimeString() 166 166 ] 167 167 items.push item … … 170 170 render items as JSON 171 171 } 172 173 174 175 172 176 173 … … 198 195 def name = field.name 199 196 def value = study.getFieldValue( name ) 200 if(name=="code") { name = "studyToken" }201 197 items[name] = value 202 198 } … … 227 223 def name = field.name 228 224 def value = assay.getFieldValue( name ) 229 if(name=="externalAssayID") { name = "assayToken" }230 225 items[name] = value 231 226 } … … 272 267 def name = field.name 273 268 def value = sample.getFieldValue( name ) 274 if(name=="name") { name = "sampleToken" }275 269 items[name] = value 276 270 } -
trunk/grails-app/domain/dbnp/studycapturing/Assay.groovy
r859 r934 53 53 return name; 54 54 } 55 56 def getToken() { 57 return externalAssayID 58 } 55 59 } -
trunk/grails-app/domain/dbnp/studycapturing/Sample.groovy
r861 r934 29 29 Term material // material of the sample (should normally be bound to the BRENDA ontology) 30 30 31 def getExternalSampleId() { name }32 31 33 32 /** -
trunk/grails-app/domain/dbnp/studycapturing/Study.groovy
r900 r934 55 55 } 56 56 57 // The external study ID is currently defined asthe code of the study.57 // The external identifier (studyToken) is currently the code of the study. 58 58 // It is used from within dbNP submodules to refer to particular study in this GSCF instance. 59 def get ExternalStudyId() { code }59 def getToken() { code } 60 60 61 61 /** -
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.