Changeset 4 for trunk/grails-app/controllers/nl/tno
- Timestamp:
- Jan 17, 2011, 3:49:20 PM (13 years ago)
- Location:
- trunk/grails-app/controllers/nl/tno/metagenomics
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/nl/tno/metagenomics/AssayController.groovy
r3 r4 433 433 } 434 434 435 /**436 * Updates existing run437 */438 def updateRun = {439 // load study with id specified by param.id440 def assay = Assay.get(params.id as Long)441 442 if (!assay) {443 flash.message = "No assay found with id: $params.id"444 redirect('action': 'errorPage')445 return446 }447 448 if( !params.run_id ) {449 flash.message = "No run id given"450 redirect(action: 'show', id: params.id)451 return452 }453 454 def run455 456 try {457 run = Run.findById( params.run_id as Long )458 } catch( Exception e ) {459 throw e460 flash.message = "Incorrect run id given: "461 redirect(action: 'show', id: params.id)462 return463 }464 465 // Set properties to the run466 params.parameterFile = params.editParameterFile467 run.setPropertiesFromForm( params );468 469 if( run.save() ) {470 flash.message = "Run succesfully saved";471 } else {472 flash.error = "Run could not be saved: " + run.getErrors();473 }474 475 redirect( action: 'show', id: params.id)476 }477 478 435 def errorPage = { 479 436 render "An error has occured. $flash.message" -
trunk/grails-app/controllers/nl/tno/metagenomics/RunController.groovy
r2 r4 7 7 class RunController { 8 8 def fileService 9 10 /** 11 * Shows information about this run in dialog style 12 */ 13 def show = { 14 Run run = Run.get( params.id as long ); 15 Assay assay = Assay.get( params.assayId as long ); 16 17 if( !run ) { 18 render "Run not found"; 19 return 20 } 21 22 if( !assay ) { 23 render "Assay not found"; 24 return 25 } 26 27 [assay: assay, run: run] 28 } 29 30 /** 31 * Shows a form to edit the specified run in dialog mode 32 */ 33 def editForm = { 34 Run run = Run.get( params.id as long ); 35 Assay assay = Assay.get( params.assayId as long ); 36 37 if( !run ) { 38 render "Run not found"; 39 return 40 } 41 42 if( !assay ) { 43 render "Assay not found"; 44 return 45 } 46 47 [assay: assay, run: run] 48 } 9 49 10 50 def create = { … … 26 66 redirect( controller: "assay", action: "show", id: params.id ) 27 67 } 68 69 def update = { 70 if( !params.assayId ) { 71 flash.error = "No assay id given" 72 redirect(controller: 'assay', action: 'errorpage') 73 return 74 } 75 def assay = Assay.get(params.assayId as Long) 76 77 // load run with id specified by param.id 78 if (!assay) { 79 flash.message = "No assay found with id: ${params.assayId}" 80 redirect(controller: 'assay', 'action': 'errorPage') 81 return 82 } 83 84 85 def run 86 87 try { 88 run = Run.get( params.id as Long ); 89 } catch( Exception e ) { 90 throw e 91 flash.message = "Incorrect run id given: " 92 redirect(controller: 'assay', action: 'show', id: params.assayId) 93 return 94 } 95 96 // Set properties to the run 97 params.parameterFile = params.editParameterFile 98 run.setPropertiesFromForm( params ); 99 100 if( run.save() ) { 101 flash.message = "Run succesfully saved"; 102 } else { 103 flash.error = "Run could not be saved: " + run.getErrors(); 104 } 105 106 redirect( controller: 'assay', action: 'show', id: params.assayId) 107 } 108 109 def delete = { 110 Run run = Run.get( params.id as long ); 111 112 // Don't remove runs for which data exists 113 if( run.sequenceData?.size() ) { 114 flash.message = "Run could not be deleted because samples are associated with it."; 115 redirect( controller: "assay", action: "show", id: params.assayId ) 116 } 117 118 // Remove all associations 119 run.assays.each { 120 run.removeFromAssays( it ); 121 } 122 123 def name = run.name 124 run.delete(); 125 flash.message = "Run " + name + " has been deleted from the system." 126 127 redirect( controller: "assay", action: "show", id: params.assayId ) 128 129 } 28 130 } -
trunk/grails-app/controllers/nl/tno/metagenomics/StudyController.groovy
r3 r4 5 5 def gscfService 6 6 def fileService 7 def trashService 7 8 8 9 def index = { … … 16 17 fileService.cleanDirectory(); 17 18 19 // Clean the trash if needed 20 trashService.cleanTrash(); 21 18 22 // Filter studies for the ones the user is allowed to see 19 def studies = Study.findAll(); 20 [studies: studies.findAll { it.canRead( session.user ) }, gscfAddUrl: gscfService.urlAddStudy(), lastSynchronized: synchronizationService.lastFullSynchronization ] 23 def studies = Study.list(); 24 [studies: studies.findAll { it.canRead( session.user ) }, 25 gscfAddUrl: gscfService.urlAddStudy(), 26 lastSynchronized: synchronizationService.lastFullSynchronization ] 21 27 } 22 28 -
trunk/grails-app/controllers/nl/tno/metagenomics/integration/RestController.groovy
r3 r4 343 343 render url as JSON 344 344 } 345 } .metagenomics.baseURL345 } 346 346 347 347 /***************************************************/ -
trunk/grails-app/controllers/nl/tno/metagenomics/integration/SynchronizeController.groovy
r3 r4 17 17 // /synchronize -> fails with an error, redirects to /study 18 18 // etc... 19 synchronizationService.lastFullSynchronization = new Date();19 // synchronizationService.lastFullSynchronization = new Date(); 20 20 21 21 [ url: redirectUrl ] … … 27 27 28 28 synchronizationService.fullSynchronization(); 29 29 30 30 render ""; 31 31 }
Note: See TracChangeset
for help on using the changeset viewer.