long historyTime = payload.getHistoryEndDate().getTime() - payload.getHistoryStartDate().getTime();
String domain = payload.getDomain();
switch (payload.getAction()) {
case HOURLY_PROJECT:
CrossReport projectReport = getHourlyReport(payload);
ProjectInfo projectInfo = new ProjectInfo(payload.getHourDuration());
projectInfo.setHostinfoService(m_hostinfoService);
projectInfo.setClientIp(model.getIpAddress()).setCallSortBy(model.getCallSort())
.setServiceSortBy(model.getServiceSort());
projectInfo.visitCrossReport(projectReport);
model.setProjectInfo(projectInfo);
model.setReport(projectReport);
List<TypeDetailInfo> hourlyDetails = projectInfo.getServiceProjectsInfo();
if (projectInfo.getCallerProjectsInfo().isEmpty()) {
for (TypeDetailInfo info : hourlyDetails) {
String projectName = info.getProjectName();
if (projectName.equalsIgnoreCase(payload.getDomain()) || projectName.equalsIgnoreCase("UnknownProject")
|| projectName.equalsIgnoreCase(ProjectInfo.ALL_CLIENT)) {
continue;
}
ProjectInfo temp = buildCallProjectInfo(projectName, payload.getPeriod(),
String.valueOf(payload.getDate()), payload.getHourDuration());
TypeDetailInfo detail = temp.getAllCallProjectInfo().get(domain);
if (detail != null) {
detail.setProjectName(projectName);
projectInfo.addCallerProjectInfo(projectName, detail);
}
}
}
break;
case HOURLY_HOST:
CrossReport hostReport = getHourlyReport(payload);
HostInfo hostInfo = new HostInfo(payload.getHourDuration());
hostInfo.setHostinfoService(m_hostinfoService);
hostInfo.setClientIp(model.getIpAddress()).setCallSortBy(model.getCallSort())
.setServiceSortBy(model.getServiceSort());
hostInfo.setProjectName(payload.getProjectName());
hostInfo.visitCrossReport(hostReport);
model.setReport(hostReport);
model.setHostInfo(hostInfo);
break;
case HOURLY_METHOD:
CrossReport methodReport = getHourlyReport(payload);
MethodInfo methodInfo = new MethodInfo(payload.getHourDuration());
methodInfo.setHostinfoService(m_hostinfoService);
methodInfo.setClientIp(model.getIpAddress()).setCallSortBy(model.getCallSort())
.setServiceSortBy(model.getServiceSort()).setRemoteProject(payload.getProjectName());
methodInfo.setRemoteIp(payload.getRemoteIp()).setQuery(model.getQueryName());
methodInfo.visitCrossReport(methodReport);
model.setReport(methodReport);
model.setMethodInfo(methodInfo);
break;
case HISTORY_PROJECT:
CrossReport historyProjectReport = getSummarizeReport(payload);
ProjectInfo historyProjectInfo = new ProjectInfo(historyTime);
historyProjectInfo.setHostinfoService(m_hostinfoService);
historyProjectInfo.setClientIp(model.getIpAddress()).setCallSortBy(model.getCallSort())
.setServiceSortBy(model.getServiceSort());
historyProjectInfo.visitCrossReport(historyProjectReport);
model.setProjectInfo(historyProjectInfo);
model.setReport(historyProjectReport);
List<TypeDetailInfo> historyDetails = historyProjectInfo.getServiceProjectsInfo();
if (historyProjectInfo.getCallerProjectsInfo().isEmpty()) {
for (TypeDetailInfo info : historyDetails) {
String projectName = info.getProjectName();
if (projectName.equalsIgnoreCase(payload.getDomain()) || projectName.equalsIgnoreCase("UnknownProject")
|| projectName.equalsIgnoreCase(ProjectInfo.ALL_CLIENT)) {
continue;
}
Date start = payload.getHistoryStartDate();
Date end = payload.getHistoryEndDate();
ProjectInfo temp = buildHistoryCallProjectInfo(projectName, start, end);
TypeDetailInfo detail = temp.getAllCallProjectInfo().get(domain);
if (detail != null) {
detail.setProjectName(projectName);
historyProjectInfo.addCallerProjectInfo(projectName, detail);
}
}
}
break;
case HISTORY_HOST:
CrossReport historyHostReport = getSummarizeReport(payload);
HostInfo historyHostInfo = new HostInfo(historyTime);
historyHostInfo.setHostinfoService(m_hostinfoService);
historyHostInfo.setClientIp(model.getIpAddress()).setCallSortBy(model.getCallSort())
.setServiceSortBy(model.getServiceSort());
historyHostInfo.setProjectName(payload.getProjectName());
historyHostInfo.visitCrossReport(historyHostReport);
model.setReport(historyHostReport);
model.setHostInfo(historyHostInfo);
break;
case HISTORY_METHOD:
CrossReport historyMethodReport = getSummarizeReport(payload);
MethodInfo historyMethodInfo = new MethodInfo(historyTime);
historyMethodInfo.setHostinfoService(m_hostinfoService);
historyMethodInfo.setClientIp(model.getIpAddress()).setCallSortBy(model.getCallSort())
.setServiceSortBy(model.getServiceSort()).setRemoteProject(payload.getProjectName());
historyMethodInfo.setRemoteIp(payload.getRemoteIp()).setQuery(model.getQueryName());
historyMethodInfo.visitCrossReport(historyMethodReport);
model.setReport(historyMethodReport);
model.setMethodInfo(historyMethodInfo);
break;
case METHOD_QUERY:
String method = payload.getMethod();
CrossMethodVisitor info = new CrossMethodVisitor(method, m_hostinfoService);
String reportType = payload.getReportType();
CrossReport queryReport = null;
if (reportType != null
&& (reportType.equals("day") || reportType.equals("week") || reportType.equals("month"))) {
queryReport = getSummarizeReport(payload);
} else {