Search in sources :

Example 1 with ServerDeployLog

use of com.ibeiliao.deployment.admin.vo.server.ServerDeployLog in project Corgi by kevinYin.

the class DeployHistoryServiceImpl method fillLogIntoServerDeploy.

private void fillLogIntoServerDeploy(List<ServerDeployHistory> deployHistoryList) {
    List<Integer> serverDeployIds = Lists.newArrayList();
    for (ServerDeployHistory history : deployHistoryList) {
        serverDeployIds.add(history.getId());
    }
    List<ServerDeployLog> deployLogs = deployLogService.getByServerDeployHistoryIds(serverDeployIds);
    ArrayListMultimap<Integer, ServerDeployLog> serverDeployId2DeployLogsMap = ArrayListMultimap.create();
    for (ServerDeployLog deployLog : deployLogs) {
        serverDeployId2DeployLogsMap.put(deployLog.getServerDeployId(), deployLog);
    }
    for (ServerDeployHistory deployHistory : deployHistoryList) {
        if (serverDeployId2DeployLogsMap.get(deployHistory.getId()) != null) {
            deployHistory.setServerDeployLogs(serverDeployId2DeployLogsMap.get(deployHistory.getId()));
        }
    }
}
Also used : ServerDeployLog(com.ibeiliao.deployment.admin.vo.server.ServerDeployLog) ServerDeployHistory(com.ibeiliao.deployment.admin.vo.deploy.ServerDeployHistory)

Example 2 with ServerDeployLog

use of com.ibeiliao.deployment.admin.vo.server.ServerDeployLog in project Corgi by kevinYin.

the class LogMessageProcessor method readLogs.

private List<ShellLogResponseMessage.ServerShellLog> readLogs(ShellLogRequestMessage request) {
    List<ShellLogResponseMessage.ServerShellLog> shellLogList = new ArrayList<>();
    DeployLogService deployLogService = SpringContextUtil.getBean(DeployLogService.class);
    StringBuilder sb = new StringBuilder(1024);
    for (Integer id : request.getServerDeployIdList()) {
        List<ServerDeployLog> list = deployLogService.getServerDeployLog(id);
        if (!CollectionUtils.isEmpty(list)) {
            sb.setLength(0);
            ShellLogResponseMessage.ServerShellLog log = new ShellLogResponseMessage.ServerShellLog();
            log.setServerDeployId(id);
            for (ServerDeployLog temp : list) {
                sb.append(temp.getShellLog()).append("\n");
            }
            log.setLog(sb.toString());
            shellLogList.add(log);
        }
    }
    return shellLogList;
}
Also used : ServerDeployLog(com.ibeiliao.deployment.admin.vo.server.ServerDeployLog) DeployLogService(com.ibeiliao.deployment.admin.service.server.DeployLogService) ArrayList(java.util.ArrayList) ShellLogResponseMessage(com.ibeiliao.deployment.admin.websocket.request.ShellLogResponseMessage)

Aggregations

ServerDeployLog (com.ibeiliao.deployment.admin.vo.server.ServerDeployLog)2 DeployLogService (com.ibeiliao.deployment.admin.service.server.DeployLogService)1 ServerDeployHistory (com.ibeiliao.deployment.admin.vo.deploy.ServerDeployHistory)1 ShellLogResponseMessage (com.ibeiliao.deployment.admin.websocket.request.ShellLogResponseMessage)1 ArrayList (java.util.ArrayList)1