Exemplo n.º 1
0
  @RequestMapping(value = "list", method = RequestMethod.GET)
  @ResponseStatus(HttpStatus.OK)
  @ResponseBody
  public Response list(
      @RequestParam(defaultValue = "") String startDate,
      @RequestParam(defaultValue = "") String endDate,
      @RequestParam(defaultValue = "") String jobName,
      @RequestParam(defaultValue = "WORKFLOW") String jobType,
      @RequestParam(defaultValue = "0") long engineId,
      @RequestParam(defaultValue = "ALL") String status,
      @RequestParam(defaultValue = "ID") String sort,
      @RequestParam(defaultValue = "DESC") String dir,
      @RequestParam(defaultValue = "0") int start,
      @RequestParam(defaultValue = "16") int limit) {

    Response response = new Response();
    try {
      Engine engine = engineService.getEngine(engineId);
      List<Map> jobs = jobService.getJobs(engine);
      response.getList().addAll(jobs);
      response.setTotal(jobs.size());
      response.getMap().put("current", jobService.getCurrentDate(engine));
      response.setSuccess(true);
    } catch (Exception ex) {
      response.setSuccess(false);
      response.getError().setMessage("배치 작업 목록을 조회할 수 없습니다.");
      if (ex.getCause() != null) response.getError().setCause(ex.getMessage());
      response.getError().setException(ExceptionUtils.getFullStackTrace(ex));
    }
    return response;
  }
Exemplo n.º 2
0
 @RequestMapping(value = "regist", method = RequestMethod.POST)
 @ResponseStatus(HttpStatus.OK)
 @ResponseBody
 public Response regist(@RequestBody Map<String, String> params) {
   Response response = new Response();
   try {
     String jobId =
         jobService.regist(
             Long.parseLong(params.get("engineId")),
             params.get("jobName"),
             Long.parseLong(params.get("wid")),
             params.get("cron"),
             new HashMap());
     response.setSuccess(true);
     response.getMap().put("jobId", jobId);
   } catch (Exception ex) {
     response.setSuccess(false);
     response.getError().setMessage("배치 작업을 등록할 수 없습니다.");
     if (ex.getCause() != null) response.getError().setCause(ex.getMessage());
     response.getError().setException(ExceptionUtils.getFullStackTrace(ex));
   }
   return response;
 }