Search in sources :

Example 6 with StopResult

use of org.onebusaway.enterprise.webapp.actions.m.model.StopResult in project onebusaway-application-modules by camsys.

the class IndexAction method getUniqueServiceAlertsForResults.

public Set<String> getUniqueServiceAlertsForResults() {
    Set<String> uniqueServiceAlerts = new HashSet<String>();
    for (SearchResult _result : _results.getMatches()) {
        if (_results.getResultType().equals("RouteResult")) {
            RouteResult result = (RouteResult) _result;
            uniqueServiceAlerts.addAll(result.getServiceAlerts());
        } else if (_results.getResultType().equals("StopResult")) {
            StopResult result = (StopResult) _result;
            for (RouteAtStop route : result.getAllRoutesAvailable()) {
                uniqueServiceAlerts.addAll(route.getServiceAlerts());
            }
        }
    }
    return uniqueServiceAlerts;
}
Also used : RouteResult(org.onebusaway.enterprise.webapp.actions.m.model.RouteResult) SearchResult(org.onebusaway.presentation.model.SearchResult) RouteAtStop(org.onebusaway.enterprise.webapp.actions.m.model.RouteAtStop) StopResult(org.onebusaway.enterprise.webapp.actions.m.model.StopResult) HashSet(java.util.HashSet)

Example 7 with StopResult

use of org.onebusaway.enterprise.webapp.actions.m.model.StopResult in project onebusaway-application-modules by camsys.

the class SearchResultFactoryImplTest method testGetStopResultServiceAlertWithSummariesOnly.

@Test
public void testGetStopResultServiceAlertWithSummariesOnly() {
    StopResult result = runGetStopResult(createServiceAlerts(new String[] {}, new String[] { TEST_SUMMARY }));
    assertEquals(1, result.getAllRoutesAvailable().size());
    Set<String> alerts = result.getAllRoutesAvailable().get(0).getServiceAlerts();
    assertEquals(1, alerts.size());
    assertEquals(TEST_SUMMARY, alerts.toArray()[0]);
    assertEquals("name not expected", TEST_STOP_ID, result.getId());
}
Also used : Matchers.anyString(org.mockito.Matchers.anyString) StopResult(org.onebusaway.enterprise.webapp.actions.m.model.StopResult) Test(org.junit.Test)

Aggregations

StopResult (org.onebusaway.enterprise.webapp.actions.m.model.StopResult)7 Matchers.anyString (org.mockito.Matchers.anyString)5 Test (org.junit.Test)4 HashSet (java.util.HashSet)3 ArrayList (java.util.ArrayList)2 RouteAtStop (org.onebusaway.enterprise.webapp.actions.m.model.RouteAtStop)2 NameBean (org.onebusaway.transit_data.model.NameBean)2 RouteBean (org.onebusaway.transit_data.model.RouteBean)2 StopGroupBean (org.onebusaway.transit_data.model.StopGroupBean)2 StopGroupingBean (org.onebusaway.transit_data.model.StopGroupingBean)2 StopsForRouteBean (org.onebusaway.transit_data.model.StopsForRouteBean)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 RouteDirection (org.onebusaway.enterprise.webapp.actions.m.model.RouteDirection)1 RouteResult (org.onebusaway.enterprise.webapp.actions.m.model.RouteResult)1 StopOnRoute (org.onebusaway.enterprise.webapp.actions.m.model.StopOnRoute)1 SearchResult (org.onebusaway.presentation.model.SearchResult)1 StopBean (org.onebusaway.transit_data.model.StopBean)1