Search in sources :

Example 1 with SkipValidation

use of org.apache.struts2.interceptor.validation.SkipValidation in project onebusaway-application-modules by camsys.

the class ServiceAlertsAction method execute.

@SkipValidation
@Override
public String execute() {
    _log.info("ServiceAlerts.execute()");
    /*
    if (submit) {
        _log.info("Service Alert submitted");
        //doSubmit();
        //return "submitResult";
     }
     if (clear) {
       _log.info("Service Alert cleared");
        //doClear();
        //return "clearResult";
     }
     */
    // Check that we have permission:
    super.execute();
    try {
        _agencies = _transitDataService.getAgenciesWithCoverage();
        _situationsByAgency = new List[_agencies.size()];
        // for (AgencyWithCoverageBean agency : _agencies) {
        for (int i = 0; i < _agencies.size(); ++i) {
            AgencyWithCoverageBean agency = _agencies.get(i);
            String agencyId = agency.getAgency().getId();
            ListBean<ServiceAlertRecordBean> result = _transitDataService.getAllServiceAlertRecordsForAgencyId(agencyId);
            List<ServiceAlertRecordBean> serviceAlerts = result.getList();
            _situationsByAgency[i] = serviceAlerts;
        }
        for (int i = 0; i < _agencies.size(); ++i) {
            _log.info("Agency " + _agencies.get(i).getAgency().getId());
            List<ServiceAlertRecordBean> serviceAlerts = _situationsByAgency[i];
            for (ServiceAlertRecordBean serviceAlert : serviceAlerts) {
                _log.info("   Alert: " + serviceAlert.getServiceAlertBean().getSummaries().get(0));
            }
        }
    } catch (Throwable t) {
        _log.error("unable to retrieve agencies with coverage", t);
        _log.error("issue connecting to TDS -- check your configuration in data-sources.xml");
        throw new RuntimeException("Check your onebusaway-nyc-transit-data-federation-webapp configuration", t);
    }
    return SUCCESS;
}
Also used : ServiceAlertRecordBean(org.onebusaway.transit_data.model.service_alerts.ServiceAlertRecordBean) AgencyWithCoverageBean(org.onebusaway.transit_data.model.AgencyWithCoverageBean) SkipValidation(org.apache.struts2.interceptor.validation.SkipValidation)

Aggregations

SkipValidation (org.apache.struts2.interceptor.validation.SkipValidation)1 AgencyWithCoverageBean (org.onebusaway.transit_data.model.AgencyWithCoverageBean)1 ServiceAlertRecordBean (org.onebusaway.transit_data.model.service_alerts.ServiceAlertRecordBean)1