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

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


      registry.bind(User.class, new UserConverter(usersDao, usersMap));
     
      List<UserContact> list = readList(serializer, f, "userContacts.xml", "usercontacts", UserContact.class, true);
      for (UserContact uc : list) {
        Long ucId = uc.getUserContactId();
        UserContact storedUC = userContactsDao.get(ucId);

        if (storedUC == null && uc.getContact() != null && uc.getContact().getUser_id() != null) {
          uc.setUserContactId(0);
          if (uc.getOwner() != null && uc.getOwner().getUser_id() == null) {
            uc.setOwner(null);
View Full Code Here


      Long users_id = sessiondataDao.checkSession(SID);
      Long user_level = userManager.getUserLevelByID(users_id);
      // users only
      if (AuthLevelUtil.checkUserLevel(user_level)) {

        UserContact userContacts = userContactsDao
            .get(userContactId);

        if (userContacts == null) {
          return -49;
        }
View Full Code Here

      Long user_level = userManager.getUserLevelByID(users_id);

      // users only
      if (AuthLevelUtil.checkUserLevel(user_level)) {

        UserContact userContacts = userContactsDao
            .get(userContactId);

        userContacts.setShareCalendar(shareCalendar);

        userContactsDao.updateContact(userContacts);

      }
View Full Code Here

        return uc.getOwner().getFirstname() + " " + uc.getOwner().getLastname(); //FIXME salutation
      }
     
      @Override
      protected void populateItem(Item<UserContact> item) {
        UserContact uc = item.getModelObject();
        final long contactId = uc.getUserContactId();
        final long userId = uc.getOwner().getUser_id();
        if (uc.getPending()) {
          item.add(AttributeModifier.append("class", "unread"));
        }
        item.add(new Label("name", getName(uc)))
        item.add(new WebMarkupContainer("accept").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 7223188816617664993L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
            ContactsHelper.acceptUserContact(contactId);
            updateContacts(target);
          }
        }).setVisible(uc.getPending()));
        item.add(new WebMarkupContainer("decline").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
            getBean(UserContactsDao.class).deleteUserContact(contactId);
            updateContacts(target);
          }
        }).setVisible(uc.getPending()));
        item.add(new WebMarkupContainer("view").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
            d.open(target, userId);
          }
        }));
        item.add(new WebMarkupContainer("message").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
            newMessage.reset(true).open(target, userId);
          }
        }).setVisible(!uc.getPending()));
        item.add(new WebMarkupContainer("delete").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
            getBean(UserContactsDao.class).deleteUserContact(contactId);
            updateContacts(target);
          }
        }).setVisible(!uc.getPending()));
      }
    };
    updateContacts(null);
    add(d, contacts.add(dw, pendingContacts, allContacts).setOutputMarkupId(true));//TODO update
   
View Full Code Here

      registry.bind(User.class, new UserConverter(usersDao, usersMap));
     
      List<UserContact> list = readList(serializer, f, "userContacts.xml", "usercontacts", UserContact.class, true);
      for (UserContact uc : list) {
        Long ucId = uc.getUserContactId();
        UserContact storedUC = userContactsDao.get(ucId);

        if (storedUC == null && uc.getContact() != null && uc.getContact().getUser_id() != null) {
          uc.setUserContactId(0);
          Long newId = userContactsDao.addUserContactObj(uc);
          userContactsMap.put(ucId, newId);
View Full Code Here

    private UserDao userDao;

  public Long addUserContact(Long user_id, Long ownerId, Boolean pending, String hash) {
    try {
     
      UserContact userContact = new UserContact();
      userContact.setInserted(new Date());
      userContact.setOwner(userDao.get(ownerId));
      userContact.setContact(userDao.get(user_id));
      userContact.setPending(pending);
      userContact.setHash(hash);
     
      userContact = em.merge(userContact);
      Long userContactId = userContact.getUserContactId();
     
      return userContactId;     
    } catch (Exception e) {
      log.error("[addUserContact]",e);
    }
View Full Code Here

 
  public UserContact get(Long id) {
    try {
      TypedQuery<UserContact> query = em.createNamedQuery("getUserContactsById", UserContact.class);
      query.setParameter("userContactId", id);
      UserContact userContacts = null;
      try {
        userContacts = query.getSingleResult();
        } catch (NoResultException ex) {
        }
      return userContacts;
View Full Code Here

  }
 
  public Long updateContactStatus(Long userContactId, Boolean pending) {
    try {
     
      UserContact userContacts = this.get(userContactId);
     
      if (userContacts == null) {
        return null;
      }
      userContacts.setPending(pending);
      userContacts.setUpdated(new Date());
     
      if (userContacts.getUserContactId() == 0) {
        em.persist(userContacts);
        } else {
          if (!em.contains(userContacts)) {
            em.merge(userContacts);
          }
View Full Code Here

        return uc.getOwner().getFirstname() + " " + uc.getOwner().getLastname(); //FIXME salutation
      }
     
      @Override
      protected void populateItem(Item<UserContact> item) {
        UserContact uc = item.getModelObject();
        final long contactId = uc.getUserContactId();
        final long userId = uc.getOwner().getUser_id();
        if (uc.getPending()) {
          item.add(AttributeModifier.append("class", "unread"));
        }
        item.add(new Label("name", getName(uc)))
        item.add(new WebMarkupContainer("accept").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 7223188816617664993L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
            ContactsHelper.acceptUserContact(contactId);
            updateContacts(target);
          }
        }).setVisible(uc.getPending()));
        item.add(new WebMarkupContainer("decline").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
            getBean(UserContactsDao.class).deleteUserContact(contactId);
            updateContacts(target);
          }
        }).setVisible(uc.getPending()));
        item.add(new WebMarkupContainer("view").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
            d.open(target, userId);
          }
        }));
        item.add(new WebMarkupContainer("message").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
            newMessage.reset(true).open(target, userId);
          }
        }).setVisible(!uc.getPending()));
        item.add(new WebMarkupContainer("delete").add(new AjaxEventBehavior("onclick") {
          private static final long serialVersionUID = 1L;

          @Override
          protected void onEvent(AjaxRequestTarget target) {
            getBean(UserContactsDao.class).deleteUserContact(contactId);
            updateContacts(target);
          }
        }).setVisible(!uc.getPending()));
      }
    };
    updateContacts(null);
    add(d, contacts.add(dw, pendingContacts, allContacts).setOutputMarkupId(true));//TODO update
   
View Full Code Here

    return userContactId;
  }

  public static Long acceptUserContact(long userContactId) {
    UserContactsDao dao = getBean(UserContactsDao.class);
    UserContact contact = dao.get(userContactId);

    if (contact == null) {
      return -46L;
    }

    if (!contact.getPending()) {
      return -47L;
    }

    dao.updateContactStatus(userContactId, false);

    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.UserContact

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.