private TransactionReport getHourlyReport(Payload payload) { String domain = payload.getDomain(); String date = String.valueOf(payload.getDate()); String ipAddress = payload.getIpAddress(); ModelRequest request = new ModelRequest(domain, payload.getPeriod()) // .setProperty("date", date) // .setProperty("type", payload.getType()) // .setProperty("ip", ipAddress); if (m_service.isEligable(request)) { ModelResponse<TransactionReport> response = m_service.invoke(request); TransactionReport report = response.getModel(); if (payload.getPeriod().isLast()) { Date start = new Date(payload.getDate()); Date end = new Date(payload.getDate() + TimeUtil.ONE_HOUR); if (CatString.ALL.equals(domain)) { report = m_reportService.queryTransactionReport(domain, start, end); } Set<String> domains = m_reportService.queryAllDomainNames(start, end, "transaction"); Set<String> domainNames = report.getDomainNames(); domainNames.addAll(domains); } report = m_mergeManager.mergerAllIp(report, ipAddress); calculateTps(payload, report); return report; } else { throw new RuntimeException( "Internal error: no eligable transaction service registered for " + request + "!"); } }
@Override protected SqlReport merge(ModelRequest request, List<ModelResponse<SqlReport>> responses) { if (responses.size() == 0) { return null; } SqlReportMerger merger = new SqlReportMerger(new SqlReport(request.getDomain())); String datebase = request.getProperty("database"); if (CatString.ALL.equals(datebase)) { merger.setAllDatabase(true); } for (ModelResponse<SqlReport> response : responses) { SqlReport model = response.getModel(); if (model != null) { model.accept(merger); } } return merger.getSqlReport(); }