}
}
private String getCronExpression(ScheduledScan scheduledScan) {
DayInWeek dayInWeek = DayInWeek.getDay(scheduledScan.getDay());
ScheduledFrequencyType frequencyType = ScheduledFrequencyType.getFrequency(scheduledScan.getFrequency());
ScheduledPeriodType scheduledPeriodType = ScheduledPeriodType.getPeriod(scheduledScan.getPeriod());
String cronExpression = null;
// Set DayOfWeek is ? if schedule daily, and MON-SUN otherwise
String day = "?";
if (frequencyType == ScheduledFrequencyType.WEEKLY) {
if (dayInWeek == null) {
log.warn("Unable to schedule ScheduledScanId " + scheduledScan.getId() + " " + scheduledScan.getFrequency() + " " + scheduledScan.getDay());
return cronExpression;
}
day = Strings.toUpperCase(dayInWeek.getDay());
}
// Set DayOfMonth is ? if schedule weekly, and * otherwise
String dayOfMonth = (ScheduledFrequencyType.WEEKLY ==
frequencyType?"?":"*");