Search in sources :

Example 16 with Report

use of org.opennms.netmgt.config.kscReports.Report in project opennms by OpenNMS.

the class DefaultKscReportService method buildResourceReport.

private static Report buildResourceReport(ResourceService service, OnmsResource parentResource, String title) {
    Report report = new Report();
    report.setTitle(title);
    report.setShowTimespanButton(true);
    report.setShowGraphtypeButton(true);
    List<OnmsResource> resources = service.findChildResources(parentResource, "interfaceSnmp");
    for (OnmsResource resource : resources) {
        PrefabGraph[] graphs = service.findPrefabGraphsForResource(resource);
        if (graphs.length == 0) {
            continue;
        }
        Graph graph = new Graph();
        graph.setTitle("");
        graph.setResourceId(resource.getId().toString());
        graph.setTimespan("7_day");
        graph.setGraphtype(graphs[0].getName());
        report.addGraph(graph);
    }
    return report;
}
Also used : OnmsResource(org.opennms.netmgt.model.OnmsResource) PrefabGraph(org.opennms.netmgt.model.PrefabGraph) PrefabGraph(org.opennms.netmgt.model.PrefabGraph) Graph(org.opennms.netmgt.config.kscReports.Graph) Report(org.opennms.netmgt.config.kscReports.Report)

Aggregations

Report (org.opennms.netmgt.config.kscReports.Report)16 Graph (org.opennms.netmgt.config.kscReports.Graph)8 OnmsResource (org.opennms.netmgt.model.OnmsResource)5 ModelAndView (org.springframework.web.servlet.ModelAndView)5 PrefabGraph (org.opennms.netmgt.model.PrefabGraph)4 Calendar (java.util.Calendar)3 ServletException (javax.servlet.ServletException)3 KscResultSet (org.opennms.web.graph.KscResultSet)3 MissingParameterException (org.opennms.web.servlet.MissingParameterException)3 ParseException (java.text.ParseException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Path (javax.ws.rs.Path)2 Transactional (org.springframework.transaction.annotation.Transactional)2 IOException (java.io.IOException)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 Consumes (javax.ws.rs.Consumes)1 GET (javax.ws.rs.GET)1