public static StageContext fromCommandDTO()

in bigtop-manager-server/src/main/java/org/apache/bigtop/manager/server/command/stage/StageContext.java [48:68]


    public static StageContext fromCommandDTO(CommandDTO commandDTO) {
        StageContext context = new StageContext();

        if (commandDTO.getClusterId() != null && commandDTO.getClusterId() != 0) {
            ClusterDao clusterDao = SpringContextHolder.getBean(ClusterDao.class);
            ClusterPO clusterPO = clusterDao.findById(commandDTO.getClusterId());
            context.setClusterId(clusterPO.getId());
            context.setClusterName(clusterPO.getName());
            context.setUserGroup(clusterPO.getUserGroup());
            context.setRootDir(clusterPO.getRootDir());
        }

        switch (commandDTO.getCommandLevel()) {
            case CLUSTER -> fromClusterCommandPayload(context, commandDTO);
            case HOST -> fromHostCommandPayload(context, commandDTO);
            case SERVICE -> fromServiceCommandPayload(context, commandDTO);
            case COMPONENT -> fromComponentCommandPayload(context, commandDTO);
        }

        return context;
    }