}
@RequestMapping(value="update/", method=RequestMethod.POST)
public @ResponseBody Map<String, ? extends Object> updateProject(@RequestBody Project p, HttpServletResponse response) {
Set<ConstraintViolation<Project>> failures = validator.validate(p);
Project project = this.projectService.findProjectById(p.getId());
project.setName(p.getName().trim());
project.setDescription(p.getDescription().trim());
if (!failures.isEmpty()) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return validationMessages(failures);
} else {
this.projectService.updateProject(project);
SerializableProject sp = new SerializableProject(project.getId(), project.getName(),
project.getDescription(), project.getCreationDate());
return Collections.singletonMap("project", sp);
}
}