public String execute() throws Exception { String periodType = "Quarterly"; // periodType = periodType != null && !periodType.isEmpty() ? periodType : // MonthlyPeriodType.NAME; CalendarPeriodType _periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName(periodType); int thisYear = Calendar.getInstance().get(Calendar.YEAR); int currentYear = (Integer) SessionUtils.getSessionVar(SessionUtils.KEY_CURRENT_YEAR, thisYear); Calendar cal = PeriodType.createCalendarInstance(); // Cannot go to next year if current year equals this year if (!(currentYear == thisYear && year > 0)) { cal.set(Calendar.YEAR, currentYear); cal.add(Calendar.YEAR, year); SessionUtils.setSessionVar(SessionUtils.KEY_CURRENT_YEAR, cal.get(Calendar.YEAR)); } periods = _periodType.generatePeriods(cal.getTime()); FilterUtils.filter(periods, new PastAndCurrentPeriodFilter()); Collections.reverse(periods); for (Period period : periods) { period.setName(format.formatPeriod(period)); } return SUCCESS; }