Search in sources :

Example 1 with NlyteSummary

use of com.vmware.flowgate.common.model.NlyteSummary in project flowgate by vmware.

the class SummaryService method getNlyteSummary.

public NlyteSummary getNlyteSummary(FacilitySoftwareConfig nlyte) {
    NlyteSummary nlyteSummary = new NlyteSummary();
    nlyteSummary.setName(nlyte.getName());
    nlyteSummary.setUrl(nlyte.getServerURL());
    List<HashMap<String, Object>> results = summaryRepository.countAssetGroupByTypeAndSource("%" + nlyte.getId() + "%");
    if (!results.isEmpty()) {
        for (HashMap<String, Object> map : results) {
            if ((String) map.get("category") == null) {
                continue;
            }
            switch((String) map.get("category")) {
                case "Server":
                    nlyteSummary.setServerNum((Integer) map.get("count"));
                    break;
                case "PDU":
                    nlyteSummary.setPduNum((Integer) map.get("count"));
                    break;
                case "Sensors":
                    nlyteSummary.setSensorNum((Integer) map.get("count"));
                    break;
                case "Cabinet":
                    nlyteSummary.setCabinetNum((Integer) map.get("count"));
                    break;
                case "Networks":
                    nlyteSummary.setSwitchNum((Integer) map.get("count"));
                    break;
                default:
                    break;
            }
        }
    }
    return nlyteSummary;
}
Also used : NlyteSummary(com.vmware.flowgate.common.model.NlyteSummary) HashMap(java.util.HashMap)

Example 2 with NlyteSummary

use of com.vmware.flowgate.common.model.NlyteSummary in project flowgate by vmware.

the class SummaryService method getNlyteSummaryList.

public List<NlyteSummary> getNlyteSummaryList() {
    List<NlyteSummary> nlyteSummarys = new ArrayList<>();
    List<FacilitySoftwareConfig> facility = facilityRepo.findAllByType(com.vmware.flowgate.common.model.FacilitySoftwareConfig.SoftwareType.Nlyte.name());
    for (FacilitySoftwareConfig nlyte : facility) {
        NlyteSummary nlyteSummary = getNlyteSummary(nlyte);
        nlyteSummarys.add(nlyteSummary);
    }
    return nlyteSummarys;
}
Also used : NlyteSummary(com.vmware.flowgate.common.model.NlyteSummary) ArrayList(java.util.ArrayList) FacilitySoftwareConfig(com.vmware.flowgate.common.model.FacilitySoftwareConfig)

Aggregations

NlyteSummary (com.vmware.flowgate.common.model.NlyteSummary)2 FacilitySoftwareConfig (com.vmware.flowgate.common.model.FacilitySoftwareConfig)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1