Package net.petrikainulainen.spring.datajpa.model

Examples of net.petrikainulainen.spring.datajpa.model.Person


    @Transactional(rollbackFor = PersonNotFoundException.class)
    @Override
    public Person update(PersonDTO updated) throws PersonNotFoundException {
        LOGGER.debug("Updating person with information: " + updated);
       
        Person person = personRepository.findOne(updated.getId());
       
        if (person == null) {
            LOGGER.debug("No person found with id: " + updated.getId());
            throw new PersonNotFoundException();
        }
       
        person.update(updated.getFirstName(), updated.getLastName());

        return person;
    }
View Full Code Here


    @RequestMapping(value = "/person/delete/{id}", method = RequestMethod.GET)
    public String delete(@PathVariable("id") Long id, RedirectAttributes attributes) {
        LOGGER.debug("Deleting person with id: " + id);

        try {
            Person deleted = personService.delete(id);
            addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_PERSON_DELETED, deleted.getName());
        } catch (PersonNotFoundException e) {
            LOGGER.debug("No person found with id: " + id);
            addErrorMessage(attributes, ERROR_MESSAGE_KEY_DELETED_PERSON_WAS_NOT_FOUND);
        }
View Full Code Here

        if (bindingResult.hasErrors()) {
            return PERSON_ADD_FORM_VIEW;
        }
               
        Person person = personService.create(created);

        addFeedbackMessage(attributes, FEEDBACK_MESSAGE_KEY_PERSON_CREATED, person.getName());

        return createRedirectViewPath(REQUEST_MAPPING_LIST);
    }
View Full Code Here

TOP

Related Classes of net.petrikainulainen.spring.datajpa.model.Person

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.