Package jeeves.server

Examples of jeeves.server.UserSession


  public Element exec(Element params, ServiceContext context) throws Exception
  {
    Element elCurrTab = params.getChild(Params.CURRTAB);
    if (elCurrTab != null)
    {
      UserSession session = context.getUserSession();
      session.setProperty(Geonet.Session.METADATA_SHOW, elCurrTab.getText());
    }
    // build result data
    MetaSearcher searcher = (MetaSearcher) context.getUserSession().getProperty(Geonet.Session.SEARCH_RESULT);
    return searcher.get(context, params, _config);
  }
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);
    UserSession   us = context.getUserSession();

    String id = Utils.getIdentifierFromParameters(params, context);
    boolean update = Util.getParam(params, Params.UPDATEONLY, "false").equals("true");

    //-----------------------------------------------------------------------
    //--- check access

    Metadata info = context.getBean(MetadataRepository.class).findOne(id);

    if (info == null)
      throw new MetadataNotFoundEx(id);

    //-----------------------------------------------------------------------
    //--- remove old operations

    boolean skip = false;

    //--- in case of owner, privileges for groups 0,1 and GUEST are disabled
    //--- and are not sent to the server. So we cannot remove them

    boolean isAdmin   = Profile.Administrator == us.getProfile();
    boolean isReviewer= Profile.Reviewer == us.getProfile();


    if (us.getUserIdAsInt() == info.getSourceInfo().getOwner() && !isAdmin && !isReviewer) {
      skip = true;
        }

    if (!update) {
      dm.deleteMetadataOper(context, id, skip);
View Full Code Here

      // Log.debug(Log.REQUEST, "Server port  : "+ req.getServerPort());
    }

    if (Log.isDebugEnabled(Log.REQUEST))
      Log.debug(Log.REQUEST, "Session id is " + httpSession.getId());
    UserSession session = (UserSession) httpSession
        .getAttribute(USER_SESSION_ATTRIBUTE_KEY);

    if (session == null) {
      // --- create session

      session = new UserSession();

      httpSession.setAttribute(USER_SESSION_ATTRIBUTE_KEY, session);
      session.setsHttpSession(httpSession);

      if (Log.isDebugEnabled(Log.REQUEST))
        Log.debug(Log.REQUEST, "Session created for client : " + ip);
    }
View Full Code Here

        super.init(appPath, params);
  }

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

        boolean witholdWithheldElements = Util.getParam(params, "hide_withheld", false);
        if (witholdWithheldElements) {
           XmlSerializer.getThreadLocal(true).setForceFilterEditOperation(witholdWithheldElements);
        }

    // -----------------------------------------------------------------------
    // --- handle current tab

    Element elCurrTab = params.getChild(Params.CURRTAB);

    if (elCurrTab != null)
      session.setProperty(Geonet.Session.METADATA_SHOW,
          elCurrTab.getText());

    // -----------------------------------------------------------------------
    // --- check access
View Full Code Here

  public Element exec(Element params, ServiceContext context) throws Exception
  {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME);
    DataManager   dm   = gc.getBean(DataManager.class);
    UserSession session = context.getUserSession();

    String id = Utils.getIdentifierFromParameters(params, context);
    String access = Util.getParam(params, Params.ACCESS, Params.Access.PUBLIC);

    //--- resource required is public (thumbnails)
    if (access.equals(Params.Access.PUBLIC)) {
      File dir = new File(Lib.resource.getDir(context, access, id));
      String fname = Util.getParam(params, Params.FNAME);

      if (fname.contains("..")) {
        throw new BadParameterEx("Invalid character found in resource name.", fname);
      }
     
      File file = new File(dir, fname);
      return BinaryFile.encode(200, file.getAbsolutePath(),false);
    }

    //--- from here on resource required is private datafile(s)

    //--- check if disclaimer for this metadata has been displayed
    Element elData = (Element) session.getProperty(Geonet.Session.FILE_DISCLAIMER);
    if (elData == null) {
      return new Element("response");
    } else {
      String idAllowed = elData.getChildText(Geonet.Elem.ID);
      if (idAllowed == null || !idAllowed.equals(id)) {
        return new Element("response");
      }
    }

    //--- check whether notify is required
    boolean doNotify = false;
    Lib.resource.checkPrivilege(context, id, ReservedOperation.download);
    doNotify = true;

    //--- set username for emails and logs
    String username = session.getUsername();
    if (username == null) username = "internet";
    String userId  = session.getUserId();

    //--- get feedback/reason for download info passed in & record in 'entered'
