Search in sources :

Example 1 with EProblemReportStatus

use of org.onebusaway.transit_data.model.problems.EProblemReportStatus in project onebusaway-application-modules by camsys.

the class UserReportingServiceImpl method getTripProblemReportSummaries.

@Override
public ListBean<TripProblemReportSummaryBean> getTripProblemReportSummaries(TripProblemReportQueryBean query, ETripProblemGroupBy groupBy) {
    List<T2<Object, Integer>> records = _userReportingDao.getTripProblemReportSummaries(query, groupBy);
    List<TripProblemReportSummaryBean> beans = new ArrayList<TripProblemReportSummaryBean>(records.size());
    for (T2<Object, Integer> record : records) {
        TripProblemReportSummaryBean bean = new TripProblemReportSummaryBean();
        bean.setCount(record.getSecond());
        switch(groupBy) {
            case TRIP:
                {
                    AgencyAndId tripId = (AgencyAndId) record.getFirst();
                    bean.setTrip(_tripBeanService.getTripForId(tripId));
                    break;
                }
            case STATUS:
                {
                    EProblemReportStatus status = (EProblemReportStatus) record.getFirst();
                    bean.setStatus(status);
                    break;
                }
            case LABEL:
                {
                    String label = (String) record.getFirst();
                    bean.setLabel(label);
                    break;
                }
        }
        beans.add(bean);
    }
    return new ListBean<TripProblemReportSummaryBean>(beans, false);
}
Also used : TripProblemReportSummaryBean(org.onebusaway.transit_data.model.problems.TripProblemReportSummaryBean) AgencyAndId(org.onebusaway.gtfs.model.AgencyAndId) ArrayList(java.util.ArrayList) EProblemReportStatus(org.onebusaway.transit_data.model.problems.EProblemReportStatus) ListBean(org.onebusaway.transit_data.model.ListBean) T2(org.onebusaway.collections.tuple.T2)

Aggregations

ArrayList (java.util.ArrayList)1 T2 (org.onebusaway.collections.tuple.T2)1 AgencyAndId (org.onebusaway.gtfs.model.AgencyAndId)1 ListBean (org.onebusaway.transit_data.model.ListBean)1 EProblemReportStatus (org.onebusaway.transit_data.model.problems.EProblemReportStatus)1 TripProblemReportSummaryBean (org.onebusaway.transit_data.model.problems.TripProblemReportSummaryBean)1