use of io.datarouter.webappinstance.storage.webappinstancelog.WebappInstanceLogKey in project datarouter by hotpads.
the class WebappInstanceLogHandler method webappInstanceLog.
@Handler(defaultHandler = true)
public Mav webappInstanceLog(String webappName, String serverName) {
Mav mav = new Mav(files.jsp.admin.datarouter.webappInstances.webappInstanceLogJsp);
WebappInstanceLogKey prefix = new WebappInstanceLogKey(webappName, serverName, null, null);
List<WebappInstanceLog> logs = dao.scanWithPrefix(prefix).sort(Comparator.comparing(log -> log.getKey().getStartup(), Collections.reverseOrder())).list();
int logCount = logs.size();
ZoneId zoneId = currentUserSessionInfoService.getZoneId(request);
List<WebappInstanceLogJspDto> logJspDtos = new ArrayList<>(logCount);
for (int i = 0; i < logCount; ++i) {
Instant fallbackRefreshedLast = i == 0 ? Instant.now() : logs.get(i - 1).getKey().getStartup();
logJspDtos.add(new WebappInstanceLogJspDto(logs.get(i), fallbackRefreshedLast, zoneId));
}
mav.put("logs", logJspDtos);
return mav;
}
Aggregations