@RequestMapping(
     value = "/{id:[\\d]+}/cancel",
     method = {RequestMethod.GET})
 @ResponseBody
 public IRestResponse cancelTask(@PathVariable final long id, HttpServletRequest request)
     throws UnsupportedEncodingException {
   logger.info("Request received. URL: '/lider/task/{}/cancel'", id);
   IRestResponse restResponse = taskProcessor.cancelTask(id);
   logger.debug("Completed processing request, returning result: {}", restResponse.toJson());
   return restResponse;
 }
 @RequestMapping(
     value = "/execute",
     method = {RequestMethod.POST})
 @ResponseBody
 public IRestResponse executeTask(@RequestBody String requestBody, HttpServletRequest request)
     throws UnsupportedEncodingException {
   String requestBodyDecoded = ControllerUtils.decodeRequestBody(requestBody);
   logger.info("Request received. URL: '/lider/task/execute' Body: {}", requestBodyDecoded);
   IRestResponse restResponse = taskProcessor.execute(requestBodyDecoded);
   logger.debug("Completed processing request, returning result: {}", restResponse.toJson());
   return restResponse;
 }
 @RequestMapping(
     value = "/command/list",
     method = {RequestMethod.GET})
 @ResponseBody
 public IRestResponse listCommands(
     @RequestParam(value = "maxResults", required = false) Integer maxResults,
     HttpServletRequest request)
     throws UnsupportedEncodingException {
   logger.info("Request received. URL: '/lider/task/command/list?maxResults={}'", maxResults);
   IRestResponse restResponse = taskProcessor.listCommands(maxResults);
   logger.debug("Completed processing request, returning result: {}", restResponse.toJson());
   return restResponse;
 }
 @RequestMapping(
     value = "/{id:[\\d]+}/reschedule",
     method = {RequestMethod.GET})
 @ResponseBody
 public IRestResponse rescheduleTask(
     @PathVariable final long id,
     @RequestParam(value = "cronExpression", required = true) String cronExpression,
     HttpServletRequest request)
     throws UnsupportedEncodingException {
   logger.info(
       "Request received. URL: '/lider/task/{}/reschedule?cronExpression={}'",
       new Object[] {id, cronExpression});
   IRestResponse restResponse = taskProcessor.rescheduleTask(id, cronExpression);
   logger.debug("Completed processing request, returning result: {}", restResponse.toJson());
   return restResponse;
 }
 /**
  * List commands according to given parameters.
  *
  * @param pluginName
  * @param pluginVersion
  * @param createDateRangeStart
  * @param createDateRangeEnd
  * @param status
  * @param maxResults
  * @param request
  * @return
  * @throws UnsupportedEncodingException
  */
 @RequestMapping(
     value = "/list/executed",
     method = {RequestMethod.GET})
 @ResponseBody
 public IRestResponse listExecutedTasks(
     @RequestParam(value = "pluginName", required = false) String pluginName,
     @RequestParam(value = "onlyFutureTasks", required = false, defaultValue = "false")
         Boolean onlyFutureTasks,
     @RequestParam(value = "onlyScheduledTasks", required = false, defaultValue = "false")
         Boolean onlyScheduledTasks,
     @RequestParam(value = "createDateRangeStart", required = false) Long createDateRangeStart,
     @RequestParam(value = "createDateRangeEnd", required = false) Long createDateRangeEnd,
     @RequestParam(value = "status", required = false) Integer status,
     @RequestParam(value = "maxResults", required = false) Integer maxResults,
     HttpServletRequest request)
     throws UnsupportedEncodingException {
   logger.debug(
       "Request received. URL: '/lider/task/list/executed?pluginName={}&onlyFutureTasks={}&onlyScheduledTasks={}&createDateRangeStart={}&createDateRangeEnd={}&status={}&maxResults={}'",
       new Object[] {
         pluginName,
         onlyFutureTasks,
         onlyScheduledTasks,
         createDateRangeStart,
         createDateRangeEnd,
         status,
         maxResults
       });
   IRestResponse restResponse =
       taskProcessor.listExecutedTasks(
           pluginName,
           onlyFutureTasks,
           onlyScheduledTasks,
           createDateRangeStart != null ? new Date(createDateRangeStart) : null,
           createDateRangeEnd != null ? new Date(createDateRangeEnd) : null,
           status,
           maxResults);
   logger.debug("Completed processing request, returning result: {}", restResponse.toJson());
   return restResponse;
 }