Package org.apache.openmeetings.db.entity.room

Examples of org.apache.openmeetings.db.entity.room.Invitation


  public Invitation getInvitation(User inveetee, Room room
      , boolean isPasswordProtected, String invitationpass, Valid valid,
      User createdBy, String baseUrl, Long language_id, Date gmtTimeStart, Date gmtTimeEnd
      , Appointment appointment)
  {
    Invitation i = getInvitation(null, inveetee, room, isPasswordProtected, invitationpass, valid, createdBy
        , baseUrl, language_id, gmtTimeStart, gmtTimeEnd, appointment);
    i = invitationDao.update(i);
    return i;
  }
View Full Code Here


  public Invitation getInvitation(Invitation _invitation, User inveetee, Room room
      , boolean isPasswordProtected, String invitationpass, Valid valid,
      User createdBy, String baseUrl, Long language_id, Date gmtTimeStart, Date gmtTimeEnd
      , Appointment appointment) {
   
    Invitation invitation = _invitation;
    if (null == _invitation) {
      invitation = new Invitation();
      String hashRaw = "HASH" + (System.currentTimeMillis());
      try {
        invitation.setHash(MD5.do_checksum(hashRaw));
      } catch (NoSuchAlgorithmException e) {
        log.error("Unexpected error while creating invitation", e);
        throw new RuntimeException(e);
      }
    }

    invitation.setPasswordProtected(isPasswordProtected);
    if (isPasswordProtected) {
      invitation.setPassword(ManageCryptStyle.getInstanceOfCrypt().createPassPhrase(invitationpass));
    }

    invitation.setUsed(false);
    log.debug(baseUrl);
    if (baseUrl != null) {
      invitation.setBaseUrl(baseUrl);
    }
    invitation.setValid(valid);
   
    // valid period of Invitation
    switch (valid) {
      case Period:
        invitation.setValidFrom(new Date(gmtTimeStart.getTime() - (5 * 60 * 1000)));
        invitation.setValidTo(gmtTimeEnd);
        break;
      case Endless:
      case OneTime:
      default:
        break;
    }

    invitation.setDeleted(false);

    invitation.setInvitedBy(createdBy);
    invitation.setInvitee(inveetee);
    if (language_id != null && Type.contact == invitation.getInvitee().getType()) {
      invitation.getInvitee().setLanguage_id(language_id);
    }
    invitation.setRoom(room);
    invitation.setInserted(new Date());
    invitation.setAppointment(appointment);

    return invitation;
  }
