final double numberOfIdealDays, final String shortDescription,
final int developperPersistanceId, final int persistanceId,
final long persistanceVersion) {
// find the story
Story story = storyRepository.findByPersistanceId(storyPersistanceId);
// if the story is not found, return a global error
if (story == null) {
Errors errros = AgilePlanningObjectFactory.getErrors();
errros.reject("story.doesntExistsInDatabase");
return errros;
}
// else, build the object to persist
Task task = AgilePlanningObjectFactory.getTask();
User user = CoreObjectFactory.getUser();
user.setPersistanceId(developperPersistanceId);
task.setOwner(user);
task.setPersistanceId(persistanceId);
task.setPersistanceVersion(persistanceVersion);
task.setDaysEstimated(numberOfIdealDays);
task.setShortDescription(shortDescription);
// validate
Errors errors = taskValidator.validate(task);
if (!errors.hasErrors()) {
// find the task to update
for (Iterator iterator = story.getTasks().iterator(); iterator
.hasNext();) {
Task taskToUpdate = (Task) iterator.next();
if (task.getPersistanceId() == taskToUpdate.getPersistanceId()) {