>From 47e51b58cbbc21b4fc6c3df90c2f474a98d52ade Mon Sep 17 00:00:00 2001
From: Aron Parsons <[email protected]>
Date: Tue, 20 Jul 2010 11:34:58 -0400
Subject: [PATCH] added new API call schedule.rescheduleActions

---
 .../frontend/xmlrpc/schedule/ScheduleHandler.java  |   31 ++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/schedule/ScheduleHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/schedule/ScheduleHandler.java
index e8aba1e..fd1b997 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/schedule/ScheduleHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/schedule/ScheduleHandler.java
@@ -259,4 +259,35 @@ public class ScheduleHandler extends BaseHandler {
         dr.elaborate();
         return dr.toArray();
     }
+
+    /**
+     * Reschedule all actions in the given list.
+     * @param sessionKey The sessionkey for the session containing the logged in user.
+     * @param actionIds The list of ids for actions to reschedule.
+     * @return Returns a list of actions with details
+     * @throws FaultException A FaultException is thrown if one of the actions provided
+     * is invalid.
+     *
+     * @xmlrpc.doc Reschedule all actions in the given list.
+     * @xmlrpc.param #session_key()
+     * @xmlrpc.param #array_single("int", "action id")
+     * @xmlrpc.param #param_desc("boolean", "onlyFailed",
+     *               "True to only reschedule failed actions, False to reschedule all")
+     * @xmlrpc.returntype #return_int_success()
+     */
+    public int rescheduleActions(String sessionKey, List<Integer> actionIds, boolean onlyFailed)
+        throws FaultException {
+
+        // Get the logged in user
+        User loggedInUser = getLoggedInUser(sessionKey);
+
+        for (Integer actionId : actionIds) {
+            Action action = ActionManager.lookupAction(loggedInUser, new Long(actionId));
+            if (action != null) {
+                ActionManager.rescheduleAction(action, onlyFailed);
+            }
+        }
+
+        return 1;
+    }
 }
-- 
1.5.5.6

_______________________________________________
Spacewalk-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to