01: //=== Copyright (C) 2001-2005 Food and Agriculture Organization of the
02: //=== United Nations (FAO-UN), United Nations World Food Programme (WFP)
03: //=== and United Nations Environment Programme (UNEP)
04: //===
05: //=== This program is free software; you can redistribute it and/or modify
06: //=== it under the terms of the GNU General Public License as published by
07: //=== the Free Software Foundation; either version 2 of the License, or (at
08: //=== your option) any later version.
09: //===
10: //=== This program is distributed in the hope that it will be useful, but
11: //=== WITHOUT ANY WARRANTY; without even the implied warranty of
12: //=== MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: //=== General Public License for more details.
14: //===
15: //=== You should have received a copy of the GNU General Public License
16: //=== along with this program; if not, write to the Free Software
17: //=== Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: //===
19: //=== Contact: Jeroen Ticheler - FAO - Viale delle Terme di Caracalla 2,
20: //=== Rome - Italy. email: GeoNetwork@fao.org
21: //==============================================================================
22:
23: package org.fao.geonet.services.thesaurus;
24:
25: import jeeves.constants.Jeeves;
26: import jeeves.interfaces.Service;
27: import jeeves.server.ServiceConfig;
28: import jeeves.server.UserSession;
29: import jeeves.server.context.ServiceContext;
30:
31: import org.fao.geonet.constants.Geonet;
32: import org.fao.geonet.kernel.search.KeywordsSearcher;
33: import org.jdom.Element;
34:
35: /**
36: * Returns the list of selected keywords
37: */
38:
39: public class GetSelectedKeywords implements Service {
40: public void init(String appPath, ServiceConfig params)
41: throws Exception {
42: }
43:
44: // --------------------------------------------------------------------------
45: // ---
46: // --- Service
47: // ---
48: // --------------------------------------------------------------------------
49:
50: public Element exec(Element params, ServiceContext context)
51: throws Exception {
52:
53: // Recupération du thesaurus manager
54: Element response = new Element(Jeeves.Elem.RESPONSE);
55: UserSession session = context.getUserSession();
56: KeywordsSearcher searcher = (KeywordsSearcher) session
57: .getProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT);
58:
59: // get the results
60: response.addContent(searcher.getSelectedKeywords());
61:
62: return response;
63: }
64: }
65:
66: // =============================================================================
|