From db546bbe84d1b7d765241d9396f429cc0c50dee3 Mon Sep 17 00:00:00 2001
From: abobrov <abobrov@localhost>
Date: Thu, 01 Oct 2009 12:28:35 +0000
Subject: [PATCH] - [Issue 4257]  deleting recurring task throws error : rework recurring tasks and iterations cancellation process.

---
 opends/src/server/org/opends/server/backends/task/RecurringTask.java |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/task/RecurringTask.java b/opends/src/server/org/opends/server/backends/task/RecurringTask.java
index 1554835..8c26fe5 100644
--- a/opends/src/server/org/opends/server/backends/task/RecurringTask.java
+++ b/opends/src/server/org/opends/server/backends/task/RecurringTask.java
@@ -386,17 +386,18 @@
 
   /**
    * Schedules the next iteration of this recurring task for processing.
-   *
+   * @param  calendar date and time to schedule next iteration from.
    * @return The task that has been scheduled for processing.
    * @throws DirectoryException to indicate an error.
    */
-  public Task scheduleNextIteration() throws DirectoryException
+  public Task scheduleNextIteration(GregorianCalendar calendar)
+          throws DirectoryException
   {
     Task nextTask = null;
     Date nextTaskDate = null;
 
     try {
-      nextTaskDate = getNextIteration();
+      nextTaskDate = getNextIteration(calendar);
     } catch (IllegalArgumentException e) {
       throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
         ERR_RECURRINGTASK_INVALID_TOKENS_COMBO.get(
@@ -596,13 +597,14 @@
 
   /**
    * Get next task iteration date according to recurring schedule.
+   * @param  calendar date and time to schedule from.
    * @return next task iteration date.
    * @throws IllegalArgumentException if recurring schedule is invalid.
    */
-  private Date getNextIteration() throws IllegalArgumentException
+  private Date getNextIteration(GregorianCalendar calendar)
+          throws IllegalArgumentException
   {
     int minute, hour, day, month, weekday;
-    GregorianCalendar calendar = new GregorianCalendar();
     calendar.setFirstDayOfWeek(GregorianCalendar.SUNDAY);
     calendar.add(GregorianCalendar.MINUTE, 1);
     calendar.set(GregorianCalendar.SECOND, 0);

--
Gitblit v1.10.0