- Timestamp:
- Jan 31, 2011, 8:16:03 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/query/AdvancedQueryController.groovy
r1456 r1458 1 1 package dbnp.query 2 import dbnp.modules.* 3 import org.dbnp.gdt.* 2 4 3 5 // TODO: Make use of the searchable-plugin possibilities instead of querying the database directly … … 9 11 */ 10 12 class AdvancedQueryController { 13 def moduleCommunicationService; 14 11 15 def entitiesToSearchFor = [ 'Study': 'Studies', 'Sample': 'Samples'] 12 16 def index = { … … 56 60 def fields = [:]; 57 61 62 // Retrieve all local search fields 58 63 getEntities().each { 59 64 def entity = getEntity( 'dbnp.studycapturing.' + it ); … … 66 71 67 72 fields[ it ] = fieldNames.sort { a, b -> a[0].toUpperCase() + a[1..-1] <=> b[0].toUpperCase() + b[1..-1] }; 73 } 74 } 75 76 // Loop through all modules and check which fields are searchable 77 // Right now, we just combine the results for different entities 78 AssayModule.list().each { module -> 79 def callUrl = module.url + '/rest/getQueryableFields' 80 try { 81 def json = moduleCommunicationService.callModuleRestMethodJSON( module.url, callUrl ); 82 def moduleFields = []; 83 entitiesToSearchFor.each { entity -> 84 if( json[ entity.key ] ) { 85 json[ entity.key ].each { field -> 86 moduleFields << field.toString(); 87 } 88 } 89 } 90 91 // Remove 'module' from module name 92 def moduleName = module.name.replace( 'module', '' ).trim() 93 94 fields[ moduleName ] = moduleFields.unique(); 95 } catch( Exception e ) { 96 log.error( "Error while retrieving queryable fields from " + module.name + ": " + e.getMessage() ) 68 97 } 69 98 }
Note: See TracChangeset
for help on using the changeset viewer.