Search in sources :

Example 11 with Invitation

use of org.apache.openmeetings.db.entity.room.Invitation in project openmeetings by apache.

the class InvitationManager method getInvitation.

@Override
public Invitation getInvitation(User inveetee, Room room, boolean isPasswordProtected, String invitationpass, Valid valid, User createdBy, Long languageId, Date gmtTimeStart, Date gmtTimeEnd, Appointment appointment) {
    Invitation i = getInvitation((Invitation) null, inveetee, room, isPasswordProtected, invitationpass, valid, createdBy, languageId, gmtTimeStart, gmtTimeEnd, appointment);
    i = invitationDao.update(i);
    return i;
}
Also used : Invitation(org.apache.openmeetings.db.entity.room.Invitation)

Example 12 with Invitation

use of org.apache.openmeetings.db.entity.room.Invitation in project openmeetings by apache.

the class TestInvitation method testSendInvitationLink.

@Test
public void testSendInvitationLink() throws Exception {
    User us = userDao.getByLogin(adminUsername, User.Type.user, null);
    LocalDateTime from = LocalDateTime.now().plusDays(1).withHour(12).withMinute(0).withSecond(0);
    User invitee = userDao.getContact("sebawagner@apache.org", "Testname", "Testlastname", us.getId());
    Invitation i = invitationManager.getInvitation(invitee, roomDao.get(1L), false, "", Valid.OneTime, us, us.getLanguageId(), getDate(from, "GMT"), getDate(from.plusHours(2), "GMT"), null);
    invitationManager.sendInvitationLink(i, MessageType.Create, "subject", "message", false);
}
Also used : LocalDateTime(java.time.LocalDateTime) User(org.apache.openmeetings.db.entity.user.User) Invitation(org.apache.openmeetings.db.entity.room.Invitation) Test(org.junit.Test)

Example 13 with Invitation

use of org.apache.openmeetings.db.entity.room.Invitation in project openmeetings by apache.

the class AppointmentLogic method doScheduledMeetingReminder.

/**
 * Sending Reminder in Simple mail format 5 minutes before Meeting begins
 */
// ----------------------------------------------------------------------------------------------
public void doScheduledMeetingReminder() {
    String baseUrl = getBaseUrl();
    if (baseUrl == null || baseUrl.length() < 1) {
        log.error("Error retrieving baseUrl for application");
        return;
    }
    int minutesReminderSend = cfgDao.getInt(CONFIG_APPOINTMENT_REMINDER_MINUTES, DEFAULT_MINUTES_REMINDER_SEND);
    if (minutesReminderSend == 0) {
        log.warn("minutesReminderSend is 0, disabling reminder scheduler");
        return;
    }
    long milliseconds = minutesReminderSend * 60 * 1000L;
    Calendar start = Calendar.getInstance();
    if (milliseconds < 0) {
        start.setTimeInMillis(start.getTimeInMillis() + milliseconds);
    }
    Calendar end = Calendar.getInstance();
    if (milliseconds > 0) {
        end.setTimeInMillis(end.getTimeInMillis() + milliseconds);
    }
    for (Appointment a : appointmentDao.getInRange(start, end)) {
        // very long to send each
        if (a.isReminderEmailSend()) {
            continue;
        }
        TimeZone ownerZone = getTimeZone(a.getOwner());
        Calendar aNow = Calendar.getInstance(ownerZone);
        Calendar aStart = a.startCalendar(ownerZone);
        aStart.add(Calendar.MINUTE, -minutesReminderSend);
        if (aStart.after(aNow)) {
            // to early to send reminder
            continue;
        }
        // Update Appointment to not send invitation twice
        a.setReminderEmailSend(true);
        appointmentDao.update(a, null, false);
        List<MeetingMember> members = a.getMeetingMembers();
        sendReminder(a.getOwner(), a);
        if (members == null) {
            log.debug("doScheduledMeetingReminder : no members in meeting!");
            continue;
        }
        // Iterate through all MeetingMembers
        for (MeetingMember mm : members) {
            log.debug("doScheduledMeetingReminder : Member " + mm.getUser().getAddress().getEmail());
            Invitation inv = mm.getInvitation();
            sendReminder(mm.getUser(), a, inv);
        }
    }
}
Also used : Appointment(org.apache.openmeetings.db.entity.calendar.Appointment) TimeZone(java.util.TimeZone) TimezoneUtil.getTimeZone(org.apache.openmeetings.db.util.TimezoneUtil.getTimeZone) Calendar(java.util.Calendar) MeetingMember(org.apache.openmeetings.db.entity.calendar.MeetingMember) Invitation(org.apache.openmeetings.db.entity.room.Invitation)

