Prev | Current Page 700 | Next

Frank Zammetti

"Practical DWR 2 Projects"

We set the trigger to start immediately
by calling trigger.setStartTime(new Date());, we give the Trigger itself a unique name
based on the constructed unique report name, and finally we call scheduleJob() on the
Scheduler instance, and we??™re done.
Removing a report from the scheduler is also a pretty easy exercise and is rather similar to
adding it:
public List removeReportFromSchedule(
final String inReportName, final String inDaysOfWeek,
final String inRunTime) throws Exception {
Map tokens = new HashMap();
tokens.put("reportname", inReportName);
tokens.put("daysofweek", inDaysOfWeek);
tokens.put("runtime", inRunTime);
databaseWorker.executeUpdate(SQL_DELETE_REPORT_FROM_SCHEDULE, tokens);
CHAPTER 7 n ENTER THE ENTERPRISE: A DWR-BASED REPORT PORTAL 414
StringTokenizer st = new StringTokenizer(inRunTime, ":");
String hour = st.nextToken();
String minute = st.nextToken();
st = new StringTokenizer(inDaysOfWeek, ",");
while (st.hasMoreTokens()) {
String day = st.nextToken();
String reportName = inReportName + hour + minute + day;
sched.deleteJob(reportName, null));
}
return getScheduledReportsList();
} catch (Exception e) {
e.


Pages:
688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712