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);
}