@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; }
/** * 지정한 조건의 파일 처리 이력을 조회한다. * * @param startDate 시작 날짜 * @param endDate 종료 날짜 * @param path 조회할 경로 * @param engineId 워크플로우 엔진 * @param type 파일 처리 유형 * @param start 시작 페이지 * @param limit 페이지당 건수 * @return 파일 처리 목록 */ @RequestMapping(value = "list", method = RequestMethod.GET) @ResponseStatus(HttpStatus.OK) @ResponseBody public Response getAuditHistories( @RequestParam(defaultValue = "") String startDate, @RequestParam(defaultValue = "") String endDate, @RequestParam(defaultValue = "") String path, @RequestParam(defaultValue = "0") long engineId, @RequestParam(defaultValue = "ALL") String type, @RequestParam(defaultValue = "0") int start, @RequestParam(defaultValue = "0") int page, @RequestParam(defaultValue = "16") int limit) { Response response = new Response(); try { Engine engine = engineService.getEngine(engineId); FileSystemAuditService auditService = (FileSystemAuditService) lookupService.getService(RemoteService.AUDIT, engine); response.setSuccess(true); List<AuditHistory> auditHistories = auditService.getAuditHistories( startDate, endDate, path, SessionUtils.getUsername(), type, "WORK_DATE", "DESC", start, limit); response.getList().addAll(auditHistories); response.setTotal( auditService.getTotalCountOfAuditHistories( startDate, endDate, path, type, SessionUtils.getUsername())); } catch (Exception ex) { response.setSuccess(false); response.getError().setMessage(ex.getMessage()); if (ex.getCause() != null) response.getError().setCause(ex.getCause().getMessage()); response.getError().setException(ExceptionUtils.getFullStackTrace(ex)); } return response; }
@RequestMapping(value = "valid", method = RequestMethod.POST) @ResponseStatus(HttpStatus.OK) @ResponseBody public Response isValidCronExpression(@RequestParam String cronExpression) { Response response = new Response(); try { CronExpression.isValidExpression(cronExpression); response.setSuccess(true); } catch (Exception ex) { response.setSuccess(false); response.getError().setMessage("유효하지 않은 Cron Expression입니다."); if (ex.getCause() != null) response.getError().setCause(ex.getMessage()); response.getError().setException(ExceptionUtils.getFullStackTrace(ex)); } return response; }
@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; }