public Sprint createNextSprint() { Sprint sprint = sprintDao.newEntityInstance(); sprint.setProject(this); sprint.setLabel("Next Sprint"); if (isCurrentSprintSet()) { sprint.setBegin(getCurrentSprint().getEnd()); Integer length = getCurrentSprint().getLengthInDays(); if (length != null) sprint.setEnd(sprint.getBegin().addDays(length)); } sprintDao.saveEntity(sprint); setNextSprint(sprint); return sprint; }
private void fillSprintBacklog(ContextBuilder context) { Sprint sprint = project.getCurrentSprint(); context.put("label", sprint.getLabel()); context.put("goal", wiki2html(sprint.getGoal())); context.put("begin", sprint.getBegin().toString(Date.FORMAT_LONGMONTH_DAY_YEAR)); context.put("end", sprint.getEnd().toString(Date.FORMAT_LONGMONTH_DAY_YEAR)); Release release = sprint.getRelease(); if (release != null) context.put("release", release.getLabel()); List<Requirement> requirements = new ArrayList<Requirement>(sprint.getRequirements()); Collections.sort(requirements, project.getRequirementsOrderComparator()); for (Requirement requirement : requirements) { fillStory(context.addSubContext("stories"), requirement); } }
public void switchToNextSprint() { Sprint oldSprint = getCurrentSprint(); oldSprint.close(); oldSprint.setEnd(Date.today()); getCurrentSprintSnapshot().update(); Sprint newSprint = getNextSprint(); if (newSprint == null) newSprint = createNextSprint(); if (!newSprint.isBeginSet() || newSprint.getBegin().isPast()) newSprint.setBegin(Date.today()); if (!newSprint.isEndSet() || newSprint.getEnd().isBeforeOrSame(newSprint.getBegin())) newSprint.setEnd(newSprint.getBegin().addDays(oldSprint.getLengthInDays())); setCurrentSprint(newSprint); createNextSprint(); createSprintSnapshot(); for (Task task : oldSprint.getTasks()) { if (task.isClosed()) { taskDao.deleteEntity(task); } } }