use of org.onebusaway.admin.search.impl.DSCFilter 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;
}
Aggregations