Example 14 with Invitation

use of org.apache.openmeetings.db.entity.room.Invitation in project openmeetings by apache.

the class InvitationManager method getInvitation.

@Override
public Invitation getInvitation(Invitation _invitation, User inveetee, Room room, boolean isPasswordProtected, String invitationpass, Valid valid, User createdBy, Long languageId, Date gmtTimeStart, Date gmtTimeEnd, Appointment appointment) {
    Invitation invitation = _invitation;
    if (null == _invitation) {
        invitation = new Invitation();
        invitation.setHash(UUID.randomUUID().toString());
    }
    invitation.setPasswordProtected(isPasswordProtected);
    if (isPasswordProtected) {
        invitation.setPassword(CryptProvider.get().hash(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 (languageId != null && Type.contact == invitation.getInvitee().getType()) {
        invitation.getInvitee().setLanguageId(languageId);
    }
    invitation.setRoom(room);
    invitation.setInserted(new Date());
    invitation.setAppointment(appointment);
    return invitation;
}
Also used : Invitation(org.apache.openmeetings.db.entity.room.Invitation) Date(java.util.Date)

Example 15 with Invitation

use of org.apache.openmeetings.db.entity.room.Invitation in project openmeetings by apache.

the class WebSession method setUser.

private void setUser(User u, Set<Right> rights) {
    Long _recordingId = recordingId;
    Long _roomId = roomId;
    Invitation _i = i;
    SOAPLogin _soap = soap;
    ClientInfo _info = clientInfo;
    ExtendedClientProperties _extProps = extProps;
    // required to prevent session fixation
    replaceSession();
    if (_recordingId != null) {
        recordingId = _recordingId;
    }
    if (_roomId != null) {
        roomId = _roomId;
    }
    if (_i != null) {
        i = _i;
    }
    if (_soap != null) {
        soap = _soap;
    }
    if (_info != null) {
        clientInfo = _info;
    }
    if (_extProps != null) {
        extProps = _extProps;
    }
    userId = u.getId();
    if (rights == null || rights.isEmpty()) {
        Set<Right> r = new HashSet<>(u.getRights());
        if (u.getGroupUsers() != null && !AuthLevelUtil.hasAdminLevel(r)) {
            for (GroupUser gu : u.getGroupUsers()) {
                if (gu.isModerator()) {
                    r.add(Right.GroupAdmin);
                    break;
                }
            }
        }
        this.rights = Collections.unmodifiableSet(r);
    } else {
        this.rights = Collections.unmodifiableSet(rights);
    }
    languageId = u.getLanguageId();
    externalType = u.getExternalType();
    tz = getTimeZone(u);
    ISO8601FORMAT = FastDateFormat.getInstance(ISO8601_FULL_FORMAT_STRING, tz);
    setLocale(LocaleHelper.getLocale(u));
    sdf = FormatHelper.getDateTimeFormat(u);
}
Also used : GroupUser(org.apache.openmeetings.db.entity.user.GroupUser) SOAPLogin(org.apache.openmeetings.db.entity.server.SOAPLogin) Invitation(org.apache.openmeetings.db.entity.room.Invitation) Right(org.apache.openmeetings.db.entity.user.User.Right) ClientInfo(org.apache.wicket.core.request.ClientInfo) ExtendedClientProperties(org.apache.openmeetings.web.util.ExtendedClientProperties) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Aggregations

Invitation (org.apache.openmeetings.db.entity.room.Invitation)16 Date (java.util.Date)3 User (org.apache.openmeetings.db.entity.user.User)3 LocalDateTime (java.time.LocalDateTime)2 Appointment (org.apache.openmeetings.db.entity.calendar.Appointment)2 MeetingMember (org.apache.openmeetings.db.entity.calendar.MeetingMember)2 Room (org.apache.openmeetings.db.entity.room.Room)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 RadioGroup (org.apache.wicket.markup.html.form.RadioGroup)2 JQueryBehavior (com.googlecode.wicket.jquery.core.JQueryBehavior)1 DialogButton (com.googlecode.wicket.jquery.ui.widget.dialog.DialogButton)1 MessageDialog (com.googlecode.wicket.jquery.ui.widget.dialog.MessageDialog)1 ParseException (java.text.ParseException)1 ArrayList (java.util.ArrayList)1 Calendar (java.util.Calendar)1 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 TimeZone (java.util.TimeZone)1 WebMethod (javax.jws.WebMethod)1 POST (javax.ws.rs.POST)1