Search in sources :

Example 1 with VehicleIdFilter

use of org.onebusaway.admin.search.impl.VehicleIdFilter in project onebusaway-application-modules by camsys.

the class VehicleSearchServiceImpl method buildFilters.

private List<Filter<VehicleStatus>> buildFilters(Map<VehicleSearchParameters, String> searchParameters) {
    List<Filter<VehicleStatus>> filters = new ArrayList<Filter<VehicleStatus>>();
    // Since all parameters are optional we have to look for each one
    // To-do: there might be a better way of doing this
    String vehicleId = searchParameters.get(VehicleSearchParameters.VEHICLE_ID);
    if (StringUtils.isNotBlank(vehicleId)) {
        filters.add(new VehicleIdFilter(vehicleId));
    }
    String route = searchParameters.get(VehicleSearchParameters.ROUTE);
    if (StringUtils.isNotBlank(route)) {
        filters.add(new RouteFilter(route));
    }
    String inferredPhase = searchParameters.get(VehicleSearchParameters.INFERRED_PHASE);
    if (!inferredPhase.equalsIgnoreCase("All")) {
        filters.add(new InferredPhaseFilter(inferredPhase));
    }
    String dsc = searchParameters.get(VehicleSearchParameters.DSC);
    if (StringUtils.isNotBlank(dsc)) {
        filters.add(new DSCFilter(dsc));
    }
    String depot = searchParameters.get(VehicleSearchParameters.DEPOT);
    if (!depot.equalsIgnoreCase("All")) {
        filters.add(new DepotFilter(depot));
    }
    String pulloutStatus = searchParameters.get(VehicleSearchParameters.PULLOUT_STATUS);
    if (!pulloutStatus.equalsIgnoreCase("All")) {
        filters.add(new PulloutStatusFilter());
    }
    String emergencyStatus = searchParameters.get(VehicleSearchParameters.EMERGENCY_STATUS);
    if (emergencyStatus.equalsIgnoreCase("true")) {
        filters.add(new EmergencyStatusFilter());
    }
    String formalInferrence = searchParameters.get(VehicleSearchParameters.FORMAL_INFERRENCE);
    if (formalInferrence.equalsIgnoreCase("true")) {
        filters.add(new FormalInferrenceFilter());
    }
    return filters;
}
Also used : DepotFilter(org.onebusaway.admin.search.impl.DepotFilter) PulloutStatusFilter(org.onebusaway.admin.search.impl.PulloutStatusFilter) InferredPhaseFilter(org.onebusaway.admin.search.impl.InferredPhaseFilter) ArrayList(java.util.ArrayList) RouteFilter(org.onebusaway.admin.search.impl.RouteFilter) VehicleIdFilter(org.onebusaway.admin.search.impl.VehicleIdFilter) DSCFilter(org.onebusaway.admin.search.impl.DSCFilter) PulloutStatusFilter(org.onebusaway.admin.search.impl.PulloutStatusFilter) Filter(org.onebusaway.admin.search.Filter) DepotFilter(org.onebusaway.admin.search.impl.DepotFilter) FormalInferrenceFilter(org.onebusaway.admin.search.impl.FormalInferrenceFilter) RouteFilter(org.onebusaway.admin.search.impl.RouteFilter) InferredPhaseFilter(org.onebusaway.admin.search.impl.InferredPhaseFilter) RevenueServiceFilter(org.onebusaway.admin.search.impl.RevenueServiceFilter) TimeWindowFilter(org.onebusaway.admin.search.impl.TimeWindowFilter) DSCFilter(org.onebusaway.admin.search.impl.DSCFilter) EmergencyStatusFilter(org.onebusaway.admin.search.impl.EmergencyStatusFilter) VehicleIdFilter(org.onebusaway.admin.search.impl.VehicleIdFilter) FormalInferrenceFilter(org.onebusaway.admin.search.impl.FormalInferrenceFilter) VehicleStatus(org.onebusaway.admin.model.ui.VehicleStatus) EmergencyStatusFilter(org.onebusaway.admin.search.impl.EmergencyStatusFilter)

Aggregations

ArrayList (java.util.ArrayList)1 VehicleStatus (org.onebusaway.admin.model.ui.VehicleStatus)1 Filter (org.onebusaway.admin.search.Filter)1 DSCFilter (org.onebusaway.admin.search.impl.DSCFilter)1 DepotFilter (org.onebusaway.admin.search.impl.DepotFilter)1 EmergencyStatusFilter (org.onebusaway.admin.search.impl.EmergencyStatusFilter)1 FormalInferrenceFilter (org.onebusaway.admin.search.impl.FormalInferrenceFilter)1 InferredPhaseFilter (org.onebusaway.admin.search.impl.InferredPhaseFilter)1 PulloutStatusFilter (org.onebusaway.admin.search.impl.PulloutStatusFilter)1 RevenueServiceFilter (org.onebusaway.admin.search.impl.RevenueServiceFilter)1 RouteFilter (org.onebusaway.admin.search.impl.RouteFilter)1 TimeWindowFilter (org.onebusaway.admin.search.impl.TimeWindowFilter)1 VehicleIdFilter (org.onebusaway.admin.search.impl.VehicleIdFilter)1