Search in sources :

Example 1 with GWTLocationSpecificStatus

use of org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus in project opennms by OpenNMS.

the class DefaultLocationDataService method transformLocationSpecificStatus.

private static GWTLocationSpecificStatus transformLocationSpecificStatus(final OnmsLocationSpecificStatus status) {
    final GWTLocationSpecificStatus gStatus = new GWTLocationSpecificStatus();
    gStatus.setId(status.getId());
    gStatus.setLocationMonitor(transformLocationMonitor(status.getLocationMonitor()));
    gStatus.setPollResult(transformPollResult(status.getPollResult()));
    gStatus.setMonitoredService(transformMonitoredService(status.getMonitoredService()));
    return gStatus;
}
Also used : GWTLocationSpecificStatus(org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus)

Example 2 with GWTLocationSpecificStatus

use of org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus in project opennms by OpenNMS.

the class DefaultLocationDataService method getApplicationDetails.

/**
 * <p>getApplicationDetails</p>
 *
 * @param app a {@link org.opennms.netmgt.model.OnmsApplication} object.
 * @return a {@link org.opennms.features.poller.remote.gwt.client.ApplicationDetails} object.
 */
@Transactional
@Override
public ApplicationDetails getApplicationDetails(final OnmsApplication app) {
    waitForGeocoding("getApplicationDetails");
    final ApplicationInfo applicationInfo = getApplicationInfo(app, StatusDetails.unknown());
    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>();
    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));
            }
        }
    }
    ApplicationDetails details = new ApplicationDetails(applicationInfo, from, to, monitors, statuses);
    LOG.warn("getApplicationDetails({}) returning {}", app.getName(), details);
    return details;
}
Also used : GWTLocationSpecificStatus(org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus) OnmsLocationSpecificStatus(org.opennms.netmgt.model.OnmsLocationSpecificStatus) ApplicationInfo(org.opennms.features.poller.remote.gwt.client.ApplicationInfo) ArrayList(java.util.ArrayList) GWTLocationMonitor(org.opennms.features.poller.remote.gwt.client.GWTLocationMonitor) OnmsLocationMonitor(org.opennms.netmgt.model.OnmsLocationMonitor) ApplicationDetails(org.opennms.features.poller.remote.gwt.client.ApplicationDetails) Date(java.util.Date) OnmsMonitoredService(org.opennms.netmgt.model.OnmsMonitoredService) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with GWTLocationSpecificStatus

use of org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus 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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) OnmsLocationSpecificStatus(org.opennms.netmgt.model.OnmsLocationSpecificStatus) ArrayList(java.util.ArrayList) GWTLocationMonitor(org.opennms.features.poller.remote.gwt.client.GWTLocationMonitor) GWTMonitoredService(org.opennms.features.poller.remote.gwt.client.GWTMonitoredService) Date(java.util.Date) OnmsMonitoredService(org.opennms.netmgt.model.OnmsMonitoredService) AppStatusDetailsComputer(org.opennms.features.poller.remote.gwt.client.AppStatusDetailsComputer) GWTLocationSpecificStatus(org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus) StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with GWTLocationSpecificStatus

use of org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus 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;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) OnmsLocationSpecificStatus(org.opennms.netmgt.model.OnmsLocationSpecificStatus) ArrayList(java.util.ArrayList) GWTLocationMonitor(org.opennms.features.poller.remote.gwt.client.GWTLocationMonitor) GWTMonitoredService(org.opennms.features.poller.remote.gwt.client.GWTMonitoredService) Date(java.util.Date) OnmsMonitoredService(org.opennms.netmgt.model.OnmsMonitoredService) AppStatusDetailsComputer(org.opennms.features.poller.remote.gwt.client.AppStatusDetailsComputer) GWTLocationSpecificStatus(org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus) StatusDetails(org.opennms.features.poller.remote.gwt.client.StatusDetails) OnmsLocationMonitor(org.opennms.netmgt.model.OnmsLocationMonitor) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

GWTLocationSpecificStatus (org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 GWTLocationMonitor (org.opennms.features.poller.remote.gwt.client.GWTLocationMonitor)3 OnmsLocationSpecificStatus (org.opennms.netmgt.model.OnmsLocationSpecificStatus)3 OnmsMonitoredService (org.opennms.netmgt.model.OnmsMonitoredService)3 Transactional (org.springframework.transaction.annotation.Transactional)3 LinkedHashSet (java.util.LinkedHashSet)2 AppStatusDetailsComputer (org.opennms.features.poller.remote.gwt.client.AppStatusDetailsComputer)2 GWTMonitoredService (org.opennms.features.poller.remote.gwt.client.GWTMonitoredService)2 StatusDetails (org.opennms.features.poller.remote.gwt.client.StatusDetails)2 OnmsLocationMonitor (org.opennms.netmgt.model.OnmsLocationMonitor)2 ApplicationDetails (org.opennms.features.poller.remote.gwt.client.ApplicationDetails)1 ApplicationInfo (org.opennms.features.poller.remote.gwt.client.ApplicationInfo)1