Package org.apache.openmeetings.persistence.beans.user

Examples of org.apache.openmeetings.persistence.beans.user.UserContact


    private UserManager userManager;

  public Long addUserContact(Long user_id, Long ownerId, Boolean pending, String hash) {
    try {
     
      UserContact userContact = new UserContact();
      userContact.setInserted(new Date());
      userContact.setOwner(userManager.getUserById(ownerId));
      userContact.setContact(userManager.getUserById(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 getUserContacts(Long userContactId) {
    try {
      TypedQuery<UserContact> query = em.createNamedQuery("getUserContactsById", UserContact.class);
      query.setParameter("userContactId", userContactId);
      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.getUserContacts(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

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

        UserContact userContact = userContactsDao
            .getContactsByHash(hash);

        if (userContact == null) {

          log.error("changeUserContactByHash " + hash);

          return -48L;
        }

        if (userContact.getContact().getUser_id().equals(users_id)) {

          return this.changePendingStatusUserContacts(SID,
              userContact.getUserContactId(), status);

        } else {
          return -48L;
        }
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
            .getUserContacts(userContactId);

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

        if (userContacts.getPending() != null
            && !userContacts.getPending()) {
          return -47L;
        }

        return userContactId;
      }
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
            .getUserContacts(userContactId);

        if (userContacts == null) {
          return -49;
        }
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
            .getUserContacts(userContactId);

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

        if (userContacts.getPending() != null
            && !userContacts.getPending()) {
          return -47L;
        }

        if (pending) {

          userContactsDao.updateContactStatus(userContactId, false);

          userContacts = userContactsDao
              .getUserContacts(userContactId);

          userContactsDao.addUserContact(userContacts.getOwner()
              .getUser_id(), users_id, false, "");

          User user = userContacts.getOwner();

          if (user.getAdresses() != null) {

            Long language_id = user.getLanguage_id();
            if (language_id == null) {
              language_id = configurationDao.getConfValue("default_lang_id", Long.class, "1");
            }

            String message = "";

            Fieldlanguagesvalues fValue1192 = fieldManager
                .getFieldByIdAndLanguage(1192L, language_id);
            Fieldlanguagesvalues fValue1198 = fieldManager
                .getFieldByIdAndLanguage(1198L, language_id);

            message += fValue1192.getValue() + " "
                + user.getFirstname() + " "
                + user.getLastname() + "<br/><br/>";
            message += userContacts.getContact().getFirstname()
                + " " + userContacts.getContact().getLastname()
                + " " + fValue1198.getValue();

            String template = requestContactConfirmTemplate
                .getRequestContactTemplate(message);

            privateMessagesDao.addPrivateMessage(
                user.getFirstname() + " " + user.getLastname()
                    + " " + fValue1198.getValue(), message,
                0L, userContacts.getContact(), user, user,
                false, null, false, 0L, user.getAdresses()
                    .getEmail());

            mailHandler.send(user.getAdresses().getEmail(),
                userContacts.getContact().getFirstname()
                    + " "
                    + userContacts.getContact()
                        .getLastname() + " "
                    + fValue1198.getValue(), template);

          }
View Full Code Here

      Long user_level = userManager.getUserLevelByID(users_id);

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

        UserContact userContacts = userContactsDao
            .getUserContacts(userContactId);

        userContacts.setShareCalendar(shareCalendar);

        userContactsDao.updateContact(userContacts);

      }
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.getUserContacts(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

      Long users_id = sessiondataDao.checkSession(SID);
      Long user_level = userManager.getUserLevelByID(users_id);
      if (authLevelUtil.checkUserLevel(user_level)) {
       
        if (!requestUserId.equals(users_id)) {
          UserContact userContacts = userContactsDaoImpl
              .getUserContactByShareCalendar(requestUserId, true,
                  users_id);
          if (userContacts == null) {
            throw new Exception(
                "Your are not allowed to see this calendar");
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.persistence.beans.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.