use of org.opennms.features.poller.remote.gwt.client.AppStatusDetailsComputer in project opennms by OpenNMS.
the class DefaultLocationDataService method getStatusDetailsForApplication.
/** {@inheritDoc} */
@Transactional
@Override
public StatusDetails getStatusDetailsForApplication(final OnmsApplication app) {
waitForGeocoding("getStatusDetailsForApplication");
List<GWTLocationSpecificStatus> statuses = new ArrayList<GWTLocationSpecificStatus>();
final Date to = new Date();
final Date from = new Date(to.getTime() - AVAILABILITY_MS);
final Collection<OnmsMonitoredService> services = m_monitoredServiceDao.findByApplication(app);
final Set<GWTLocationMonitor> monitors = new LinkedHashSet<GWTLocationMonitor>();
final Set<GWTMonitoredService> gwtServices = new LinkedHashSet<GWTMonitoredService>(services.size());
for (final OnmsMonitoredService service : services) {
gwtServices.add(transformMonitoredService(service));
}
for (OnmsLocationSpecificStatus status : m_locationDao.getStatusChangesForApplicationBetween(to, from, app.getName())) {
monitors.add(transformLocationMonitor(status.getLocationMonitor()));
statuses.add(transformLocationSpecificStatus(status));
}
StatusDetails statusDetails = new AppStatusDetailsComputer(from, to, monitors, gwtServices, statuses).compute();
LOG.warn("getStatusDetailsForApplication({}) returning {}", app.getName(), statusDetails);
return statusDetails;
}
use of org.opennms.features.poller.remote.gwt.client.AppStatusDetailsComputer in project opennms by OpenNMS.
the class DefaultLocationDataService method getStatusDetailsForApplicationOld.
/**
* <p>getStatusDetailsForApplicationOld</p>
*
* @param app a {@link org.opennms.netmgt.model.OnmsApplication} object.
* @return a {@link org.opennms.features.poller.remote.gwt.client.StatusDetails} object.
*/
@Transactional
public StatusDetails getStatusDetailsForApplicationOld(final OnmsApplication app) {
waitForGeocoding("getStatusDetailsForApplication");
List<GWTLocationSpecificStatus> statuses = new ArrayList<GWTLocationSpecificStatus>();
final Date to = new Date();
final Date from = new Date(to.getTime() - AVAILABILITY_MS);
final Collection<OnmsMonitoredService> services = m_monitoredServiceDao.findByApplication(app);
final List<GWTLocationMonitor> monitors = new ArrayList<GWTLocationMonitor>();
final Set<GWTMonitoredService> gwtServices = new LinkedHashSet<GWTMonitoredService>(services.size());
for (final OnmsMonitoredService service : services) {
gwtServices.add(transformMonitoredService(service));
}
for (final OnmsLocationMonitor monitor : m_locationDao.findByApplication(app)) {
monitors.add(transformLocationMonitor(monitor));
for (final OnmsLocationSpecificStatus locationSpecificStatus : m_locationDao.getStatusChangesForLocationBetween(from, to, monitor.getLocation())) {
if (services.contains(locationSpecificStatus.getMonitoredService())) {
statuses.add(transformLocationSpecificStatus(locationSpecificStatus));
}
}
}
StatusDetails statusDetails = new AppStatusDetailsComputer(from, to, monitors, gwtServices, statuses).compute();
LOG.warn("getStatusDetailsForApplication({}) returning {}", app.getName(), statusDetails);
return statusDetails;
}
Aggregations