/** * Shows the view contact page * * @param id The id of the viewed contact. * @param model The model. * @return The name of the view contact view. * @throws NotFoundException if not contact is found iwth the given id. */ @RequestMapping(value = "/contact/{id}", method = RequestMethod.GET) public String showContactPage(@PathVariable("id") Long id, Model model) throws NotFoundException { LOGGER.debug("Showing contact page for contact with id: {}", id); Contact found = service.findById(id); LOGGER.debug("Found contact: {}", found); model.addAttribute(MODEL_ATTRIBUTE_CONTACT, found); return CONTACT_VIEW; }
/** * Shows update contact page. * * @param id The id of the updated contact. * @param model The model. * @return The name of the update contact view. * @throws NotFoundException if no contact is found with the given id. */ @RequestMapping(value = "/contact/update/{id}", method = RequestMethod.GET) public String showUpdateContactPage(@PathVariable("id") Long id, Model model) throws NotFoundException { LOGGER.debug("Showing edit contact for a contact with id: {}", id); Contact updated = service.findById(id); LOGGER.debug("Found contact: {}", updated); ContactDTO formObject = createFormObject(updated); model.addAttribute(MODEL_ATTRIBUTE_CONTACT, formObject); return UPDATE_CONTACT_VIEW; }