String replyToEmail = owner.getAdresses().getEmail();
if (ical) {
String username = i.getInvitee().getLogin();
boolean isOwner = owner.getUser_id() == i.getInvitee().getUser_id();
IcalHandler handler = new IcalHandler(MessageType.Cancel == type ? IcalHandler.ICAL_METHOD_CANCEL : IcalHandler.ICAL_METHOD_REQUEST);
HashMap<String, String> attendeeList = handler.getAttendeeData(email, username, isOwner);
Vector<HashMap<String, String>> atts = new Vector<HashMap<String, String>>();
atts.add(attendeeList);
// Defining Organizer
HashMap<String, String> organizerAttendee = handler.getAttendeeData(email, username, isOwner);
organizerAttendee = handler.getAttendeeData(replyToEmail, owner.getLogin(), isOwner);
Appointment a = i.getAppointment();
// Create ICal Message
//FIXME should be checked to generate valid time
String meetingId = handler.addNewMeeting(a.getStart(), a.getEnd(),
a.getTitle(), atts, invitation_link,
organizerAttendee, a.getIcalId(), timezoneUtil.getTimeZone(owner));
// Writing back meetingUid
if (a.getIcalId() == null || a.getIcalId().length() < 1) {
a.setIcalId(meetingId);
// TODO should it be saved ???
}
log.debug(handler.getICalDataAsString());
mailHandler.send(new MailMessage(email, replyToEmail, subject, template, handler.getIcalAsByteArray()));
} else {
mailHandler.send(email, replyToEmail, subject, template);
}
}