}
@Override
public String execute() {
AgencyBean agency = _transitDataService.getAgency(_agencyId);
if (agency == null)
return INPUT;
Calendar c = Calendar.getInstance();
long timeTo = c.getTimeInMillis();
c.add(Calendar.DAY_OF_WEEK, -_days);
long timeFrom = c.getTimeInMillis();
TripProblemReportQueryBean query = new TripProblemReportQueryBean();
query.setAgencyId(_agencyId);
query.setTimeFrom(timeFrom);
query.setTimeTo(timeTo);
if (_status != null)
query.setStatus(EProblemReportStatus.valueOf(_status));
query.setLabel(_label);
ListBean<TripProblemReportBean> result = _transitDataService.getTripProblemReports(query);
List<TripProblemReportBean> reports = result.getList();
_feed = new SyndFeedImpl();
StringBuilder title = new StringBuilder();
title.append(getText("rss.OneBusAwayTripProblemReports"));
title.append(" - ");
title.append(agency.getName());
title.append(" - ");
title.append(getText("rss.LastXDays", Arrays.asList((Object) _days)));
HttpServletRequest request = ServletActionContext.getRequest();
StringBuilder b = new StringBuilder();
b.append("http://");
b.append(request.getServerName());
if (request.getServerPort() != 80)
b.append(":").append(request.getServerPort());
if (request.getContextPath() != null)
b.append(request.getContextPath());
String baseUrl = b.toString();
_feed.setTitle(title.toString());
_feed.setLink(baseUrl);
_feed.setDescription(getText("rss.UserSubmittedTripProblemReports",
Arrays.asList((Object) agency.getName(), _days)));
List<SyndEntry> entries = new ArrayList<SyndEntry>();
_feed.setEntries(entries);
for (TripProblemReportBean report : reports) {