Package jeeves.server

Examples of jeeves.server.UserSession


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

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

    if (!session.isAuthenticated()) {
      return new Element(Geonet.Elem.GROUPS);
        }

    //--- retrieve user groups

    if (Profile.Administrator == session.getProfile()) {
      return context.getBean(GroupRepository.class).findAllAsXml(not(GroupSpecs.isReserved()));
    } else {

            final UserGroupRepository userGroupRepository = context.getBean(UserGroupRepository.class);
            int userId = session.getUserIdAsInt();
            Specifications<UserGroup> spec = where(UserGroupSpecs.isReservedGroup(false)).and(UserGroupSpecs.hasUserId(userId));

      if (profile != null) {
                spec = spec.and(UserGroupSpecs.hasProfile(Profile.findProfileIgnoreCase(profile)));
            }
View Full Code Here


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

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    UserSession session = context.getUserSession();
   
    Element results = new Element("results");
   
    Object searcher = session.getProperty(Geonet.Session.SEARCH_RESULT);
   
    if (searcher != null)
      if (searcher instanceof LuceneSearcher)
        results.setText(((LuceneSearcher)searcher).getSize()+"");
    return results;
View Full Code Here

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

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

    String data = (String) session.getProperty(Geonet.Session.METADATA_POSITION);

    if (data == null || data.equals(""))
    {
      context.info("Creating default metadata position");
      data = "0";
      session.setProperty(Geonet.Session.METADATA_POSITION, data);
    }
    return new Element("a").setText(data);
  }
View Full Code Here

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

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    UserSession session = context.getUserSession();
    String currentTab = (String) session.getProperty(sessionTabProperty);

    if (currentTab == null) {
      context.info("Creating default metadata tab");

            GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
            String defaultView = gc.getBean(SettingManager.class).getValue("system/metadata/defaultView");
            currentTab = (defaultView != null?defaultView:"simple");

            session.setProperty(sessionTabProperty, currentTab);
    }
    return new Element("a").setText(currentTab);
  }
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 = (KeywordsSearcher)session.getProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT);

    searcher.selectUnselectKeywords(params);
   
    // send ok   
    response.addContent(new Element("ok"));   
View Full Code Here

  //--- Buttons building
  //--------------------------------------------------------------------------

  private Element getUserInfo(ServiceContext srvContext)
  {
    UserSession session = srvContext.getUserSession();

    return new Element("user")
              .addContent(new Element("username").setText(session.getUsername()))
              .addContent(new Element("name")    .setText(session.getName()))
              .addContent(new Element("surname") .setText(session.getSurname()));
  }
View Full Code Here

        boolean resolveXlink = Boolean.parseBoolean(Util.getParam(params, "resolveXlink", "true"));
        boolean removeXlinkAttribute = Boolean.parseBoolean(Util.getParam(params, "removeXlinkAttribute", "true"));
    String relatedMetadataRecord = Util
        .getParam(params, "relation", "true");

    UserSession session = context.getUserSession();

    Log.info(Geonet.MEF, "Create export task for selected metadata(s).");
    SelectionManager selectionManger = SelectionManager.getManager(session);
    Set<String> uuids = selectionManger
        .getSelection(SelectionManager.SELECTION_METADATA);
View Full Code Here

    SearchManager searchMan = gc.getBean(SearchManager.class);

    String restoreLastSearch = _config.getValue("restoreLastSearch","no");

    // store or possibly close old searcher
    UserSession  session     = context.getUserSession();
    Object oldSearcher = session.getProperty(Geonet.Session.SEARCH_RESULT);

    if (oldSearcher != null) {
      if (restoreLastSearch.equals("yes")) {
        session.setProperty(Geonet.Session.LAST_SEARCH_RESULT, oldSearcher);
      } else {
        if (oldSearcher instanceof LuceneSearcher) ((LuceneSearcher)oldSearcher).close();
      }
    }

    context.info("Get selected metadata");
    SelectionManager sm = SelectionManager.getManager(session) ;

    // Get the sortBy params in order to apply on new result list.
        if (StringUtils.isNotEmpty(params.getChildText(Geonet.SearchResult.SORT_BY)) ) {
            params.addContent(new Element(Geonet.SearchResult.SORT_BY).setText(params.getChildText(Geonet.SearchResult.SORT_BY)));
        }

        if (StringUtils.isNotEmpty(params.getChildText(Geonet.SearchResult.SORT_ORDER))) {
            params.addContent(new Element(Geonet.SearchResult.SORT_ORDER).setText(params.getChildText(Geonet.SearchResult.SORT_ORDER)));
        }
       
    if (sm != null) {
      String uuids= "";
      boolean first = true;
      synchronized(sm.getSelection("metadata")) {
        for (Iterator<String> iter = sm.getSelection("metadata").iterator(); iter.hasNext();) {
          String uuid = (String) iter.next();
          if (first) {
            uuids = (String) uuid;
            first = false;
          }
          else
            uuids = uuids +" or "+ uuid;
        }
      }
            if(context.isDebugEnabled())
                context.debug("List of selected uuids: " + uuids);
      params.addContent(new Element(Geonet.SearchResult.UUID).setText(uuids));

    }
   
    // perform the search and save search result into session
    MetaSearcher searcher;

    context.info("Creating searchers");

    searcher = searchMan.newSearcher(SearchManager.LUCENE, Geonet.File.SEARCH_LUCENE);

    searcher.search(context, params, _config);

    session.setProperty(Geonet.Session.SEARCH_RESULT, searcher);

    context.info("Getting summary");
   
    Element summary = searcher.getSummary();
    summary.addContent(new Element(Geonet.SearchResult.RESTORELASTSEARCH).setText(restoreLastSearch));
View Full Code Here

   
    if (!id.equals("") || !uri.equals("")) {
      KeywordBean kb = null;
     
      if (!id.equals("")){
        UserSession session = context.getUserSession();
        KeywordsSearcher searcher = (KeywordsSearcher) session
          .getProperty(Geonet.Session.SEARCH_KEYWORDS_RESULT);
        kb = searcher.getKeywordFromResultsById(id);
      }else{
        GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
        ThesaurusManager thesaurusMan = gc.getBean(ThesaurusManager.class);
View Full Code Here

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

    Set<Integer> metadata = new HashSet<Integer>();
    Set<Integer> notFound = new HashSet<Integer>();
    Set<Integer> notOwner = new HashSet<Integer>();
    Set<Integer> subtemplates = new HashSet<Integer>();
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.