Package org.openmeetings.app.persistence.beans.basic

Examples of org.openmeetings.app.persistence.beans.basic.Sessiondata


        log.error("Could not find session to update: " + SID);
        return false;
      } else {
        // log.error("Found session to update: "+SID);
      }
      Sessiondata sd = (Sessiondata) fullList.get(0);
      // log.debug("Found session to update: "+sd.getSession_id()+
      // " userId: "+USER_ID);

      sd.setRefresh_time(new Date());
      sd.setSessionXml(sessionXml);

      idf = PersistenceSessionUtil.createSession();
      session = PersistenceSessionUtil.getSession();
      tx = session.getTransaction();
      tx.begin();

      // session.refresh(sd);

      session.flush();
      if (sd.getId() == null) {
        session.persist(sd);
      } else {
        if (!session.contains(sd)) {
          session.merge(sd);
        }
View Full Code Here


      if (fullList.size() == 0) {
        log.error("Found NO session to updateSession: ");

      } else {
        // log.debug("Found session to updateSession: ");
        Sessiondata sd = (Sessiondata) fullList.iterator().next();
        // log.debug("Found session to updateSession sd "+sd.getUser_id()+" "+sd.getSession_id());
        sd.setRefresh_time(new Date());

        Object idf2 = PersistenceSessionUtil.createSession();
        EntityManager session2 = PersistenceSessionUtil.getSession();
        EntityTransaction tx2 = session2.getTransaction();
        tx2.begin();
        if (sd.getId() == null) {
          session2.persist(sd);
        } else {
          if (!session2.contains(sd)) {
            session2.merge(sd);
          }
View Full Code Here

      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
      for (Iterator it = l.iterator(); it.hasNext();) {
        Sessiondata sData = (Sessiondata) it.next();
        sData = session.find(Sessiondata.class, sData.getId());
        session.remove(sData);
      }
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
View Full Code Here

        int end_pos = init_pos + 32;
        if (end_pos > aux.length())
          end_pos = aux.length();
        String SID = aux.substring(init_pos, end_pos);

        Sessiondata sData = this.getSessionByHash(SID);

        Object idf = PersistenceSessionUtil.createSession();
        EntityManager session = PersistenceSessionUtil.getSession();
        EntityTransaction tx = session.getTransaction();
        tx.begin();
        sData = session.find(Sessiondata.class, sData.getId());
        session.remove(sData);
        PersistenceSessionUtil.closeSession(idf);
      }

    } catch (Exception err) {
View Full Code Here

      System.out.println("startsession :: startsession");
      log.debug("startsession :: startsession");

      long thistime = new Date().getTime();
      Sessiondata sessiondata = new Sessiondata();
      sessiondata.setSession_id(ManageCryptStyle.getInstance()
          .getInstanceOfCrypt()
          .createPassPhrase(String.valueOf(thistime).toString()));
      sessiondata.setRefresh_time(new Date());
      sessiondata.setStarttermin_time(new Date());
      sessiondata.setUser_id(null);

      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();
View Full Code Here

        return null;
      } else {
        // log.error("Found session to update: "+SID);
      }

      Sessiondata sd = (Sessiondata) fullList.get(0);

      return sd;
    } catch (Exception ex2) {
      log.error("[updateUser]: ", ex2);
    }
View Full Code Here

      List<Sessiondata> sessions = query.getResultList();
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);

      Sessiondata sessiondata = null;
      if (sessions != null && sessions.size() > 0) {
        sessiondata = sessions.get(0);
      }

      // if (sessiondata!=null) {
      // log.debug("checkSession USER_ID: "+sessiondata.getUser_id());
      // } else {
      // log.debug("Session IS NULL SID: "+SID);
      // }

      // Update the Session Object
      if (sessiondata != null)
        updatesession(SID);

      // Checks if wether the Session or the User Object of that Session
      // is set yet
      if (sessiondata == null || sessiondata.getUser_id() == null
          || sessiondata.getUser_id().equals(new Long(0))) {
        return new Long(0);
      } else {
        return sessiondata.getUser_id();
      }
    } catch (Exception ex2) {
      log.error("[checkSession]: ", ex2);
    }
    return null;
View Full Code Here

      List<Sessiondata> sessions = query.getResultList();
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);

      Sessiondata sessiondata = null;
      if (sessions != null && sessions.size() > 0) {
        sessiondata = sessions.get(0);
      }

      if (sessiondata == null) {
        log.error("Could not find session to Update");
        return false;
      }
      log.debug("Found session to update: " + sessiondata.getSession_id()
          + " userId: " + USER_ID);

      idf = PersistenceSessionUtil.createSession();
      session = PersistenceSessionUtil.getSession();
      tx = session.getTransaction();
      tx.begin();
      sessiondata.setRefresh_time(new Date());
      // session.refresh(sd);
      sessiondata.setUser_id(USER_ID);
      if (sessiondata.getId() == null) {
        session.persist(sessiondata);
      } else {
        if (!session.contains(sessiondata)) {
          session.merge(sessiondata);
        }
View Full Code Here

  }

  public Users loginUserByRemoteHash(String SID, String remoteHash) {
    try {

      Sessiondata sessionData = Sessionmanagement.getInstance()
          .getSessionByHash(remoteHash);

      if (sessionData != null) {

        Users u = Usermanagement.getInstance().getUserById(
            sessionData.getUser_id());

        Sessionmanagement.getInstance().updateUserWithoutSession(SID,
            u.getUser_id());

        return u;
View Full Code Here

      Long user_level = Usermanagement.getInstance().getUserLevelByID(
          users_id);
      if (AuthLevelmanagement.getInstance().checkWebServiceLevel(
          user_level)) {

        Sessiondata sd = Sessionmanagement.getInstance()
            .getSessionByHash(SID);
        if (sd == null || sd.getSessionXml() == null) {
          return new Long(-37);
        } else {

          // XStream xStream = new XStream(new XppDriver());
          XStream xStream = new XStream(new DomDriver("UTF-8"));
          xStream.setMode(XStream.NO_REFERENCES);

          String xmlString = sd.getSessionXml();
          RemoteSessionObject userObject = (RemoteSessionObject) xStream
              .fromXML(xmlString);

          log.debug("userObject.getUsername(), userObject.getFirstname(), userObject.getLastname() "
              + userObject.getUsername()
View Full Code Here

TOP

Related Classes of org.openmeetings.app.persistence.beans.basic.Sessiondata

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.