Search in sources :

Example 1 with LegacyAvailabilityDataService

use of org.opennms.reporting.availability.svclayer.LegacyAvailabilityDataService in project opennms by OpenNMS.

the class AvailabilityReportIT method buildReport.

/*
    private int numRowsWithValue(Section section, String title, String data){

        int rowMatched = 0;
        boolean titlematch;
        boolean datamatch;

        ClassicTable table = section.getClassicTable();
        Rows rows = table.getRows();
        Row[] row = rows.getRow();
        for(int j= 0; j < row.length; j++) {
            Value[] value = row[j].getValue();
            titlematch = false;
            datamatch = false;
            for(int k= 0; k < value.length; k++){
                if (value[k].getType().equals("title") &&
                        value[k].getContent().equals(title))
                    titlematch = true;	
                if (value[k].getType().equals("data") &&
                        value[k].getContent().equals(data))
                    datamatch = true;
                if (datamatch && titlematch)
                    rowMatched++;
            }	
        }			
        return rowMatched; 
    }
    */
private Report buildReport(Calendar calendar, String calFormat) {
    Report report = new Report();
    report.setLogo("wherever");
    ViewInfo viewInfo = new ViewInfo();
    report.setViewInfo(viewInfo);
    report.setCategories(m_categories);
    // AvailabilityData availData = null;
    try {
        /* it seems we just initialize this to make sure it works
             * availData =
             */
        AvailabilityData reportSource = new AvailabilityData();
        reportSource.setAvailabilityDataService(new LegacyAvailabilityDataService());
        reportSource.fillReport("Network Interfaces", report, "HTML", calFormat, "4", "18", "2005");
    } catch (Throwable e) {
        throw new UndeclaredThrowableException(e);
    }
    return report;
}
Also used : LegacyAvailabilityDataService(org.opennms.reporting.availability.svclayer.LegacyAvailabilityDataService) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException)

Example 2 with LegacyAvailabilityDataService

use of org.opennms.reporting.availability.svclayer.LegacyAvailabilityDataService in project opennms by OpenNMS.

the class AvailabilityCalculatorIT method buildReport.

/*
    private int numRowsWithValue(Section section, String title, String data) {

        int rowMatched = 0;
        boolean titlematch;
        boolean datamatch;

        ClassicTable table = section.getClassicTable();
        Rows rows = table.getRows();
        Row[] row = rows.getRow();
        for (int j = 0; j < row.length; j++) {
            Value[] value = row[j].getValue();
            titlematch = false;
            datamatch = false;
            for (int k = 0; k < value.length; k++) {
                if (value[k].getType().equals("title")
                        && value[k].getContent().equals(title))
                    titlematch = true;
                if (value[k].getType().equals("data")
                        && value[k].getContent().equals(data))
                    datamatch = true;
                if (datamatch && titlematch)
                    rowMatched++;
            }
        }
        return rowMatched;
    }
    */
private Report buildReport(Calendar calendar, String calFormat) {
    Report report = null;
    //AvailabilityData availData = null;
    try {
        AvailabilityCalculator calculator = new AvailabilityCalculatorImpl();
        AvailabilityData data = new AvailabilityData();
        data.setAvailabilityDataService(new LegacyAvailabilityDataService());
        calculator.setAvailabilityData(data);
        calculator.setPeriodEndDate(m_calendar.getTime());
        calculator.setLogoURL("wahtever");
        calculator.setReportFormat("PDF");
        calculator.setMonthFormat(calFormat);
        calculator.setCategoryName("Network Interfaces");
        calculator.calculate();
        report = calculator.getReport();
    } catch (Throwable e) {
        throw new UndeclaredThrowableException(e);
    }
    return report;
}
Also used : LegacyAvailabilityDataService(org.opennms.reporting.availability.svclayer.LegacyAvailabilityDataService) UndeclaredThrowableException(java.lang.reflect.UndeclaredThrowableException)

Aggregations

UndeclaredThrowableException (java.lang.reflect.UndeclaredThrowableException)2 LegacyAvailabilityDataService (org.opennms.reporting.availability.svclayer.LegacyAvailabilityDataService)2