/** * Select the Room entity for display allowing the user to confirm that they would like to delete * the entity */ @RequestMapping("/confirmDeleteRoom") public ModelAndView confirmDeleteRoom(@RequestParam Integer roomIdKey) { ModelAndView mav = new ModelAndView(); mav.addObject("room", roomDAO.findRoomByPrimaryKey(roomIdKey)); mav.setViewName("room/deleteRoom.jsp"); return mav; }
/** Show all Roomtype entities by Room */ @RequestMapping("/listRoomRoomtype") public ModelAndView listRoomRoomtype(@RequestParam Integer roomIdKey) { ModelAndView mav = new ModelAndView(); mav.addObject("room", roomDAO.findRoomByPrimaryKey(roomIdKey)); mav.setViewName("room/roomtype/listRoomtype.jsp"); return mav; }
/** Edit an existing Room entity */ @RequestMapping("/editRoom") public ModelAndView editRoom(@RequestParam Integer roomIdKey) { ModelAndView mav = new ModelAndView(); Map<Integer, String> roomTypeList = new LinkedHashMap<Integer, String>(); Set<Roomtype> roomTypeSet = roomtypeDAO.findAllRoomtypes(); Room r = roomDAO.findRoomByPrimaryKey(roomIdKey); roomTypeList.put(r.getRoomtype().getRoomTypeId(), r.getRoomtype().getRoomTypeCode()); for (Roomtype rT : roomTypeSet) { if (rT.getRoomTypeId() == r.getRoomtype().getRoomTypeId()) { continue; } roomTypeList.put(rT.getRoomTypeId(), rT.getRoomTypeCode()); } mav.addObject("room", r); mav.addObject("roomTypeList", roomTypeList); mav.setViewName("room/editRoom.jsp"); return mav; }
/** Delete an existing Room entity */ @RequestMapping("/deleteRoom") public String deleteRoom(@RequestParam Integer roomIdKey) { Room room = roomDAO.findRoomByPrimaryKey(roomIdKey); roomService.deleteRoom(room); return "forward:/indexRoom"; }