sessionForm.setActivityFile(this.getActivityFile());
sessionForm.setActivityFilesList(this.getActivityFilesList());
}
// initialize validation
Validation validation = new Validation();
validation.checkForRequired("error.activity.detail.title", sessionForm.getActivityTitle(),
"error.application.required", errors);
validation.checkForMaxlength("error.activity.detail.title", sessionForm.getActivityTitle(),
"error.application.maxlength", errors, 255);
if (sessionForm.getActivityRecurringFrequency() != null) {
if (sessionForm.getActivityRecurringFrequency().equals("DAY")) {
if (sessionForm.getActivityRecurringDailyDays() != null
&& sessionForm.getActivityRecurringDailyDays().equals("")) {
validation.checkForRequired("label.activity.recurring.everyday", sessionForm
.getActivityRecurringDailyDays(), "error.application.required", errors);
}// end of if(sessionForm.getActivityRecurringDailyDays() != null &&
// sessionForm.getActivityRecurringDailyDays().equals(""))
if (sessionForm.getActivityRecurringDailyDays() != null
&& sessionForm.getActivityRecurringDailyDays().trim().equals("0")) {
validation.checkForRequired("label.activity.recurring.everydayzero", sessionForm
.getActivityRecurringDailyDays(), "error.application.required", errors);
}// end of if(sessionForm.getActivityRecurringDailyDays() != null &&
// sessionForm.getActivityRecurringDailyDays().trim().equals("0"))
}// end of if
// (sessionForm.getActivityRecurringFrequency().equals("DAY"))
if (sessionForm.getActivityRecurringFrequency().equals("WEEK")) {
if (sessionForm.getActivityRecurringWeeklyEvery() != null
&& sessionForm.getActivityRecurringWeeklyEvery().equals("")) {
validation.checkForRequired("label.activity.recurring.everyday", sessionForm
.getActivityRecurringWeeklyEvery(), "error.application.required", errors);
}// end of if(sessionForm.getActivityRecurringWeeklyEvery() != null
// && sessionForm.getActivityRecurringWeeklyEvery().equals(""))
if (sessionForm.getActivityRecurringWeeklyEvery() != null
&& sessionForm.getActivityRecurringWeeklyEvery().trim().equals("0")) {
validation.checkForRequired("label.activity.recurring.everydayzero", sessionForm
.getActivityRecurringWeeklyEvery(), "error.application.required", errors);
}// end of if(sessionForm.getActivityRecurringWeeklyEvery() != null
// &&
// sessionForm.getActivityRecurringWeeklyEvery().trim().equals("0"))
}// end of if
// (sessionForm.getActivityRecurringFrequency().equals("WEEK"))
if (sessionForm.getActivityRecurringFrequency().equals("MONTH")) {
if (sessionForm.getActivityRecurringMonthlyEvery().equals("0")) {
if (sessionForm.getActivityRecurringMonthlyEveryDay() != null
&& sessionForm.getActivityRecurringMonthlyEveryDay().equals("")) {
validation.checkForRequired("label.activity.recurring.everymonth", sessionForm
.getActivityRecurringMonthlyEveryDay(), "error.application.required", errors);
}// end of if(sessionForm.getActivityRecurringMonthlyEveryDay() !=
// null &&
// sessionForm.getActivityRecurringMonthlyEveryDay().equals(""))
if (sessionForm.getActivityRecurringMonthlyEveryDay() != null
&& sessionForm.getActivityRecurringMonthlyEveryDay().trim().equals("0")) {
validation.checkForRequired("label.activity.recurring.everymonthzero", sessionForm
.getActivityRecurringMonthlyEveryDay(), "error.application.required", errors);
}// end of if(sessionForm.getActivityRecurringMonthlyEveryDay() !=
// null &&
// sessionForm.getActivityRecurringMonthlyEveryDay().trim().equals("0"))
}// end of if
// (sessionForm.getActivityRecurringMonthlyEvery().equals("0"))
}// end of if
// (sessionForm.getActivityRecurringFrequency().equals("MONTH"))
if (sessionForm.getActivityRecurringFrequency().equals("YEAR")) {
if (sessionForm.getActivityRecurringYearlyEvery().equals("0")) {
if (sessionForm.getActivityRecurringYearlyEveryDay() != null
&& sessionForm.getActivityRecurringYearlyEveryDay().equals("")) {
validation.checkForRequired("label.activity.recurring.everymonth", sessionForm
.getActivityRecurringYearlyEveryDay(), "error.application.required", errors);
}// end of if(sessionForm.getActivityRecurringYearlyEveryDay() !=
// null &&
// sessionForm.getActivityRecurringYearlyEveryDay().equals(""))
if (sessionForm.getActivityRecurringYearlyEveryDay() != null
&& sessionForm.getActivityRecurringYearlyEveryDay().trim().equals("0")) {
validation.checkForRequired("label.activity.recurring.everymonthzero", sessionForm
.getActivityRecurringYearlyEveryDay(), "error.application.required", errors);
}// end of if(sessionForm.getActivityRecurringYearlyEveryDay() !=
// null &&
// sessionForm.getActivityRecurringYearlyEveryDay().trim().equals("0"))
}// end of if
// (sessionForm.getActivityRecurringYearlyEvery().equals("0"))
}// end of if
// (sessionForm.getActivityRecurringFrequency().equals("YEAR"))
}// end of if (sessionForm.getActivityRecurringFrequency() != null)
// if user have entered any data, then check for valid date
if (sessionForm.getActivityStartDate() != null
&& sessionForm.getActivityStartDate().length() != 0) {
validation.validateDateString("label.activity.detail.startdate", sessionForm
.getActivityStartDate(), sessionForm.getLocale(), "error.application.date", errors);
}
if (sessionForm.getActivityStartTime() != null
&& sessionForm.getActivityStartTime().length() != 0) {
validation.checkForTime("label.activity.detail.starttime", sessionForm
.getActivityStartTime(), "error.application.time", errors, sessionForm.getLocale());
}
if (sessionForm.getActivityEndDate() != null
&& sessionForm.getActivityEndDate().length() != 0) {
validation.validateDateString("label.activity.detail.enddate", sessionForm
.getActivityEndDate(), sessionForm.getLocale(), "error.application.date", errors);
}
if (sessionForm.getActivityEndTime() != null && sessionForm.getActivityEndTime().length() != 0) {
validation.checkForTime("label.activity.detail.endtime", sessionForm.getActivityEndTime(),
"error.application.time", errors, sessionForm.getLocale());
}
// TODO verify END date/time is after Start date/time
// remind date time
if (sessionForm.getActivityReminder() != null
&& sessionForm.getActivityReminder().equals("ALERT")) {
if (sessionForm.getActivityRemindDate() != null && sessionForm.getActivityRemindDate()
.length() != 0) {
validation.validateDateString("label.activity.detailremind.startdate", sessionForm
.getActivityRemindDate(), sessionForm.getLocale(), "error.application.date", errors);
}
if (sessionForm.getActivityReminderTime() != null && sessionForm
.getActivityReminderTime().length() != 0) {
validation.checkForTime("label.activity.detailremind.starttime", sessionForm
.getActivityReminderTime(), "error.application.time", errors, sessionForm.getLocale());
}
}// end of if (sessionForm.getActivityReminder() != null && ...)
// check recur date/time validity
if (sessionForm.getActivityRecurStartDate() != null && sessionForm
.getActivityRecurStartDate().length() != 0) {
validation.validateDateString("label.activity.recurring.startdate", sessionForm
.getActivityRecurStartDate(), sessionForm.getLocale(), "error.application.date", errors);
}
if (sessionForm.getActivityRecurEndDate() != null && sessionForm
.getActivityRecurEndDate().length() != 0) {
validation.validateDateString("label.activity.recurring.enddate", sessionForm
.getActivityRecurEndDate(), sessionForm.getLocale(), "error.application.date", errors);
}
// TODO verify recurring END date/time is after Start date/time
} catch (Exception e) {
logger.error("[validate]: Exception", e);