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: * Select a list of keywords stored in session
37: * Returns status
38: */
39:
40: public class SelectKeywords implements Service {
41: public void init(String appPath, ServiceConfig params)
42: throws Exception {
43: }
44:
45: // --------------------------------------------------------------------------
46: // ---
47: // --- Service
48: // ---
49: // --------------------------------------------------------------------------
50:
51: public Element exec(Element params, ServiceContext context)
52: throws Exception {
53:
54: // Recupération du thesaurus manager
55: Element response = new Element(Jeeves.Elem.RESPONSE);
56: UserSession session = context.getUserSession();
57: KeywordsSearcher searcher = (KeywordsSearcher) session
58: .getProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT);
59:
60: searcher.selectUnselectKeywords(params);
61:
62: // send ok
63: response.addContent(new Element("ok"));
64:
65: return response;
66: }
67: }
68:
69: // =============================================================================
|