use of org.wso2.ei.dashboard.core.rest.model.LogListInner in project product-mi-tooling by wso2.
the class LogsDelegate method getLogsList.
public LogList getLogsList(String groupId, List<String> nodeList) throws ManagementApiException {
log.debug("Fetching logs via management api.");
LogList logList = new LogList();
for (String nodeId : nodeList) {
JsonArray logsArray = getLogsArray(groupId, nodeId);
for (JsonElement jsonElement : logsArray) {
JsonObject logObject = jsonElement.getAsJsonObject();
String fileName = logObject.get("FileName").getAsString();
String fileSize = logObject.get("Size").getAsString();
AtomicBoolean isRecordExist = new AtomicBoolean(false);
logList.stream().filter(o -> o.getName().equals(fileName)).forEach(o -> {
LogDetail logDetail = new LogDetail();
logDetail.setNodeId(nodeId);
logDetail.setLogSize(fileSize);
o.getNodes().add(logDetail);
isRecordExist.set(true);
});
if (!isRecordExist.get()) {
LogListInner logListInner = new LogListInner();
logListInner.setName(fileName);
List<LogDetail> logDetailList = new ArrayList<>();
LogDetail logDetail = new LogDetail();
logDetail.setNodeId(nodeId);
logDetail.setLogSize(fileSize);
logDetailList.add(logDetail);
logListInner.setNodes(logDetailList);
logList.add(logListInner);
}
}
}
return logList;
}
Aggregations