Changeset 4 for trunk/grails-app/services/nl
- Timestamp:
- Jan 17, 2011, 3:49:20 PM (12 years ago)
- Location:
- trunk/grails-app/services/nl/tno/metagenomics
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/services/nl/tno/metagenomics/FastaService.groovy
r3 r4 131 131 132 132 // Best matching sample 133 // TODO: Implement method to search for sample matches in a provided excel sheet 133 134 def sampleIdx = fuzzySearchService.mostSimilarWithIndex( matchWith, samples.sample.name ); 134 135 def assaySample = null … … 316 317 lookingForFirstQualityScores = false; 317 318 318 quality = updateQuality( quality, line ); 319 // Don't compute average quality because it takes too much time 320 //quality = updateQuality( quality, line ); 319 321 } 320 322 } else { 321 quality = updateQuality( quality, line ); 323 // Don't compute average quality because it takes too much time 324 //quality = updateQuality( quality, line ); 322 325 } 323 326 -
trunk/grails-app/services/nl/tno/metagenomics/integration/GscfService.groovy
r3 r4 213 213 * @return ArrayList 214 214 */ 215 public HashMap getAuthorizationLevel(String sessionToken, String studyToken) {215 public HashMap getAuthorizationLevel(String sessionToken, String studyToken) throws ResourceNotFoundException { 216 216 ArrayList list 217 217 -
trunk/grails-app/services/nl/tno/metagenomics/integration/SynchronizationService.groovy
r3 r4 7 7 class SynchronizationService { 8 8 def gscfService 9 def trashService 9 10 10 11 String sessionToken = "" // Session token to use for communication … … 81 82 return 82 83 83 def previousEager = eager84 eager = true85 synchronizeStudies();86 eager = previousEager84 def previousEager = this.eager 85 this.eager = true 86 this.synchronizeStudies(); 87 this.eager = previousEager 87 88 88 89 SynchronizationService.lastFullSynchronization = new Date(); … … 95 96 public ArrayList<Study> synchronizeStudies() { 96 97 if( !performSynchronization() ) 97 return Study. findAll()98 return Study.list() 98 99 99 100 // When eager fetching is enabled, ask for all studies, otherwise only ask for studies marked dirty … … 102 103 def studies 103 104 if( eager ) { 104 studies = Study.findAll() 105 studies = Study.list().findAll { !it.trashcan }; 106 log.trace "Eager synchronization: " + studies.size(); 105 107 } else { 106 108 studies = Study.findAllWhere( [isDirty: true] ); 107 } 108 109 log.trace "Default synchronization: " + studies.size() 110 } 111 109 112 // Perform no synchronization if no studies have to be synchronized 110 113 // Perform synchronization on only one study directly, because otherwise … … 235 238 return null 236 239 240 // Trashcan should never be synchronized 241 if( study.trashcan ) 242 return study 243 237 244 // If the study hasn't changed, don't update anything 238 245 if( !eager && !study.isDirty ) … … 249 256 } catch( ResourceNotFoundException e ) { 250 257 // Study can't be found within GSCF. 251 // TODO: How to handle the data that remains 252 study.delete() 258 trashService.moveToTrash( study ); 253 259 return null 254 260 } catch( Exception e ) { // All other exceptions … … 335 341 for( int i = numStudyAssays - 1; i >= 0; i-- ) { 336 342 def existingAssay = studyAssays[i]; 337 338 existingAssay.delete()339 study.removeFromAssays( existingAssay );343 344 // Move data to trash 345 trashService.moveToTrash( existingAssay ); 340 346 } 341 347 … … 408 414 409 415 // The assay has been removed 410 // TODO: What to do with the data associated with this Assay (e.g. sequences)? See also GSCF ticket #255 411 existingAssay.delete(); 412 study.removeFromAssays( existingAssay ); 416 trashService.moveToTrash( existingAssay ); 413 417 } 414 418 } … … 446 450 } catch( ResourceNotFoundException e ) { 447 451 // Study has been deleted, remove all authorization on that study 448 // TODO: handle deletion449 452 log.trace( "Study " + study.studyToken + " has been deleted. Remove all authorization on that study") 450 451 Auth.findAllByStudy( study ).each { 452 it.delete() 453 } 453 trashService.moveToTrash( study ); 454 454 455 455 return null … … 501 501 } catch( ResourceNotFoundException e ) { 502 502 // Assay can't be found within GSCF. 503 // TODO: How to handle the data that remains 504 assay.delete() 503 trashService.moveToTrash( assay ); 505 504 return null 506 505 } catch( Exception e ) { // All other exceptions are thrown … … 511 510 } 512 511 513 // If new assay is empty, something went wrong512 // If new assay is empty, this means that the assay does exist, but now belongs to another module. Remove it from our system 514 513 if( newAssay.size() == 0 ) { 515 throw new Exception( "No data returned for assay " + assay.assayToken + " but no error has occurred either. Please contact your system administrator" ); 514 log.info( "No data is returned by GSCF for assay " + assay.assayToken + "; probably the assay is connected to another module." ) 515 trashService.moveToTrash( assay ); 516 516 return null; 517 517 } … … 577 577 } catch( ResourceNotFoundException e ) { 578 578 // Assay can't be found within GSCF. Samples will be removed 579 // TODO: How to handle the data that remains 580 assay.removeAssaySamples(); 579 trashService.moveToTrash( assay ); 581 580 582 581 return null … … 593 592 return [] 594 593 } 595 596 594 597 595 synchronizeAssaySamples( assay, newSamples ); … … 678 676 679 677 // The sample has been removed 680 // TODO: What to do with the data associated with this AssaySample (e.g. sequences)? See also GSCF ticket #255 681 existingSample.delete(); 682 assay.removeFromAssaySamples( existingSample ); 678 trashService.moveToTrash( existingSample.sample ); 683 679 } 684 680 }
Note: See TracChangeset
for help on using the changeset viewer.