u.getEstimatedSize(), u.getAcceptanceTest());
}
@RequestMapping(value="userstory/update/", method=RequestMethod.POST)
public @ResponseBody Map<String, ? extends Object> updateUserstory(@RequestBody UserStory u, HttpServletResponse response) {
UserStory us = this.userStoryService.findUserStoryById(u.getId());
us.setName(u.getName().trim());
us.setPriority(u.getPriority());
us.setEstimatedSize(u.getEstimatedSize());
us.setAcceptanceTest(u.getAcceptanceTest().trim());
Set<ConstraintViolation<UserStory>> failures = validator.validate(us);
if (!failures.isEmpty()) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
return validationMessagesUserstory(failures);
} else {
this.userStoryService.updateUserStory(us);
return Collections.singletonMap("userstory",
new SerializableUserStory(
us.getId(),
us.getName(),
us.getPriority(),
us.getCreationDate(),
us.getEstimatedSize(),
us.getAcceptanceTest()
)
);
}
}