Long users_id = sessiondataDao.checkSession(SID);
Long user_level = userManager.getUserLevelByID(users_id);
// users only
if (authLevelUtil.checkUserLevel(user_level)) {
User from = userManager.getUserById(users_id);
TimeZone timezone = timezoneUtil.getTimezoneByUser(from);
Date appointmentstart = createCalendarDate(timezone,
validFromDate, validFromTime);
Date appointmentend = createCalendarDate(timezone, validToDate,
validToTime);
log.info("validFromDate: "
+ CalendarPatterns
.getDateWithTimeByMiliSeconds(appointmentstart));
log.info("validToDate: "
+ CalendarPatterns
.getDateWithTimeByMiliSeconds(appointmentend));
Room room = null;
String baseURL = "http://" + domain + ":" + port + webapp;
if (port.equals("80")) {
baseURL = "http://" + domain + webapp;
} else if (port.equals("443")) {
baseURL = "https://" + domain + webapp;
}
Long room_id = null;
Long appointmentId = null;
if (bookedRoom) {
room_id = roomManager.addRoom(3, // Userlevel
subject, // name
roomtype_id, // RoomType
"", // Comment
new Long(100), // Number of participants
false, // public
null, // Organisations
true, // Appointment
false, // Demo Room => Meeting Timer
null, // Meeting Timer time in seconds
false, // Is Moderated Room
null, // Moderation List Room
true, // Allow User Questions
false, // isAudioOnly
true, // allowFontStyles
false, // isClosed
"", // redirectURL
"", // conferencePIN
null, // ownerId
null, null, false, // hideTopBar
false, // hideChat
false, // hideActivitiesAndActions
false, // hideFilesExplorer
false, // hideActionsMenu
false, // hideScreenSharing
false, // hideWhiteboard
false, // showMicrophoneStatus
false, // chatModerated
false, // chatOpened
false, // filesOpened
false, // autoVideoSelect
false //sipEnabled
);
room = roomDao.get(room_id);
String sendJNameTimeZone = from.getOmTimeZone().getJname();
appointmentId = this.addAppointmentToUser(subject, message,
from, recipients, room, appointmentstart,
appointmentend, true, true, sendJNameTimeZone);
}
recipients.add(from.getAdresses().getEmail());
String sendJNameTimeZone = from.getOmTimeZone().getJname();
String profile_link = baseURL + "?cuser=1";
for (String email : recipients) {
// Map receipent = (Map) recipients.get(iter.next());
// String email = receipent.get("email").toString();
Long language_id = from.getLanguage_id();
if (language_id == null) {
language_id = configurationDao.getConfValue("default_lang_id", Long.class, "1");
}
String invitation_link = null;
User to = userManager.getUserByEmail(email);
if (bookedRoom) {
// Add the appointment to the calendar of the user (if
// its an internal user)
// if the user is the sender then we already added the
// appointment as we created the
// room, the invitations always belong to the
// appointment of the meeting creator
if (to != null
&& !to.getUser_id().equals(from.getUser_id())) {
this.addAppointmentToUser(subject, message, to,
recipients, room, appointmentstart,
appointmentend, false, true,
sendJNameTimeZone);
}
Invitations invitation = invitationManager
.addInvitationLink(
new Long(2), // userlevel
from.getFirstname() + " "
+ from.getLastname(), // username
message,
baseURL, // baseURl
from.getAdresses().getEmail(), // email
subject, // subject
room_id, // room_id
"public",
false, // passwordprotected
"", // invitationpass
2, // valid type
appointmentstart, // valid from
appointmentend, // valid to
from.getUser_id(), // created by
baseURL, from.getUser_id(),
false, // really send mail sendMail
appointmentstart, appointmentend,
appointmentId, from.getFirstname()
+ " " + from.getLastname(),
from.getOmTimeZone());
invitation_link = baseURL + "?invitationHash="
+ invitation.getHash();
}
if (to != null) {
if (!to.getUser_id().equals(from.getUser_id())) {
// One message to the Send
privateMessagesDao.addPrivateMessage(subject,
message, parentMessageId, from, to, from,
bookedRoom, room, false, 0L, email);
// One message to the Inbox
privateMessagesDao.addPrivateMessage(subject,
message, parentMessageId, from, to, to,
bookedRoom, room, false, 0L, email);
// One copy of the Inbox message to the user
if (to.getLanguage_id() != null) {
language_id = to.getLanguage_id();
}
}
} else {
// One message to the Send
privateMessagesDao.addPrivateMessage(subject, message,
parentMessageId, from, to, from, bookedRoom,
room, false, 0L, email);
// there is no Inbox for external users
}
// We do not send an email to the one that has created the
// private message
if (to != null && to.getUser_id().equals(from.getUser_id())) {
continue;
}
Fieldlanguagesvalues fValue1301 = fieldManager
.getFieldByIdAndLanguage(1301L, language_id);