@RequestMapping("/delete/{id}") public String deleteContact(@PathVariable("id") Integer id) { logger.info("in here"); patchFileService.removePatchFile( id, securityContextHolderStrategy.getContext().getAuthentication().getName()); return "redirect:/index"; }
@RequestMapping("/index") public String listContacts(Map<String, Object> map) { if (logger.isDebugEnabled()) { logger.info("in here"); logger.debug( "name; " + securityContextHolderStrategy.getContext().getAuthentication().getName()); } map.put("patchFileList", patchFileService.list()); map.put("patchFile", new PatchFile()); map.put("user", securityContextHolderStrategy.getContext().getAuthentication().getName()); return "listFiles"; }
@RequestMapping(value = "/add", method = RequestMethod.POST) public String addPatchFile( @RequestParam("source") String source, @RequestParam("createDate") String createDate, @ModelAttribute("patchFile") PatchFile patchFile, BindingResult result) { DateTimeFormatter fmt = DateTimeFormat.forStyle("SS"); fmt.parseDateTime(createDate); patchFile.setCreationDate(fmt.parseDateTime(createDate).toDate()); patchFile.setFileList(patchFile.getFilesAsString()); patchFileService.addPatchFile( patchFile, securityContextHolderStrategy.getContext().getAuthentication().getName()); return "redirect:/index"; }
@RequestMapping("/promote/{id}/{env}") public String deployPatchFile(@PathVariable("id") Integer id, @PathVariable("env") String env) { logger.info("Deploying file to env: " + env); String username = securityContextHolderStrategy.getContext().getAuthentication().getName(); if (StringUtils.isEmpty(username)) throw new RuntimeException("No User associated with this deploy request"); String exc = null; try { patchFileService.deployPatchToEnvironment(id, env, username); } catch (Exception e) { logger.error("Could not deploy to environment " + env, e); exc = "Could not deploy to environment: " + e.getMessage(); } return "redirect:/index" + (StringUtils.isEmpty(exc) ? "" : "?deployError=" + exc); }