use of org.onebusaway.enterprise.webapp.actions.status.model.StatusItem in project onebusaway-application-modules by camsys.
the class StatusAction method createGroups.
private List<StatusGroup> createGroups() {
groups = new ArrayList<StatusGroup>();
groups.add(_statusProvider.getIcingaStatus());
groups.add(_statusProvider.getAgencyServiceAlertStatus());
groups.add(_statusProvider.getAgencyMetadataStatus());
// trim OKs
for (StatusGroup group : groups) {
List<StatusItem> items = new ArrayList<StatusItem>();
for (StatusItem item : group.getItems()) {
if (showItem(item.getStatus())) {
items.add(item);
}
}
group.setItems(items);
}
return groups;
}
use of org.onebusaway.enterprise.webapp.actions.status.model.StatusItem in project onebusaway-application-modules by camsys.
the class AgencyMessagesUpdateAction method execute.
@Override
public String execute() {
_feed = new SyndFeedImpl();
StringBuilder title = new StringBuilder();
title.append("OneBusAway General Notices");
HttpServletRequest request = ServletActionContext.getRequest();
StringBuilder b = new StringBuilder();
b.append("http://");
b.append(request.getServerName());
if (request.getServerPort() != 80)
b.append(":").append(request.getServerPort());
if (request.getContextPath() != null)
b.append(request.getContextPath());
String baseUrl = b.toString();
_feed.setTitle(title.toString());
_feed.setLink(baseUrl);
_feed.setDescription("General Notices");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
// Add Agency Messages
SyndEntry agencyMsgEntry = new SyndEntryImpl();
StatusGroup agencyMsgGroup = _statusProvider.getAgencyMetadataStatus();
if (agencyMsgGroup.getItems().size() == 0) {
agencyMsgEntry = new SyndEntryImpl();
agencyMsgEntry.setTitle("No General Notices");
entries.add(agencyMsgEntry);
} else {
for (StatusItem agencyMsgItem : agencyMsgGroup.getItems()) {
agencyMsgEntry = new SyndEntryImpl();
agencyMsgEntry.setTitle(agencyMsgItem.getTitle());
entries.add(agencyMsgEntry);
}
}
_feed.setEntries(entries);
return SUCCESS;
}
use of org.onebusaway.enterprise.webapp.actions.status.model.StatusItem in project onebusaway-application-modules by camsys.
the class MonitoringAlertsUpdateAction method execute.
@Override
public String execute() {
_feed = new SyndFeedImpl();
StringBuilder title = new StringBuilder();
title.append("OneBusAway System Monitoring");
HttpServletRequest request = ServletActionContext.getRequest();
StringBuilder b = new StringBuilder();
b.append("http://");
b.append(request.getServerName());
if (request.getServerPort() != 80)
b.append(":").append(request.getServerPort());
if (request.getContextPath() != null)
b.append(request.getContextPath());
String baseUrl = b.toString();
_feed.setTitle(title.toString());
_feed.setLink(baseUrl);
_feed.setDescription("System Monitoring");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
// Add Icinga Alerts
SyndEntry icingaEntry = new SyndEntryImpl();
SyndContent icingaContent = new SyndContentImpl();
StatusGroup icingaGroup = _statusProvider.getIcingaStatus();
StatusGroup icingaProblems = new StatusGroup();
icingaProblems.setTitle(icingaGroup.getTitle());
// Only report items where status is not "OK"
for (StatusItem icingaItem : icingaGroup.getItems()) {
if (icingaItem.getStatus() != StatusItem.Status.OK) {
icingaProblems.addItem(icingaItem);
}
}
if (icingaProblems.getItems().size() == 0) {
icingaEntry = new SyndEntryImpl();
icingaEntry.setTitle("All systems operational");
entries.add(icingaEntry);
} else {
for (StatusItem icingaItem : icingaProblems.getItems()) {
icingaEntry = new SyndEntryImpl();
icingaEntry.setTitle(icingaItem.getTitle());
icingaContent = new SyndContentImpl();
icingaContent.setValue(icingaItem.getStatus() + ": " + icingaItem.getDescription());
icingaEntry.setDescription(icingaContent);
entries.add(icingaEntry);
}
}
_feed.setEntries(entries);
return SUCCESS;
}
use of org.onebusaway.enterprise.webapp.actions.status.model.StatusItem in project onebusaway-application-modules by camsys.
the class ServiceAlertsUpdateAction method execute.
@Override
public String execute() {
_feed = new SyndFeedImpl();
StringBuilder title = new StringBuilder();
title.append("OneBusAway Agency Advisories");
HttpServletRequest request = ServletActionContext.getRequest();
StringBuilder b = new StringBuilder();
b.append("http://");
b.append(request.getServerName());
if (request.getServerPort() != 80)
b.append(":").append(request.getServerPort());
if (request.getContextPath() != null)
b.append(request.getContextPath());
String baseUrl = b.toString();
_feed.setTitle(title.toString());
_feed.setLink(baseUrl);
_feed.setDescription("Service Alerts");
List<SyndEntry> entries = new ArrayList<SyndEntry>();
// Add Service Alerts
SyndEntry serviceAlertEntry = new SyndEntryImpl();
SyndContent saContent = new SyndContentImpl();
StatusGroup saGroup = _statusProvider.getAgencyServiceAlertStatus();
if (saGroup.getItems().size() == 0) {
serviceAlertEntry = new SyndEntryImpl();
serviceAlertEntry.setTitle("All systems operational");
entries.add(serviceAlertEntry);
} else {
for (StatusItem saItem : saGroup.getItems()) {
serviceAlertEntry = new SyndEntryImpl();
serviceAlertEntry.setTitle(saItem.getTitle());
saContent = new SyndContentImpl();
saContent.setValue(saItem.getDescription());
serviceAlertEntry.setDescription(saContent);
entries.add(serviceAlertEntry);
}
}
_feed.setEntries(entries);
return SUCCESS;
}
use of org.onebusaway.enterprise.webapp.actions.status.model.StatusItem in project onebusaway-application-modules by camsys.
the class StatusUpdateAction method setAgencyServiceAlerts.
// these are top-level service alerts without a route/stop affects clause
protected void setAgencyServiceAlerts(List<SyndEntry> entries, String baseUrl) {
// Add Service Alerts
SyndEntry serviceAlertEntry = new SyndEntryImpl();
SyndContent saContent = new SyndContentImpl();
serviceAlertEntry.setTitle("Agency Advisories");
serviceAlertEntry.setLink(baseUrl + "/rss/service-alerts-update");
entries.add(serviceAlertEntry);
StatusGroup saGroup = _statusProvider.getAgencyServiceAlertStatus();
if (saGroup.getItems().size() == 0) {
serviceAlertEntry = new SyndEntryImpl();
serviceAlertEntry.setTitle("All systems operational");
entries.add(serviceAlertEntry);
} else {
for (StatusItem saItem : saGroup.getItems()) {
serviceAlertEntry = new SyndEntryImpl();
serviceAlertEntry.setTitle(saItem.getTitle());
saContent = new SyndContentImpl();
saContent.setValue(saItem.getDescription());
serviceAlertEntry.setDescription(saContent);
entries.add(serviceAlertEntry);
}
}
}
Aggregations