source: trunk/grails-app/controllers/dbnp/query/QueryController.groovy @ 480

Last change on this file since 480 was 480, checked in by jahn, 13 years ago

Providing some methods for showing that REST/JSON actually works for the gscf.

  • Property svn:keywords set to Date Author Rev
File size: 3.2 KB
Line 
1package dbnp.query
2
3import org.compass.core.engine.SearchEngineQueryParseException
4
5import mytest.MyManager 
6
7/*
8 * Copyright 2007 the original author or authors.
9 *
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 *      http://www.apache.org/licenses/LICENSE-2.0
15 *
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 */
22
23
24/**
25 * Basic web interface for Grails Searchable Plugin
26 *
27 * @author Adem and Jahn
28 */
29class QueryController {
30
31    def searchableService
32
33    def index = {
34        redirect( action:'pages')
35    }
36
37        def results= {
38          println('query controller')
39        if (!params.q?.trim()) {
40            return [:]
41        }
42        try {
43            return [searchResult: searchableService.search(params.q, params)]
44        } catch (SearchEngineQueryParseException ex) {
45            return [parseException: true]
46        }
47    }
48
49    def pagesFlow = {
50       
51        onStart {
52                flow.page = 0
53                        flow.pages = [
54                                [title: 'Query'],
55                                [title: 'Study'],
56                                [title: 'Samples'],
57                                [title: 'Biomarkers'],
58                                [title: 'Groups'],
59                                [title: 'Done']
60                        ]
61        }
62
63        mainPage {
64
65             render( view:'/query/mainPage')
66
67             onRender {
68                println "done randering index"
69                flow.page=1
70             }
71             on("next") {
72                println "clicked next in sample"
73             } .to 'inputQuery'
74        }       
75
76        inputQuery {
77            render(view:'_inputQuery')
78            onRender {
79                flow.page=1
80            }
81        }
82
83        study {
84             render( view:'_study')
85            onRender {
86                flow.page=2
87             }
88             on("next") {
89                println "clicked next in sample"
90             } .to 'sample'
91             on("previous"){}.to 'inputQuery'
92        }
93
94        sample {
95             render( view:'_sample')
96            onRender {
97                flow.page=3
98             }
99             on("next") {
100                println "clicked next in sample"
101             } .to 'biomarker'
102             on("previous"){}.to 'study'
103        }
104
105
106        biomarker {
107             render( view:'_biomarker')
108            onRender {
109                flow.page=4
110             }
111             on("next") {
112                println "clicked next in sample"
113             } .to 'group'
114             on("previous"){}.to 'sample'
115        }
116
117        group {
118             render( view:'_group')
119            onRender {
120                flow.page=5
121             }
122             on("next") {
123                println "clicked next in sample"
124             } .to 'result'
125             on("previous"){}.to 'biomarkers'
126        }
127
128        result {
129             render( view:'_result')
130
131            onRender {
132                flow.page=6
133             }
134             on("previous"){}.to 'group'
135        }
136
137    }
138
139
140    def testo = {
141       render "Hello testo"
142       render MyManager.hello() 
143    }
144
145
146}
Note: See TracBrowser for help on using the repository browser.