use of org.apache.struts2.convention.annotation.Actions in project uavstack by uavorg.
the class TestStruts2ActionAnno method anno1.
@Actions({ @Action("aa"), @Action("bb") })
@Action("anno1")
public void anno1() throws IOException {
ServletActionContext.getResponse().setContentType("text/html;charset=utf-8");
PrintWriter out = ServletActionContext.getResponse().getWriter();
try {
out.print("TestStruts2ActionAnno anno1()");
out.flush();
out.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
use of org.apache.struts2.convention.annotation.Actions in project onebusaway-application-modules by camsys.
the class RoutesAction method execute.
@Override
@Actions({ @Action(value = "/where/iphone/routes") })
public String execute() throws ServiceException {
if (_query == null || _query.length() == 0)
return INPUT;
CoordinateBounds bounds = getServiceArea();
if (bounds == null) {
pushNextAction("routes", "query", _query);
return "query-default-search-location";
}
SearchQueryBean query = new SearchQueryBean();
query.setBounds(bounds);
query.setMaxCount(5);
query.setQuery(_query);
query.setType(EQueryType.BOUNDS_OR_CLOSEST);
RoutesBean routesResult = _transitDataService.getRoutes(query);
_routes = routesResult.getRoutes();
if (_routes.size() == 0) {
return "noRoutesFound";
} else if (_routes.size() > 1) {
return "multipleRoutesFound";
} else {
_route = _routes.get(0);
return "singleRouteFound";
}
}
use of org.apache.struts2.convention.annotation.Actions in project onebusaway-application-modules by camsys.
the class ScheduleAction method execute.
@Override
@Actions({ @Action(value = "/where/schedule") })
public String execute() throws Exception {
if (_date == null)
_date = new Date();
if (_id == null)
return INPUT;
_result = _service.getScheduleForStop(_id, _date);
if (_result == null)
throw new NoSuchStopServiceException(_id);
StopCalendarDaysBean days = _result.getCalendarDays();
String tzName = days.getTimeZone();
_timeZone = TimeZone.getTimeZone(tzName);
if (_timeZone == null)
_timeZone = TimeZone.getDefault();
filterResults();
return SUCCESS;
}
use of org.apache.struts2.convention.annotation.Actions in project onebusaway-application-modules by camsys.
the class StopsAction method execute.
@Override
@Actions({ @Action(value = "/where/iphone/stops") })
public String execute() throws ServiceException {
CoordinateBounds bounds = getServiceArea();
if (bounds == null) {
pushNextAction("stops", "code", _code);
return "query-default-search-location";
}
SearchQueryBean searchQuery = new SearchQueryBean();
searchQuery.setBounds(bounds);
searchQuery.setMaxCount(5);
searchQuery.setType(EQueryType.BOUNDS_OR_CLOSEST);
searchQuery.setQuery(_code);
StopsBean stopsResult = _transitDataService.getStops(searchQuery);
_stops = stopsResult.getStops();
if (_stops.size() == 0) {
return "noStopsFound";
} else if (_stops.size() > 1) {
return "multipleStopsFound";
} else {
_stop = _stops.get(0);
return "singleStopFound";
}
}
use of org.apache.struts2.convention.annotation.Actions in project onebusaway-application-modules by camsys.
the class StopsForRouteAction method execute.
@Override
@Actions({ @Action(value = "/where/iphone/stops-for-route") })
public String execute() throws ServiceException {
if (_id == null || _id.length() == 0)
return INPUT;
_route = _transitDataService.getRouteForId(_id);
StopsForRouteBean stopsForRoute = _transitDataService.getStopsForRoute(_id);
Map<String, StopGroupingBean> groupingsByType = MappingLibrary.mapToValue(stopsForRoute.getStopGroupings(), "type", String.class);
StopGroupingBean byDirection = groupingsByType.get(TransitDataConstants.STOP_GROUPING_TYPE_DIRECTION);
if (_groupIndex == -1) {
if (byDirection != null) {
for (StopGroupBean group : byDirection.getStopGroups()) _directionNames.add(group.getName());
}
_stops = stopsForRoute.getStops();
Collections.sort(_stops, _stopNameComparator);
} else {
if (byDirection == null)
return INPUT;
List<StopGroupBean> groups = byDirection.getStopGroups();
if (_groupIndex < 0 && groups.size() <= _groupIndex)
return INPUT;
Map<String, StopBean> stopById = MappingLibrary.mapToValue(stopsForRoute.getStops(), "id", String.class);
StopGroupBean stopGroup = groups.get(_groupIndex);
_stops = new ArrayList<StopBean>();
for (String stopId : stopGroup.getStopIds()) _stops.add(stopById.get(stopId));
}
return SUCCESS;
}
Aggregations