View Full Code Here

   * @param hidePass
   * @return
   */
  public Object getInvitationByHashCode(String hashCode, boolean hidePass) {
    try {
      Invitation invitation = invitationDao.getInvitationByHashCode(hashCode, hidePass);

      if (invitation == null) {
        // already deleted or does not exist
        return new Long(-31);
      } else {
        switch (invitation.getValid()) {
          case OneTime:
            // do this only if the user tries to get the Invitation, not
            // while checking the PWD
            if (hidePass) {
              // one-time invitation
              if (invitation.isUsed()) {
                // Invitation is of type *only-one-time* and was
                // already used
                return new Long(-32);
              } else {
                // set to true if this is the first time / a normal
                // getInvitation-Query
                invitation.setUsed(true);
                invitationDao.update(invitation);
                // invitation.setInvitationpass(null);
                invitation.setAllowEntry(true);
              }
            } else {
              invitation.setAllowEntry(true);
            }
            break;
          case Period:
            TimeZone tz = timezoneUtil.getTimeZone(invitation.getInvitee());
            Calendar now = Calendar.getInstance(tz);
            Calendar start = Calendar.getInstance(tz);
            start.setTime(invitation.getValidFrom());

            Calendar end = Calendar.getInstance(tz);
            end.setTime(invitation.getValidTo());
            if (now.after(start) && now.before(end)) {
              invitationDao.update(invitation);
              // invitation.setInvitationpass(null);
              invitation.setAllowEntry(true);
            } else {

              // Invitation is of type *period* and is not valid
              // anymore, this is an extra hook to display the time
              // correctly
              // in the method where it shows that the hash code does
              // not work anymore
              invitation.setAllowEntry(false);
            }
            break;
          case Endless:
          default:
            invitationDao.update(invitation);

            invitation.setAllowEntry(true);
            // invitation.setInvitationpass(null);
            break;
        }
        return invitation;
      }
View Full Code Here

  public Object checkInvitationPass(String hashCode, String pass) {
    try {
      Object obj = this.getInvitationByHashCode(hashCode, false);
      log.debug("checkInvitationPass - obj: " + obj);
      if (obj instanceof Invitation) {
        Invitation invitation = (Invitation) obj;

        // log.debug("invitationId "+invitation.getInvitations_id());
        // log.debug("pass "+pass);
        // log.debug("getInvitationpass "+invitation.getInvitationpass());

        if (ManageCryptStyle.getInstanceOfCrypt().verifyPassword(pass, invitation.getPassword())) {
          return new Long(1);
        } else {
          return new Long(-34);
        }
      } else {
View Full Code Here

  public Invitation getInvitation(User inveetee, Room room
      , boolean isPasswordProtected, String invitationpass, Valid valid,
      User createdBy, Long language_id, Date gmtTimeStart, Date gmtTimeEnd
      , Appointment appointment)
  {
    Invitation i = getInvitation(null, inveetee, room, isPasswordProtected, invitationpass, valid, createdBy
        , language_id, gmtTimeStart, gmtTimeEnd, appointment);
    i = invitationDao.update(i);
    return i;
  }
View Full Code Here

  public Invitation getInvitation(Invitation _invitation, User inveetee, Room room
      , boolean isPasswordProtected, String invitationpass, Valid valid,
      User createdBy, Long language_id, Date gmtTimeStart, Date gmtTimeEnd
      , Appointment appointment) {
   
    Invitation invitation = _invitation;
    if (null == _invitation) {
      invitation = new Invitation();
      String hashRaw = "HASH" + (System.currentTimeMillis());
      try {
        invitation.setHash(MD5.do_checksum(hashRaw));
      } catch (NoSuchAlgorithmException e) {
        log.error("Unexpected error while creating invitation", e);
        throw new RuntimeException(e);
      }
    }

    invitation.setPasswordProtected(isPasswordProtected);
    if (isPasswordProtected) {
      invitation.setPassword(ManageCryptStyle.getInstanceOfCrypt().createPassPhrase(invitationpass));
    }

    invitation.setUsed(false);
    invitation.setValid(valid);
   
    // valid period of Invitation
    switch (valid) {
      case Period:
        invitation.setValidFrom(new Date(gmtTimeStart.getTime() - (5 * 60 * 1000)));
        invitation.setValidTo(gmtTimeEnd);
        break;
      case Endless:
      case OneTime:
      default:
        break;
    }

    invitation.setDeleted(false);

    invitation.setInvitedBy(createdBy);
    invitation.setInvitee(inveetee);
    if (language_id != null && Type.contact == invitation.getInvitee().getType()) {
      invitation.getInvitee().setLanguage_id(language_id);
    }
    invitation.setRoom(room);
    invitation.setInserted(new Date());
    invitation.setAppointment(appointment);

    return invitation;
  }
View Full Code Here

   * @param hidePass
   * @return
   */
  public Object getInvitationByHashCode(String hashCode, boolean hidePass) {
    try {
      Invitation invitation = invitationDao.getInvitationByHashCode(hashCode, hidePass);

      if (invitation == null) {
        // already deleted or does not exist
        return new Long(-31);
      } else {
        switch (invitation.getValid()) {
          case OneTime:
            // do this only if the user tries to get the Invitation, not
            // while checking the PWD
            if (hidePass) {
              // one-time invitation
              if (invitation.isUsed()) {
                // Invitation is of type *only-one-time* and was
                // already used
                return new Long(-32);
              } else {
                // set to true if this is the first time / a normal
                // getInvitation-Query
                invitation.setUsed(true);
                invitationDao.update(invitation);
                // invitation.setInvitationpass(null);
                invitation.setAllowEntry(true);
              }
            } else {
              invitation.setAllowEntry(true);
            }
            break;
          case Period:
            TimeZone tz = timezoneUtil.getTimeZone(invitation.getInvitee());
            Calendar now = Calendar.getInstance(tz);
            Calendar start = Calendar.getInstance(tz);
            start.setTime(invitation.getValidFrom());

            Calendar end = Calendar.getInstance(tz);
            end.setTime(invitation.getValidTo());
            if (now.after(start) && now.before(end)) {
              invitationDao.update(invitation);
              // invitation.setInvitationpass(null);
              invitation.setAllowEntry(true);
            } else {

              // Invitation is of type *period* and is not valid
              // anymore, this is an extra hook to display the time
              // correctly
              // in the method where it shows that the hash code does
              // not work anymore
              invitation.setAllowEntry(false);
            }
            break;
          case Endless:
          default:
            invitationDao.update(invitation);

            invitation.setAllowEntry(true);
            // invitation.setInvitationpass(null);
            break;
        }
        return invitation;
      }
View Full Code Here

  public Object checkInvitationPass(String hashCode, String pass) {
    try {
      Object obj = this.getInvitationByHashCode(hashCode, false);
      log.debug("checkInvitationPass - obj: " + obj);
      if (obj instanceof Invitation) {
        Invitation invitation = (Invitation) obj;

        // log.debug("invitationId "+invitation.getInvitations_id());
        // log.debug("pass "+pass);
        // log.debug("getInvitationpass "+invitation.getInvitationpass());

        if (ManageCryptStyle.getInstanceOfCrypt().verifyPassword(pass, invitation.getPassword())) {
          return new Long(1);
        } else {
          return new Long(-34);
        }
      } else {
View Full Code Here

  public String getInvitationHash(String SID, String username, Long room_id) {
    Long users_id = sessiondataDao.checkSession(SID);
   
    if (AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
      User invitee = userDao.getContact(username, username, username, users_id);
      Invitation invitation = invitationManager.getInvitation(invitee, roomDao.get(room_id),
              false, "", Valid.OneTime, userDao.get(users_id), 1L, null, null, null);
 
      return ((invitation == null) ? null : invitation.getHash());
    } else {
      return "Need Admin Privileges to perfom the Action";
    }
  }
View Full Code Here

 
        Calendar calFrom = getDate(validFromDate, validFromTime, iCalTz);
        Calendar calTo = getDate(validToDate, validToTime, iCalTz);
 
        User invitee = userDao.getContact(email, firstname, lastname, users_id);
        Invitation invitation = invitationManager.getInvitation(invitee, roomDao.get(room_id),
                isPasswordProtected, invitationpass, Valid.fromInt(valid)
                , userDao.get(users_id), language_id,
                calFrom.getTime(), calTo.getTime(), null);

        if (invitation != null) {
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.db.entity.room.Invitation

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.