Package org.apache.openmeetings.db.entity.user

Examples of org.apache.openmeetings.db.entity.user.User


    Root<User> c = cq.from(User.class);
    Predicate condition = cb.equal(c.get("deleted"), false);
    Predicate subCondition = cb.equal(c.get("login"), login);
    cq.where(condition, subCondition);
    TypedQuery<User> q = em.createQuery(cq);
    User u = null;
    try {
      u = q.getSingleResult();
    } catch (NoResultException e) {
      // u=null}
    }
View Full Code Here


      log.debug("resetUser " + email);

      // check if Mail given
      if (email.length() > 0) {
        // log.debug("getAdresses_id "+addr_e.getAdresses_id());
        User us = userDao.getUserByEmail(email);
        if (us != null) {
          sendHashByUser(us, appLink, userDao);
          return new Long(-4);
        } else {
          return new Long(-9);
        }
      } else if (username.length() > 0) {
        User us = userDao.getUserByName(username);
        if (us != null) {
          sendHashByUser(us, appLink, userDao);
          return new Long(-4);
        } else {
          return new Long(-3);
View Full Code Here

   *            the timezone of the current user is copied to the new default
   *            one (if the current user has one)
   * @return
   */
  public User getNewUserInstance(User currentUser) {
    User user = new User();
    user.setSalutations_id(1L); // TODO: Fix default selection to be
                  // configurable
    user.setLevel_id(1L);
    user.setLanguage_id(cfgDao.getConfValue(CONFIG_DEFAUT_LANG_KEY, Long.class, "1"));
    user.setTimeZoneId(timezoneUtil.getTimeZone(currentUser).getID());
    user.setForceTimeZoneCheck(false);
    user.setSendSMS(false);
    user.setAge(new Date());
    Address adresses = new Address();
    adresses.setStates(stateDaoImpl.getStateById(1L));
    user.setAdresses(adresses);
    user.setStatus(1);
    user.setShowContactData(false);
    user.setShowContactDataToContacts(false);

    return user;
  }
View Full Code Here

  // TODO: Why the password field is not set via the Model is because its
  // FetchType is Lazy, this extra hook here might be not needed with a
  // different mechanism to protect the password from being read
  // sebawagner, 01.10.2012
  public User update(User user, String password, long updatedBy) throws NoSuchAlgorithmException {
    User u = update(user, updatedBy);
    if (password != null && !password.isEmpty()) {
      //OpenJPA is not allowing to set fields not being fetched before
      User u1 = get(u.getUser_id(), true);
      u1.updatePassword(cfgDao, password);
      update(u1, updatedBy);
    }
    return u;
  }
View Full Code Here

    if (user_id > 0) {
      TypedQuery<User> query = em.createNamedQuery("getUserById",
          User.class);
      query.setParameter("user_id", user_id);

      User users = null;
      try {
        if (force) {
          @SuppressWarnings("unchecked")
          OpenJPAQuery<User> kq = OpenJPAPersistence.cast(query);
          kq.getFetchPlan().addFetchGroup("backupexport");
View Full Code Here

  }

  public Long deleteUserID(long userId) {
    try {
      if (userId != 0) {
        User us = get(userId);
        for (Organisation_Users ou : us.getOrganisation_users()){
          em.remove(ou);
        }
        us.setOrganisation_users(null);
        us.setDeleted(true);
        us.setUpdatetime(new Date());
        us.setSipUser(null);
        Address adr = us.getAdresses();
        if (adr != null) {
          adr.setDeleted(true);
        }

        if (us.getUser_id() == null) {
          em.persist(us);
        } else {
          if (!em.contains(us)) {
            em.merge(us);
          }
        }
        return us.getUser_id();
      }
    } catch (Exception ex2) {
      log.error("[deleteUserID]", ex2);
    }
    return null;
View Full Code Here

    return count == 0;
  }
 
  public User getUserByName(String login) {
    User us = null;
    try {
      us = em.createNamedQuery("getUserByLogin", User.class)
          .setParameter("login", login)
          .setParameter("type", User.Type.user)
          .getSingleResult();
View Full Code Here

    }
    return us;
  }

  public User getUserByEmail(String email) {
    User us = null;
    try {
      us = em.createNamedQuery("getUserByEmail", User.class)
          .setParameter("email", email)
          .setParameter("type", User.Type.user)
          .getSingleResult();
View Full Code Here

  public Object getUserByHash(String hash) {
    if (hash.length() == 0) {
      return new Long(-5);
    }
    User us = null;
    try {
      us = em.createNamedQuery("getUserByHash", User.class)
          .setParameter("resethash", hash)
          .setParameter("type", User.Type.user)
          .getSingleResult();
View Full Code Here

  public User getContact(String email, String firstName, String lastName, long ownerId) {
    return getContact(email, firstName, lastName, null, null, get(ownerId));
  }
 
  public User getContact(String email, String firstName, String lastName, Long langId, String tzId, User owner) {
    User to = null;
    try {
      to = em.createNamedQuery("getContactByEmailAndUser", User.class)
          .setParameter("email", email).setParameter("type", User.Type.contact).setParameter("ownerId", owner.getUser_id()).getSingleResult();
    } catch (Exception e) {
      //no-op
    }
    if (to == null) {
      to = new User();
      to.setType(Type.contact);
      String login = owner.getUser_id() + "_" + email; //UserId prefix is used to ensure unique login
      to.setLogin(login.length() < getMinLoginLength(cfgDao) ? UUID.randomUUID().toString() : login);
      to.setFirstname(firstName);
      to.setLastname(lastName);
      to.setLanguage_id(null == langId ? owner.getLanguage_id() : langId);
      to.setOwnerId(owner.getUser_id());
      to.setAdresses(new Address());
      to.getAdresses().setEmail(email);
      to.setTimeZoneId(null == tzId ? owner.getTimeZoneId() : tzId);
    }
    return to;
  }
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.db.entity.user.User

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.