use of com.opensymphony.xwork2.inject.Context in project onebusaway-application-modules by camsys.
the class NextActionSupport method getNextActionOrSuccess.
protected String getNextActionOrSuccess() {
List<NextAction> stack = getNextActionStack(false);
if (stack == null || stack.isEmpty())
return SUCCESS;
NextAction next = stack.remove(stack.size() - 1);
Map<String, String[]> params = next.getParameters();
if (params != null && !params.isEmpty()) {
ActionContext context = ActionContext.getContext();
Map<String, Object> contextParameters = context.getParameters();
contextParameters.putAll(params);
}
return next.getAction();
}
use of com.opensymphony.xwork2.inject.Context in project onebusaway-application-modules by camsys.
the class IntegrationTestingInterceptor method intercept.
@Override
public String intercept(ActionInvocation invocation) throws Exception {
ActionContext context = invocation.getInvocationContext();
AgiRequest request = AgiEntryPoint.getAgiRequest(context);
Map<?, ?> r = request.getRequest();
/**
* This interceptor will be called multiple times in the course of
* processing the actions for a call, so we only check the reset user param
* once
*/
Object value = r.remove(RESET_USER);
if (value != null && value.equals("true"))
context.getParameters().put(PhoneNumberLoginInterceptor.RESET_USER, Boolean.TRUE);
return invocation.invoke();
}
use of com.opensymphony.xwork2.inject.Context in project onebusaway-application-modules by camsys.
the class ArrivalsAndDeparturesTemplate method buildTemplate.
@Override
public void buildTemplate(ActionContext context) {
ValueStack valueStack = context.getValueStack();
PhoneArrivalsAndDeparturesModel model = (PhoneArrivalsAndDeparturesModel) valueStack.findValue("model");
StopsWithArrivalsAndDeparturesBean result = model.getResult();
buildPredictedArrivalsTemplate(result.getArrivalsAndDepartures());
addMessage(Messages.ARRIVAL_INFO_ON_SPECIFIC_ROUTE);
AgiActionName byRouteAction = addActionWithParameterFromMatch("1(\\d+)#", "/stop/arrivalsAndDeparturesForRoute", "route", 1);
byRouteAction.putParam("model", model);
addMessage(Messages.ARRIVAL_INFO_BOOKMARK_THIS_LOCATION);
AgiActionName bookmarkAction = addAction("2", "/stop/bookmark");
bookmarkAction.putParam("stops", result.getStops());
addMessage(Messages.ARRIVAL_INFO_RETURN_TO_MAIN_MENU);
addAction("3", "/index");
addAction("(#|[04-9]|1.*\\*)", "/repeat");
addMessage(Messages.HOW_TO_GO_BACK);
addAction("\\*", "/back");
addMessage(Messages.TO_REPEAT);
}
use of com.opensymphony.xwork2.inject.Context in project onebusaway-application-modules by camsys.
the class MultipleStopsFoundTemplate method buildTemplate.
@SuppressWarnings("unchecked")
@Override
public void buildTemplate(ActionContext context) {
ValueStack vs = context.getValueStack();
List<StopBean> stops = (List<StopBean>) vs.findValue("stops");
int index = 1;
addMessage(Messages.MULTIPLE_STOPS_WERE_FOUND);
for (StopBean stop : stops) {
addMessage(Messages.FOR);
addText(_destinationPronunciation.modify(stop.getName()));
addMessage(Messages.PLEASE_PRESS);
String key = Integer.toString(index++);
addText(key);
AgiActionName action = addAction(key, "/stop/arrivalsAndDeparturesForStopId");
action.putParam("stopIds", Arrays.asList(stop.getId()));
}
addMessage(Messages.HOW_TO_GO_BACK);
addAction("\\*", "/back");
addMessage(Messages.TO_REPEAT);
}
use of com.opensymphony.xwork2.inject.Context in project onebusaway-application-modules by camsys.
the class ManageTemplate method buildTemplate.
@SuppressWarnings("unchecked")
@Override
public void buildTemplate(ActionContext context) {
ValueStack stack = context.getValueStack();
List<BookmarkWithStopsBean> bookmarks = (List<BookmarkWithStopsBean>) stack.findValue("bookmarks");
if (bookmarks.isEmpty()) {
addMessage(Messages.BOOKMARKS_EMPTY);
} else {
int index = 1;
for (BookmarkWithStopsBean bookmark : bookmarks) {
addMessage(Messages.BOOKMARKS_TO_DELETE_THE_BOOKMARK_FOR);
addBookmarkDescription(bookmark);
addMessage(Messages.PLEASE_PRESS);
String toPress = Integer.toString(index);
addText(toPress);
AgiActionName deleteAction = addAction(toPress, "/bookmarks/deleteByIndex");
deleteAction.putParam("index", index - 1);
index++;
}
}
addAction("(#|0|.+\\*)", "/repeat");
addMessage(Messages.HOW_TO_GO_BACK);
addAction("\\*", "/back");
addMessage(Messages.TO_REPEAT);
}
Aggregations