- Timestamp:
- Feb 16, 2011, 11:12:14 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/query/AdvancedQueryController.groovy
r1524 r1526 15 15 def authenticationService 16 16 17 def entitiesToSearchFor = [ 'Study': 'Studies', 'Sample': 'Samples' ]17 def entitiesToSearchFor = [ 'Study': 'Studies', 'Sample': 'Samples', 'Assay': 'Assays'] 18 18 19 19 /** … … 198 198 199 199 if( queryIds.size() == 0 ) { 200 flash.error = "Incorrect search ID given to s how"201 redirect( action: " index" );200 flash.error = "Incorrect search ID given to search in" 201 redirect( action: "list" ); 202 202 return 203 203 } … … 287 287 case "Study": return "studyresults"; break; 288 288 case "Sample": return "sampleresults"; break; 289 case "Assay": return "assayresults"; break; 289 290 default: return "results"; break; 290 291 } … … 298 299 case "Study": return new StudySearch(); 299 300 case "Sample": return new SampleSearch(); 300 301 case "Assay": return new AssaySearch(); 302 301 303 // This exception will only be thrown if the entitiesToSearchFor contains more entities than 302 304 // mentioned in this switch structure. … … 375 377 // Loop through all keys of c and remove the non-numeric ones 376 378 for( c in formCriteria ) { 377 if( c.key ==~ /[0-9]+/ ) {379 if( c.key ==~ /[0-9]+/ && c.value.entityfield ) { 378 380 def formCriterion = c.value; 379 381 … … 478 480 479 481 // First check whether a search with the same criteria is already present 480 def previousSearch = retrieveSearch ByCriteria( s.getCriteria(), s.searchMode);482 def previousSearch = retrieveSearch( s ); 481 483 482 484 def id … … 496 498 /** 497 499 * Retrieves a search from session with the same criteria as given 498 * @param criteria List of criteriato search for500 * @param s Search that is used as an example to search for 499 501 * @return Search that has this criteria, or null if no such search is found. 500 502 */ 501 protected Search retrieveSearch ByCriteria( List criteria, SearchMode searchMode = SearchMode.and) {503 protected Search retrieveSearch( Search s ) { 502 504 if( !session.queries ) 503 505 return null 504 506 505 if( !criteria )506 return null507 508 507 for( query in session.queries ) { 509 def key = query.key;510 508 def value = query.value; 511 509 512 if( value.searchMode == searchMode && value.criteria && value.criteria.containsAll( criteria ) && criteria.containsAll( value.criteria ) ) { 513 return value; 514 } 510 if( s.equals( value ) ) 511 return value 515 512 } 516 513
Note: See TracChangeset
for help on using the changeset viewer.