@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, produces = "text/html") public String delete( @PathVariable("id") Long id, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) { ConfigLiveJwplayer configLiveJwplayer = configLiveJwplayerRepository.findOne(id); configLiveJwplayerRepository.delete(configLiveJwplayer); uiModel.asMap().clear(); uiModel.addAttribute("page", (page == null) ? "1" : page.toString()); uiModel.addAttribute("size", (size == null) ? "10" : size.toString()); return "redirect:/configlivejwplayers"; }
@RequestMapping(produces = "text/html") public String list( @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, Model uiModel) { if (page != null || size != null) { int sizeNo = size == null ? 10 : size.intValue(); final int firstResult = page == null ? 0 : (page.intValue() - 1) * sizeNo; uiModel.addAttribute( "configlivejwplayers", configLiveJwplayerRepository .findAll( new org.springframework.data.domain.PageRequest(firstResult / sizeNo, sizeNo)) .getContent()); float nrOfPages = (float) configLiveJwplayerRepository.count() / sizeNo; uiModel.addAttribute( "maxPages", (int) ((nrOfPages > (int) nrOfPages || nrOfPages == 0.0) ? nrOfPages + 1 : nrOfPages)); } else { uiModel.addAttribute("configlivejwplayers", configLiveJwplayerRepository.findAll()); } return "configlivejwplayers/list"; }
@RequestMapping(method = RequestMethod.PUT, produces = "text/html") public String update( @Valid ConfigLiveJwplayer configLiveJwplayer, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) { if (bindingResult.hasErrors()) { populateEditForm(uiModel, configLiveJwplayer); return "configlivejwplayers/update"; } uiModel.asMap().clear(); configLiveJwplayerRepository.save(configLiveJwplayer); return "redirect:/configlivejwplayers/" + encodeUrlPathSegment(configLiveJwplayer.getId().toString(), httpServletRequest); }
@RequestMapping(value = "/{id}", params = "form", produces = "text/html") public String updateForm(@PathVariable("id") Long id, Model uiModel) { populateEditForm(uiModel, configLiveJwplayerRepository.findOne(id)); return "configlivejwplayers/update"; }
@RequestMapping(value = "/{id}", produces = "text/html") public String show(@PathVariable("id") Long id, Model uiModel) { uiModel.addAttribute("configlivejwplayer", configLiveJwplayerRepository.findOne(id)); uiModel.addAttribute("itemId", id); return "configlivejwplayers/show"; }