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;
}
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);
}
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);
}
}
}
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;
}
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);
}
Aggregations