Changeset 1440 for trunk/grails-app/controllers
- Timestamp:
- Jan 25, 2011, 5:57:37 PM (12 years ago)
- Location:
- trunk/grails-app/controllers
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/RestController.groovy
r1430 r1440 137 137 } 138 138 else if( params.studyToken instanceof String ) { 139 def study = Study.findBy Code( params.studyToken )139 def study = Study.findByStudyUUID( params.studyToken ) 140 140 if( study ) { 141 141 if( !study.canRead(AuthenticationService.getRemotelyLoggedInUser( params.consumer, params.token )) ) { … … 153 153 else { 154 154 params.studyToken.each{ studyToken -> 155 def study = Study.findBy Code( studyToken );155 def study = Study.findByStudyUUID( studyToken ); 156 156 if( study ) 157 157 studies.push study … … 166 166 if( study.canRead(AuthenticationService.getRemotelyLoggedInUser( params.consumer, params.token ))) { 167 167 168 def items = [ :]168 def items = [studyToken:study.giveUUID()] 169 169 study.giveFields().each { field -> 170 170 def name = field.name 171 171 def value = study.getFieldValue( name ) 172 if( name=='code' ) {173 name = 'studyToken'174 }175 172 items[name] = value 176 173 } … … 215 212 return false 216 213 } else { 217 study = Study.findBy Code( params.studyToken )214 study = Study.findByStudyUUID( params.studyToken ) 218 215 if( study ) { 219 216 if( !study.canRead(AuthenticationService.getRemotelyLoggedInUser( params.consumer, params.token )) ) { … … 248 245 List subjects = [] 249 246 if( params.studyToken ) { 250 def id = params.studyToken 251 def study = Study.find( "from Study as s where s.code=?", [id]) 247 def study = Study.findByStudyUUID( params.studyToken) 252 248 253 249 if(study) { … … 321 317 if( params.studyToken ) { 322 318 323 def id = params.studyToken 324 def study = Study.findByCode(id) 319 def study = Study.findByStudyUUID(params.studyToken) 325 320 326 321 if(study) { … … 336 331 } 337 332 else if( params.assayToken instanceof String ) { 338 def assay = study.assays.find{ it. externalAssayID==params.assayToken }333 def assay = study.assays.find{ it.giveUUID() == params.assayToken } 339 334 if( assay ) { 340 335 assays.push assay … … 343 338 else { // there are multiple assayTokens instances 344 339 params.assayToken.each { assayToken -> 345 def assay = study.assays.find{ it. externalAssayID==assayToken }340 def assay = study.assays.find{ it.giveUUID() == assayToken } 346 341 if(assay) { 347 342 assays.push assay … … 353 348 if (assay.module.url.equals(params.consumer)) { 354 349 if(assay) { 355 def map = [ :]350 def map = [assayToken : assay.giveUUID()] 356 351 assay.giveFields().each { field -> 357 352 def name = field.name 358 353 def value = assay.getFieldValue( name ) 359 if(field.name=='externalAssayID') {360 name = 'assayToken'361 }362 354 map[name] = value 363 355 } 364 map["parentStudyToken"] = assay.parent.g etToken()356 map["parentStudyToken"] = assay.parent.giveUUID() 365 357 returnList.push( map ) 366 358 } … … 375 367 render returnList as JSON 376 368 } 377 378 379 380 381 382 383 369 384 370 /** … … 442 428 def items = [] 443 429 if( params.assayToken ) { 444 def assay = Assay.find ( "from Assay as a where externalAssayID=?",[params.assayToken])430 def assay = Assay.findByAssayUUID( params.assayToken ); 445 431 446 432 if( assay ) { … … 458 444 samples = [] 459 445 sampleTokens.each{ sampleToken -> 460 samples.addAll(assay.getSamples().find{ sample -> sampleToken == sample. name})446 samples.addAll(assay.getSamples().find{ sample -> sampleToken == sample.giveUUID() }) 461 447 } 462 448 } … … 465 451 466 452 def item = [ 453 'sampleToken' : sample.giveUUID(), 467 454 'material' : sample.material?.name, 468 455 'subject' : sample.parentSubject?.name, … … 485 472 parentEvent.giveFields().each { field -> 486 473 def name = field.name 487 if( name !='sampleTemplate' && name!='fields') {474 if( name !='sampleTemplate' && name != 'fields') { 488 475 def value = parentEvent.getFieldValue( name ) 489 476 eventHash[name]=value … … 517 504 } 518 505 519 520 521 522 523 524 525 526 506 /** 527 507 * Returns the authorization level the user has for a given study. … … 537 517 def getAuthorizationLevel = { 538 518 if( params.studyToken ) { 539 def id = params.studyToken 540 def study = Study.find( "from Study as s where s.code=?", [id]) 519 def study = Study.findByStudyUUID(params.studyToken) 541 520 542 521 if( !study ) { -
trunk/grails-app/controllers/dbnp/studycapturing/AssayController.groovy
r1430 r1440 52 52 53 53 def showByToken = { 54 def assayInstance = Assay.findBy ExternalAssayID(params.id)54 def assayInstance = Assay.findByAssayUUID(params.id) 55 55 if (!assayInstance) { 56 56 flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'assay.label', default: 'Assay'), params.id])}" -
trunk/grails-app/controllers/dbnp/studycapturing/StudyController.groovy
r1436 r1440 252 252 253 253 def showByToken = { 254 def studyInstance = Study.findBy Code(params.id)254 def studyInstance = Study.findByStudyUUID(params.id) 255 255 if (!studyInstance) { 256 256 flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'study.label', default: 'Study'), params.id])}"
Note: See TracChangeset
for help on using the changeset viewer.