log.debug("doScheduledMeetingReminder : UTC now " + now);
Long language_id = Long.valueOf(Configurationmanagement.getInstance().
getConfKey(3,"default_lang_id").getConf_value()).longValue();
Fieldlanguagesvalues labelid1158 = Fieldmanagment.getInstance().getFieldByIdAndLanguage(new Long(1158), language_id);
Fieldlanguagesvalues labelid1153 = Fieldmanagment.getInstance().getFieldByIdAndLanguage(new Long(1153), language_id);
Fieldlanguagesvalues labelid1154 = Fieldmanagment.getInstance().getFieldByIdAndLanguage(new Long(1154), language_id);
for(int i = 0; i < points.size(); i++){
Appointment ment = points.get(i);
// Checking ReminderType - only ReminderType simple mail is concerned!
if(ment.getRemind().getTypId() == 2 || ment.getRemind().getTypId() == 3){
log.debug("doScheduledMeetingReminder : Found appointment " + ment.getAppointmentName());
Date appStart = ment.getAppointmentStarttime();
Date oneHourBeforeAppStart = new Date(System.currentTimeMillis());
oneHourBeforeAppStart.setTime(appStart.getTime());
//oneHourBeforeAppStart.setHours(appStart.getHours() -1);
oneHourBeforeAppStart.setMinutes(appStart.getMinutes() - 5);
// System.out.println("doScheduledMeetingReminder : Found appointment 1 " +now);
// System.out.println("doScheduledMeetingReminder : Found appointment 2 " +appStart);
// System.out.println("doScheduledMeetingReminder : Found appointment 3 " +oneHourBeforeAppStart);
// System.out.println("doScheduledMeetingReminder : Found appointment 4 " +now.before(appStart));
// System.out.println("doScheduledMeetingReminder : Found appointment 5 " +now.after(oneHourBeforeAppStart));
//
if(now.before(appStart) && now.after(oneHourBeforeAppStart)){
log.debug("Meeting " + ment.getAppointmentName() + " is in reminder range...");
List<MeetingMember> members = MeetingMemberDaoImpl.getInstance().getMeetingMemberByAppointmentId(ment.getAppointmentId());
if(members == null || members.size() < 1){
log.debug("doScheduledMeetingReminder : no members in meeting!");
continue;
}
for(int y =0; y < members.size(); y++){
MeetingMember mm = members.get(y);
log.debug("doScheduledMeetingReminder : Member " + mm.getEmail());
Invitations inv = mm.getInvitation();
if(inv==null) {
log.error("Error retrieving Invitation for member " + mm.getEmail() + " in Appointment " + ment.getAppointmentName());
} else {
// Check if Invitation was updated last time
Date updateTime = inv.getUpdatetime();
if(updateTime !=null && updateTime.after(oneHourBeforeAppStart)){
log.debug("Member has been informed within one hour before Meeting start");
continue;
}
if(inv.getBaseUrl() == null || inv.getBaseUrl().length() < 1){
log.error("Error retrieving baseUrl from Invitation ID : " + inv.getInvitations_id());
continue;
}
//ment.getAppointmentStarttime().toLocaleString()
Users us = ment.getUserId();
String jNameTimeZone = null;
if (us != null && us.getOmTimeZone() != null) {
jNameTimeZone = us.getOmTimeZone().getJname();
} else {
Configuration conf = Configurationmanagement.getInstance().getConfKey(3L, "default.timezone");
if (conf != null) {
jNameTimeZone = conf.getConf_value();
}
}
OmTimeZone omTimeZone = OmTimeZoneDaoImpl.getInstance().getOmTimeZone(jNameTimeZone);
String timeZoneName = omTimeZone.getIcal();
Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone(timeZoneName));
int offset = cal.get(Calendar.ZONE_OFFSET) + cal.get(Calendar.DST_OFFSET);
Date starttime = new Date(ment.getAppointmentStarttime().getTime() + offset);
Date endtime = new Date(ment.getAppointmentEndtime().getTime() + offset);
// String message = "Meeting : " + ment.getAppointmentName() + "<br>";
// if(ment.getAppointmentDescription() != null && ment.getAppointmentDescription().length() > 0)
// message += "(" + ment.getAppointmentDescription() + ")<br>";
// message += "Start : " + starttime + "<br>";
// message += "End : " + endtime + "<br>";
// message += "Timezone : " + omTimeZone.getIcal() + "<br>";
String message = labelid1158.getValue() + " "+ ment.getAppointmentName();
if (ment.getAppointmentDescription().length() != 0) {
Fieldlanguagesvalues labelid1152 = Fieldmanagment.getInstance().getFieldByIdAndLanguage(new Long(1152), language_id);
message += labelid1152.getValue() + ment.getAppointmentDescription();
}
message += "<br/>" + labelid1153.getValue() + ' '
+ CalendarPatterns.getDateWithTimeByMiliSeconds(starttime)