Beispiel #1
0
 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;
 }
Beispiel #2
0
  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);
      }
    }
  }