public void start() throws TaskException { if (getChildCount() > 0) throw new TaskException("If a task has subtasks you can only report on subtasks"); if (currentPeriod == null || currentPeriod.getEndTime() < System.currentTimeMillis()) { currentPeriod = new Period(); currentPeriod.setTask(this); addPeriod(currentPeriod); ApplicationEventDispatcher.fireEvent(new TaskStartedEvent(this)); } }
public void removePeriod(Period aPeriod) { aPeriod.setTask(null); periods.remove(aPeriod); if (aPeriod == currentPeriod) currentPeriod = null; }
public void addPeriod(Period aPeriod) throws TaskException { if (getChildCount() > 0) throw new TaskException("If a task has subtasks you can only report on subtasks"); periods.add(aPeriod); aPeriod.setTask(this); }