Search in sources :

Example 1 with AgiActionName

use of org.onebusaway.probablecalls.AgiActionName in project onebusaway-application-modules by camsys.

the class SetDefaultSearchLocationTemplate method buildTemplate.

@Override
public void buildTemplate(ActionContext context) {
    addMessage(Messages.SET_DEFAULT_LOCATION);
    AgiActionName action = setNextAction("/back");
    action.putParam("count", 2);
}
Also used : AgiActionName(org.onebusaway.probablecalls.AgiActionName)

Example 2 with AgiActionName

use of org.onebusaway.probablecalls.AgiActionName 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);
}
Also used : ValueStack(com.opensymphony.xwork2.util.ValueStack) StopsWithArrivalsAndDeparturesBean(org.onebusaway.transit_data.model.StopsWithArrivalsAndDeparturesBean) PhoneArrivalsAndDeparturesModel(org.onebusaway.phone.impl.PhoneArrivalsAndDeparturesModel) AgiActionName(org.onebusaway.probablecalls.AgiActionName)

Example 3 with AgiActionName

use of org.onebusaway.probablecalls.AgiActionName 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);
}
Also used : ValueStack(com.opensymphony.xwork2.util.ValueStack) StopBean(org.onebusaway.transit_data.model.StopBean) List(java.util.List) AgiActionName(org.onebusaway.probablecalls.AgiActionName)

Example 4 with AgiActionName

use of org.onebusaway.probablecalls.AgiActionName 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);
}
Also used : ValueStack(com.opensymphony.xwork2.util.ValueStack) BookmarkWithStopsBean(org.onebusaway.presentation.model.BookmarkWithStopsBean) List(java.util.List) AgiActionName(org.onebusaway.probablecalls.AgiActionName)

Example 5 with AgiActionName

use of org.onebusaway.probablecalls.AgiActionName in project onebusaway-application-modules by camsys.

the class StopFoundTemplate method buildTemplate.

@Override
public void buildTemplate(ActionContext context) {
    ValueStack vs = context.getValueStack();
    StopBean stop = (StopBean) vs.findValue("stop");
    addMessage(Messages.THE_STOP_NUMBER_FOR);
    addText(_destinationPronunciation.modify(stop.getName()));
    String direction = _directionPronunciation.modify(stop.getDirection());
    addMessage(Messages.DIRECTION_BOUND, direction);
    addText(Messages.IS);
    addText(stop.getCode());
    addMessage(Messages.STOP_FOUND_ARRIVAL_INFO);
    AgiActionName arrivalInfoAction = addAction("1", "/stop/arrivalsAndDeparturesForStopId");
    arrivalInfoAction.putParam("stopIds", Arrays.asList(stop.getId()));
    addMessage(Messages.STOP_FOUND_BOOKMARK_THIS_LOCATION);
    AgiActionName bookmarkAction = addAction("2", "/stop/bookmark");
    bookmarkAction.putParam("stop", stop);
    addMessage(Messages.STOP_FOUND_RETURN_TO_MAIN_MENU);
    addAction("3", "/index");
    addAction("[04-9]", "/repeat");
    addMessage(Messages.HOW_TO_GO_BACK);
    addAction("\\*", "/back");
    addMessage(Messages.TO_REPEAT);
}
Also used : ValueStack(com.opensymphony.xwork2.util.ValueStack) StopBean(org.onebusaway.transit_data.model.StopBean) AgiActionName(org.onebusaway.probablecalls.AgiActionName)

Aggregations

AgiActionName (org.onebusaway.probablecalls.AgiActionName)10 ValueStack (com.opensymphony.xwork2.util.ValueStack)7 List (java.util.List)4 BookmarkWithStopsBean (org.onebusaway.presentation.model.BookmarkWithStopsBean)2 StopBean (org.onebusaway.transit_data.model.StopBean)2 HashSet (java.util.HashSet)1 NavigationBean (org.onebusaway.phone.actions.search.NavigationBean)1 PhoneArrivalsAndDeparturesModel (org.onebusaway.phone.impl.PhoneArrivalsAndDeparturesModel)1 NameBean (org.onebusaway.transit_data.model.NameBean)1 RouteBean (org.onebusaway.transit_data.model.RouteBean)1 StopsWithArrivalsAndDeparturesBean (org.onebusaway.transit_data.model.StopsWithArrivalsAndDeparturesBean)1