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

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


  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

   */
  public User getUserByActivationHash(String hash) {
    TypedQuery<User> query = em.createQuery("SELECT u FROM User as u WHERE u.activatehash = :activatehash"
        + " AND u.deleted = false", User.class);
    query.setParameter("activatehash", hash);
    User u = null;
    try {
      u = query.getSingleResult();
    } catch (NoResultException e) {
      // u=null}
    }
View Full Code Here

  private static final long serialVersionUID = 1L;
  private final static int PAGE_SIZE = 10;
  private Map<String, User> newContacts = new Hashtable<String, User>();
 
  public static User getUser(String value) {
    User u = null;
    //FIXME refactor this
    String email = null;
    String fName = null;
    String lName = null;
    int idx = value.indexOf('<');
View Full Code Here

    return id;
  }

  @Override
  public void query(String term, int page, Response<User> response) {
    User c = getUser(term);
    if (c != null) {
      response.add(c);
    }
    UserDao dao = getBean(UserDao.class);
    response.addAll(dao.get(term, page * PAGE_SIZE, PAGE_SIZE, null, getUserId()));
View Full Code Here

      private static final long serialVersionUID = -3314136686941736574L;

      @Override
      protected void populateItem(Item<User> item) {
        final UserContactsDao contactsDao = getBean(UserContactsDao.class);
        User u = item.getModelObject();
        final long userId = u.getUser_id();
        item.add(new WebMarkupContainer("status").add(AttributeModifier.append("class", isUserOnline(userId) ? "online" : "offline")));
        item.add(new Label("name", getName(u)));
        item.add(new Label("tz", getBean(TimezoneUtil.class).getTimeZone(u).getID()));
        item.add(new Label("offer", u.getUserOffers()));
        item.add(new Label("search", u.getUserSearchs()));
        item.add(new WebMarkupContainer("view").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 7223188816617664993L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
View Full Code Here

  private final String ACTIVATION_PARAM = "u";
 
  public ActivatePage(PageParameters pp) {
    String userHash = pp.get(ACTIVATION_PARAM).toString();
    if (userHash != null) {
      User user = Application.getBean(UserDao.class).getUserByActivationHash(userHash);

      if (user != null && user.getStatus() == 0) {
        // activate
        user.setStatus(1);
        user.setUpdatetime(new Date());

        Application.getBean(UserDao.class).update(user, null);
 
      }
    }
View Full Code Here

  private static final long serialVersionUID = 3642004664480074881L;

  public RoomsTabbedPanel(String id) {
    super(id);
   
    User u = getBean(UserDao.class).get(getUserId());
    add(new ListView<Organisation_Users>("orgTabs", u.getOrganisation_users()) {
      private static final long serialVersionUID = -145637079945252731L;

      @Override
      protected void populateItem(ListItem<Organisation_Users> item) {
        Organisation org = item.getModelObject().getOrganisation();
        item.add(new WebMarkupContainer("link")
          .add(new Label("name", Model.of(org.getName())))
          .add(new AttributeModifier("href", "#org" + org.getOrganisation_id())));
      }
    });
    add(new ListView<Organisation_Users>("orgRooms", u.getOrganisation_users()) {
      private static final long serialVersionUID = 9039932126334250798L;

      @Override
      protected void populateItem(ListItem<Organisation_Users> item) {
        Organisation org = item.getModelObject().getOrganisation();
View Full Code Here

    String hash = ManageCryptStyle.getInstanceOfCrypt()
      .createPassPhrase(CalendarPatterns.getDateWithTimeByMiliSeconds(new Date()));

    Long userContactId = getBean(UserContactsDao.class).addUserContact(userIdToAdd, getUserId(), true, hash);

    User user = getBean(UserDao.class).get(getUserId());
    User userToAdd = getBean(UserDao.class).get(userIdToAdd);

    String subj = user.getFirstname() + " " + user.getLastname() + " " + WebSession.getString(1193);
    String message = RequestContactTemplate.getEmail(userToAdd, user);

    getBean(PrivateMessagesDao.class).addPrivateMessage(
      subj, message, 0L, user, userToAdd, userToAdd, false, null, true, userContactId);

    if (userToAdd.getAdresses() != null) {
      getBean(MailHandler.class).send(userToAdd.getAdresses().getEmail(), subj, message);
    }

    return userContactId;
  }
View Full Code Here

    contact = dao.get(userContactId);

    dao.addUserContact(contact.getOwner().getUser_id(), getUserId(), false, "");

    User user = contact.getOwner();

    if (user.getAdresses() != null) {
      String message = RequestContactConfirmTemplate.getEmail(user, contact);

      String subj = contact.getContact().getFirstname() + " " + contact.getContact().getLastname() + " " + WebSession.getString(1198);

      getBean(PrivateMessagesDao.class).addPrivateMessage(
          subj, message,
          0L, contact.getContact(), user, user, false, null, false, 0L);

      getBean(MailHandler.class).send(user.getAdresses().getEmail(), subj, message);
    }
    return userContactId;
  }
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.