@Override public String toString() { ToStringBuilder tsb = new ToStringBuilder(this); tsb.append("report", getReport().getName()); tsb.append("resourceId", getResourceId()); tsb.append("value", getValue()); return tsb.toString(); }
d.setValue(reportDatum.getValue()); OnmsResource resource = m_resourceDao.getResourceById(ResourceId.fromString(reportDatum.getResourceId())); if (resource == null) { LOG.warn("Could not find resource for statistics report: {}", reportDatum.getResourceId()); } else { d.setResource(resource);
/** {@inheritDoc} */ @Override public void persist(ReportInstance report) { StatisticsReport dbReport = new StatisticsReport(); dbReport.setName(report.getName()); dbReport.setDescription(report.getDescription()); dbReport.setStartDate(new Date(report.getStartTime())); dbReport.setEndDate(new Date(report.getEndTime())); dbReport.setJobStartedDate(report.getJobStartedDate()); dbReport.setJobCompletedDate(report.getJobCompletedDate()); dbReport.setPurgeDate(new Date(report.getJobCompletedDate().getTime() + report.getRetainInterval())); for (AttributeStatistic stat : report.getResults()) { ResourceReference resource = getResourceReference(stat.getAttribute().getResource().getId().toString()); StatisticsReportData data = new StatisticsReportData(); data.setResource(resource); data.setReport(dbReport); data.setValue(stat.getStatistic()); dbReport.addData(data); LOG.debug("Adding {}", data); } if (dbReport.getData().isEmpty()) { LOG.warn("Cannot store {} because it doesn't contain data. Probably all the metrics are NaN for the report period.", report); } else { m_statisticsReportDao.save(dbReport); } }
/** * <p>getMaxDatumValue</p> * * @return a {@link java.lang.Double} object. */ @Transient public Double getMaxDatumValue() { Double mv = null; for ( Iterator<StatisticsReportData> it = m_data.iterator(); it.hasNext(); ) { Double val = it.next().getValue(); if (mv == null) { mv = val; } else if ( val > mv) { mv = val; } } return mv; }
d.setValue(reportDatum.getValue()); OnmsResource resource = m_resourceDao.getResourceById(ResourceId.fromString(reportDatum.getResourceId())); if (resource == null) { LOG.warn("Could not find resource for statistics report: {}", reportDatum.getResourceId()); } else { d.setResource(resource);
/** * <p>getMinDatumValue</p> * * @return a {@link java.lang.Double} object. */ @Transient public Double getMinDatumValue() { Double mv = null; for ( Iterator<StatisticsReportData> it = m_data.iterator(); it.hasNext(); ) { Double val = it.next().getValue(); if (mv == null) { mv = val; } else if ( val < mv) { mv = val; } } return mv; }