コード例 #1
0
  public String execute() throws Exception {
    if (name == null || name.equals(ALL)) {
      Collection<PeriodType> periodTypes = periodService.getAllPeriodTypes();

      for (PeriodType type : periodTypes) {
        periods.addAll(periodService.getPeriodsByPeriodType(type));
      }
    } else {
      PeriodType periodType = periodService.getPeriodTypeByName(name);

      ArrayList<Period> allPeriodsOfSelectedPeriodType =
          new ArrayList<Period>(periodService.getPeriodsByPeriodType(periodType));

      for (Period p : allPeriodsOfSelectedPeriodType) {
        if (!(p.getStartDate().compareTo(new Date()) > 0)) {
          periods.add(p);
        }
      }
    }

    for (Period period : periods) {
      period.setName(format.formatPeriod(period));
    }

    Collections.sort(periods, new PeriodComparator());

    return SUCCESS;
  }
  public String execute() throws Exception {
    // reportTypeName = ReportType.RT_LINELIST;

    reportTypeName = ReportType.RT_LINELIST_WEB_PORTAL;
    /* Monthly Periods */
    monthlyPeriodType = new MonthlyPeriodType();

    monthlyPeriods = new ArrayList<Period>(periodService.getPeriodsByPeriodType(monthlyPeriodType));
    Iterator<Period> periodIterator = monthlyPeriods.iterator();
    while (periodIterator.hasNext()) {
      Period p1 = periodIterator.next();

      if (p1.getStartDate().compareTo(new Date()) > 0) {
        periodIterator.remove();
      }
    }

    Collections.sort(monthlyPeriods, new PeriodComparator());
    simpleDateFormat = new SimpleDateFormat("MMM-yyyy");

    return SUCCESS;
  }