use of org.onebusaway.nextbus.model.nextbus.MessageText in project onebusaway-application-modules by camsys.
the class MessagesAction method getMessagesForRoute.
private List<Message> getMessagesForRoute(String agencyId, String routeId) {
List<Message> messageList = new ArrayList<Message>();
ListBean<ServiceAlertBean> serviceAlertBeans = getAllSituations(agencyId, routeId);
serviceAlerts: for (ServiceAlertBean serviceAlert : serviceAlertBeans.getList()) {
if (serviceAlert.getActiveWindows() != null) {
long currentTime = SystemTime.currentTimeMillis();
for (TimeRangeBean timerange : serviceAlert.getActiveWindows()) {
if (timerange.getFrom() < currentTime || timerange.getTo() < currentTime) {
continue serviceAlerts;
}
}
}
Message message = new Message();
message.setId(serviceAlert.getId());
message.setCreator(serviceAlert.getSource());
// message.setEndBoundaryStr(serviceAlert.getPublicationWindows().toString());
String messageText = "";
for (NaturalLanguageStringBean description : serviceAlert.getDescriptions()) {
messageText += description.getValue();
}
message.setMessageText(new MessageText(messageText));
messageList.add(message);
}
return messageList;
}
Aggregations