Search in sources :

Example 11 with BasicReportDefinition

use of org.opennms.features.reporting.model.basicreport.BasicReportDefinition in project opennms by OpenNMS.

the class DefaultRemoteRepositoryTest method getOnlineReports.

@Test
public void getOnlineReports() {
    List<BasicReportDefinition> reports = m_defaultRemoteRepository.getOnlineReports();
    logger.debug("getOnlineReports");
    for (BasicReportDefinition report : reports) {
        logger.debug(report.toString());
    }
}
Also used : BasicReportDefinition(org.opennms.features.reporting.model.basicreport.BasicReportDefinition) Test(org.junit.Test)

Example 12 with BasicReportDefinition

use of org.opennms.features.reporting.model.basicreport.BasicReportDefinition in project opennms by OpenNMS.

the class DefaultDatabaseReportListServiceTest method setupDao.

@Before
public void setupDao() throws Exception {
    m_globalReportRepository = EasyMock.createNiceMock(GlobalReportRepository.class);
    EasyMock.expect(m_globalReportRepository.getAllOnlineReports()).andReturn(new ArrayList<BasicReportDefinition>());
    EasyMock.expect(m_globalReportRepository.getAllOnlineReports()).andReturn(new ArrayList<BasicReportDefinition>());
    EasyMock.replay(m_globalReportRepository);
    m_defaultDatabaseReportListService = new DefaultDatabaseReportListService();
    m_defaultDatabaseReportListService.setGlobalReportRepository(m_globalReportRepository);
}
Also used : DefaultDatabaseReportListService(org.opennms.web.svclayer.support.DefaultDatabaseReportListService) GlobalReportRepository(org.opennms.features.reporting.repository.global.GlobalReportRepository) BasicReportDefinition(org.opennms.features.reporting.model.basicreport.BasicReportDefinition) Before(org.junit.Before)

Example 13 with BasicReportDefinition

use of org.opennms.features.reporting.model.basicreport.BasicReportDefinition in project opennms by OpenNMS.

the class DefaultGlobalReportRepository method getOnlineReports.

/**
 * {@inheritDoc}
 */
@Override
public List<BasicReportDefinition> getOnlineReports(String repositoryId) {
    List<BasicReportDefinition> results = new ArrayList<>();
    ReportRepository repository = this.getRepositoryById(repositoryId);
    if (repository != null) {
        results.addAll(repository.getOnlineReports());
    }
    logger.debug("getOnlineReports was called for: '{}' result: '{}'", repositoryId, results);
    return results;
}
Also used : ArrayList(java.util.ArrayList) ReportRepository(org.opennms.features.reporting.repository.ReportRepository) BasicReportDefinition(org.opennms.features.reporting.model.basicreport.BasicReportDefinition)

Example 14 with BasicReportDefinition

use of org.opennms.features.reporting.model.basicreport.BasicReportDefinition in project opennms by OpenNMS.

the class DefaultGlobalReportRepository method getAllOnlineReports.

/**
 * {@inheritDoc}
 */
@Override
public List<BasicReportDefinition> getAllOnlineReports() {
    List<BasicReportDefinition> results = new ArrayList<>();
    for (ReportRepository repository : m_repositoryList) {
        results.addAll(repository.getOnlineReports());
    }
    logger.debug("getAllOnlineReports was called result: '{}'", results);
    return results;
}
Also used : ArrayList(java.util.ArrayList) ReportRepository(org.opennms.features.reporting.repository.ReportRepository) BasicReportDefinition(org.opennms.features.reporting.model.basicreport.BasicReportDefinition)

Example 15 with BasicReportDefinition

use of org.opennms.features.reporting.model.basicreport.BasicReportDefinition in project opennms by OpenNMS.

the class LegacyLocalReportRepository method getOnlineReports.

/**
 * {@inheritDoc}
 */
@Override
public List<BasicReportDefinition> getOnlineReports() {
    List<BasicReportDefinition> resultList = new ArrayList<>();
    for (BasicReportDefinition report : m_localReportsDao.getOnlineReports()) {
        BasicReportDefinition resultReport = new LegacyLocalReportDefinition();
        try {
            BeanUtils.copyProperties(resultReport, report);
            resultReport.setId(REPOSITORY_ID + "_" + report.getId());
            // Community reports are allowed by default, no permission restriction
            resultReport.setAllowAccess(true);
        } catch (IllegalAccessException e) {
            logger.error("IllegalAccessException during BeanUtils.copyProperties for BasicReportDefinion '{}'", e.getMessage());
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            logger.error("InvocationTargetException during BeanUtils.copyProperties for BasicReportDefinion '{}'", e.getMessage());
            e.printStackTrace();
        }
        resultList.add(resultReport);
    }
    return resultList;
}
Also used : LegacyLocalReportDefinition(org.opennms.features.reporting.model.basicreport.LegacyLocalReportDefinition) ArrayList(java.util.ArrayList) BasicReportDefinition(org.opennms.features.reporting.model.basicreport.BasicReportDefinition) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

BasicReportDefinition (org.opennms.features.reporting.model.basicreport.BasicReportDefinition)20 ArrayList (java.util.ArrayList)14 ReportRepository (org.opennms.features.reporting.repository.ReportRepository)6 InvocationTargetException (java.lang.reflect.InvocationTargetException)5 Test (org.junit.Test)4 DatabaseReportDescription (org.opennms.web.svclayer.model.DatabaseReportDescription)4 LegacyLocalReportDefinition (org.opennms.features.reporting.model.basicreport.LegacyLocalReportDefinition)3 GlobalReportRepository (org.opennms.features.reporting.repository.global.GlobalReportRepository)3 RemoteReportSDO (org.opennms.features.reporting.sdo.RemoteReportSDO)3 WebTarget (javax.ws.rs.client.WebTarget)2 GenericType (javax.ws.rs.core.GenericType)2 Before (org.junit.Before)2 HashMap (java.util.HashMap)1 ReportFormat (org.opennms.api.reporting.ReportFormat)1 LocalReportsDao (org.opennms.features.reporting.dao.LocalReportsDao)1 LocalJasperReportsDao (org.opennms.features.reporting.dao.jasper.LocalJasperReportsDao)1 SimpleJasperReportDefinition (org.opennms.features.reporting.model.jasperreport.SimpleJasperReportDefinition)1 DefaultDatabaseReportListService (org.opennms.web.svclayer.support.DefaultDatabaseReportListService)1