//    String name     = Util.getParam(params, Params.NAME);
//    String org      = Util.getParam(params, Params.ORG);
//    String email    = Util.getParam(params, Params.EMAIL);
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);
    AccessManager accessMan = gc.getBean(AccessManager.class);
    UserSession   session   = context.getUserSession();

    Set<Integer> metadata = new HashSet<Integer>();
    Set<Integer> notFound = new HashSet<Integer>();
    Set<Integer> notOwner = new HashSet<Integer>();
        boolean backupFile = Util.getParam(params, Params.BACKUP_FILE, true);
View Full Code Here

        Element license = Xml.transform(root, licenseAnnexXslt);
        response.addContent(new Element("license").addContent(license));

        //--- Now set the id into the users session so that future services can do
        //--- the download
        UserSession session = context.getUserSession();
        Element resourceData = (Element) session.getProperty(Geonet.Session.FILE_DISCLAIMER);
        if (resourceData == null) {
            resourceData = new Element(Geonet.Session.FILE_DISCLAIMER);
            addElement(resourceData, Params.ID, id);
        } else {
            Element idEl = resourceData.getChild(Params.ID);
            if (idEl == null) addElement(resourceData, Params.ID, id);
            else idEl.setText(id);
        }
        session.setProperty(Geonet.Session.FILE_DISCLAIMER, resourceData);

        //--- now get the users name, organisation and email address to
        //--- prepopulate the feedback form (if they are logged in)
        if (session.getUserId() != null) {
            User user = context.getBean(UserRepository.class).findOne(session.getUserIdAsInt());
            if (user != null) {
                Element elRec = user.asXml();
                elBrief.setName("record");
                response.addContent(elRec.cloneContent());
            }
View Full Code Here

        editLib = new EditLib(schemaMan);
        dataDir = _applicationContext.getBean(GeonetworkDataDirectory.class).getSystemDataDir();
        thesaurusDir = _applicationContext.getBean(ThesaurusManager.class).getThesauriDirectory();

        if (context.getUserSession() == null) {
            UserSession session = new UserSession();
            context.setUserSession(session);
            session.loginAs(new User().setUsername("admin").setId(-1).setProfile(Profile.Administrator));
        }
        // get lastchangedate of all metadata in index
        Map<String,String> docs = searchMan.getDocsChangeDate();

        // set up results HashMap for post processing of records to be indexed
View Full Code Here

                                                      boolean clearXlink)
            throws Exception {

        // get all metadata ids from selection
        ArrayList<String> listOfIdsToIndex = new ArrayList<String>();
        UserSession session = context.getUserSession();
        SelectionManager sm = SelectionManager.getManager(session);

        synchronized (sm.getSelection("metadata")) {
            for (Iterator<String> iter = sm.getSelection("metadata").iterator();
                 iter.hasNext(); ) {
View Full Code Here

     * @param id
     * @throws Exception
     */
    public void cancelEditingSession(ServiceContext context,
        String id) throws Exception {
        UserSession session = context.getUserSession();
        Element metadataBeforeAnyChanges = (Element) session.getProperty(Geonet.Session.METADATA_BEFORE_ANY_CHANGES + id);
       
        if(Log.isDebugEnabled(Geonet.EDITOR_SESSION)) {
              Log.debug(Geonet.EDITOR_SESSION,
                  "Editing session end. Cancel changes. Restore record " + id +
                  ". Replace by original record which was: ");
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.