Package jeeves.server

Examples of jeeves.server.UserSession


                        + "&");
            }
        }
        result.addContent(tmp);

        UserSession session = context.getUserSession();
        if (forward) {// If we have uuid parameters, forward to a clean url
            session.setProperty(Geonet.Session.METADATA_UUIDS, params);
            forwardTo(context, location, parameters.toString(), tabs);
        } else { // Maybe we come from a forward, let's restore uuids:
            result = (Element) session
                    .getProperty(Geonet.Session.METADATA_UUIDS);

            if (result != null) {
                session.removeProperty(Geonet.Session.METADATA_UUIDS);

                for (Object e : result.getChildren()) {
                    Element el = (Element) e;
                    if (el.getName().equalsIgnoreCase("tmp")) {
                        tmp = el;
View Full Code Here


    public Element serviceSpecificExec(Element params, ServiceContext context) throws Exception {
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        DataManager dm = gc.getBean(DataManager.class);
        AccessManager accessMan = gc.getBean(AccessManager.class);
        UserSession session = context.getUserSession();


        String targetUsr = Util.getParam(params, Params.USER);
        String targetGrp = Util.getParam(params, Params.GROUP);
View Full Code Here

      throws Exception {
   
    String type = Util.getParam(params, Params.TYPE, init_type );
   
    // Get the selection manager
    UserSession session = context.getUserSession();
    int nbSelected = SelectionManager.updateSelection(type, session, params, context);
   
    // send ok
    Element response = new Element(Jeeves.Elem.RESPONSE);
    response.addContent(new Element("Selected").setText(""+nbSelected));   
View Full Code Here

  public Element exec(Element params, ServiceContext context)
      throws Exception {

    // Get thesaurus manager
    Element response = new Element(Jeeves.Elem.RESPONSE);
    UserSession session = context.getUserSession();
    KeywordsSearcher searcher = (KeywordsSearcher)session.getProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT);   
   
    // get the results
    response.addContent(searcher.getSelectedKeywordsAsXml());

    return response;
View Full Code Here

        elData.addContent(new Element(Geonet.SearchResult.NORTH_BL).addContent(bounds[3]));
      }
    }
   
    // possibly close old searcher
    UserSession  session     = context.getUserSession();
    Object oldSearcher = session.getProperty(Geonet.Session.SEARCH_RESULT);
   
     if (oldSearcher != null)
       if (oldSearcher instanceof LuceneSearcher)
         ((LuceneSearcher)oldSearcher).close();
   
    // possibly close old selection
    SelectionManager oldSelection = (SelectionManager)session.getProperty(Geonet.Session.SELECTED_RESULT);
   
    if (oldSelection != null){
      oldSelection.close();
    }
   

    // perform the search and save search query into session
    MetaSearcher searcher;

    context.info("Creating searchers");

    if (remotesearcher = searchMan.newSearcher(SearchManager.Z3950,  Geonet.File.SEARCH_Z3950_CLIENT);
    else        searcher = searchMan.newSearcher(SearchManager.LUCENE, Geonet.File.SEARCH_LUCENE);

    searcher.search(context, elData, _config);
    if (remote && (searcher.getSize() == 0)) { // do it again for Z3950
      searcher.search(context, elData, _config);
    }
    session.setProperty(Geonet.Session.SEARCH_RESULT, searcher);
    session.removeProperty(Geonet.Session.SEARCH_REQUEST);
    context.info("Getting summary");

    return searcher.getSummary();
  }
View Full Code Here

    Element elData  = SearchDefaults.getDefaultSearch(context, params);
    String  sRemote = elData.getChildText(Geonet.SearchResult.REMOTE);
    boolean remote  = sRemote != null && sRemote.equals(Geonet.Text.ON);

    // possibly close old searcher
    UserSession  session     = context.getUserSession();
   
    // perform the search and save search result into session
    MetaSearcher searcher;
    context.info("Creating searchers");
   
        if(remote) {
      searcher = searchMan.newSearcher(SearchManager.Z3950,  Geonet.File.SEARCH_Z3950_CLIENT);
        } else {
      searcher = searchMan.newSearcher(SearchManager.LUCENE, Geonet.File.SEARCH_LUCENE);
        }
   
    try {
     
      // Check is user asked for summary only without building summary
      String summaryOnly = Util.getParam(params, Geonet.SearchResult.SUMMARY_ONLY, "0");
      String sBuildSummary = params.getChildText(Geonet.SearchResult.BUILD_SUMMARY);
            if(sBuildSummary != null && sBuildSummary.equals("false") && ! "0".equals(summaryOnly)) {
        elData.getChild(Geonet.SearchResult.BUILD_SUMMARY).setText("true");
            }
     
      session.setProperty(Geonet.Session.SEARCH_REQUEST, elData.clone());
      searcher.search(context, elData, _config);
 
      if (!"0".equals(summaryOnly)) {
        return searcher.getSummary();
      } else {
View Full Code Here

     * @throws Exception
     */
  public Element getMetadataEmbedded(ServiceContext srvContext, String id, boolean forEditing, boolean withValidationErrors) throws Exception {
      boolean keepXlinkAttributes = false;
    Element md = dataManager.getMetadata(srvContext, id, forEditing, withValidationErrors, keepXlinkAttributes);
    UserSession session = srvContext.getUserSession();
    setMetadataIntoSession(session, md, id);
    return md;
  }
View Full Code Here

    public void init(String appPath, ServiceConfig params) throws Exception {
    }

    public Element exec(Element params, ServiceContext context) throws Exception {
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        UserSession session = context.getUserSession();

        // Retrieve thesaurus
        String sThesaurusName = Util.getParam(params, "pThesaurus");
        ThesaurusManager thesaurusMan = gc.getBean(ThesaurusManager.class);
        Thesaurus thesaurus = thesaurusMan.getThesaurusByName(sThesaurusName);

        // Optional keyword info - if none, selection is used
        String code = Util.getParam(params, "id", "");

        if ("".equals(code)) {
            KeywordsSearcher searcher = (KeywordsSearcher) session
                    .getProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT);
            List<?> keywords = searcher.getSelectedKeywordsInList();

            Iterator<?> iter = keywords.iterator();
            while (iter.hasNext()) {
View Full Code Here

  //--------------------------------------------------------------------------

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    // build result data
    UserSession session = context.getUserSession();

    MetaSearcher searcher = (MetaSearcher) session.getProperty(Geonet.Session.SEARCH_RESULT);

        String fast = _config.getValue("fast","");

        if (StringUtils.isNotEmpty(fast)) {
            params.addContent(new Element("fast").setText(fast));
        }

    String range = _config.getValue("range");

    if (range != null)
      if (range.equals("all"))
      {
        params.addContent(new Element("from").setText("1"));
        params.addContent(new Element("to").setText(searcher.getSize() +""));
      } else {
        params.addContent(new Element("from").setText("1"));
        params.addContent(new Element("to").setText(range));
      }


    Element result = searcher.present(context, params, _config);

    // Update result elements to present
    SelectionManager.updateMDResult(context.getUserSession(), result);

    // Restore last search if set
    String restoreLastSearch = params.getChildText(Geonet.SearchResult.RESTORELASTSEARCH);
    if (restoreLastSearch != null && restoreLastSearch.equals("yes")) {
      Object oldSearcher = session.getProperty(Geonet.Session.LAST_SEARCH_RESULT);
      if (oldSearcher != null) {
        context.info("Restoring last search");
        if (oldSearcher instanceof LuceneSearcher) ((LuceneSearcher)searcher).close();
        session.setProperty(Geonet.Session.SEARCH_RESULT, oldSearcher);
      }
    }
    return result;
  }
View Full Code Here

  // --------------------------------------------------------------------------

  public Element exec(Element params, ServiceContext context)
      throws Exception {
    Element response = new Element(Jeeves.Elem.RESPONSE);
    UserSession session = context.getUserSession();

    KeywordsSearcher searcher = null;
   
    boolean newSearch = Util.getParam(params, "pNewSearch").equals("true");
    if (newSearch) {     
      // perform the search and save search result into session
      GeonetContext gc = (GeonetContext) context
          .getHandlerContext(Geonet.CONTEXT_NAME);
      ThesaurusManager thesaurusMan = gc.getBean(ThesaurusManager.class);

            if(Log.isDebugEnabled("KeywordsManager")) Log.debug("KeywordsManager","Creating new keywords searcher");
      searcher = new KeywordsSearcher(context, thesaurusMan);
      searcher.search(context.getLanguage(), params);
      searcher.sortResults(KeywordSort.defaultLabelSorter(SortDirection.DESC));
      session
          .setProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT,
              searcher);
    } else {
      searcher = (KeywordsSearcher) session
          .getProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT);
    }

    // get the results
    response.addContent(searcher.getXmlResults());
View Full Code Here

TOP

Related Classes of jeeves.server.UserSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.