use of com.intel.mountwilson.datamodel.MLEDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method getWhiteListForMle.
public ModelAndView getWhiteListForMle(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getWhiteListForMle>>");
ModelAndView responseView = new ModelAndView(new JSONView());
MLEDataVO dataVO = new MLEDataVO();
try {
dataVO.setMleName(req.getParameter("mleName"));
dataVO.setMleVersion(req.getParameter("mleVersion"));
dataVO.setAttestation_Type(req.getParameter("attestation_Type"));
String mleType = req.getParameter("mleType");
if (mleType != null && mleType.equalsIgnoreCase("VMM")) {
dataVO.setOsName(req.getParameter("osName"));
dataVO.setOsVersion(req.getParameter("osVersion"));
} else {
dataVO.setOemName(req.getParameter("oemName"));
}
} catch (Exception e) {
log.error("Error While in request parameters Data. " + e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", "Error While request parameters are Null. Please check.");
}
log.info("WLMDataController.getWhiteListForMle <<<");
return responseView;
}
use of com.intel.mountwilson.datamodel.MLEDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method getPartitionListOfAllMle.
/**
* Method to get a Map View for all MLE data from REST Services according to there page no.
* Return data is used in pagination.
*
* @param req object of HttpServletRequest
* @return
* @throws WLMPortalException
*/
private Map<Integer, List<MLEDataVO>> getPartitionListOfAllMle(HttpServletRequest req) throws WLMPortalException {
Map<Integer, List<MLEDataVO>> map = new HashMap<Integer, List<MLEDataVO>>();
//Get List of all MLE.
List<MLEDataVO> dataVOs = mleClientService.getAllMLE(getWhitelistService(req));
int no_row_per_page = WLMPConfig.getConfiguration().getInt("mtwilson.wlmp.pagingSize");
//Divide List of all MLE into a subList based on the value of host per page.
List<List<MLEDataVO>> list = Lists.partition(dataVOs, no_row_per_page);
//Creating a Map view of MLE list based on the Page No.
int i = 1;
for (List<MLEDataVO> listForMap : list) {
map.put(i, listForMap);
i++;
}
//setting map into session attribute;
HttpSession session = req.getSession();
session.setAttribute("MleList", map);
return map;
}
use of com.intel.mountwilson.datamodel.MLEDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method getViewOSForPageNo.
@SuppressWarnings("unchecked")
public ModelAndView getViewOSForPageNo(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getViewOSForPageNo >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
HttpSession session = req.getSession();
Map<Integer, List<MLEDataVO>> map = (Map<Integer, List<MLEDataVO>>) session.getAttribute("OSList");
responseView.addObject("OSDataVo", map.get(Integer.parseInt(req.getParameter("pageNo"))));
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("OSDataVo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("WLMDataController.getViewOSForPageNo <<");
return responseView;
}
use of com.intel.mountwilson.datamodel.MLEDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method deleteMLEData.
public ModelAndView deleteMLEData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.deleteMLEData>>");
ModelAndView responseView = new ModelAndView(new JSONView());
MLEDataVO dataVO = new MLEDataVO();
int selectedPage;
try {
selectedPage = Integer.parseInt(req.getParameter("selectedPageNo"));
dataVO.setMleName(req.getParameter("mleName"));
dataVO.setMleVersion(req.getParameter("mleVersion"));
String mleType = req.getParameter("mleType");
if (mleType != null && mleType.equalsIgnoreCase("VMM")) {
dataVO.setOsName(req.getParameter("osName"));
dataVO.setOsVersion(req.getParameter("osVersion"));
} else {
dataVO.setOemName(req.getParameter("oemName"));
}
} catch (Exception e) {
log.error("Error While in request parameters Data. " + e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", "Error While request parameters are Null. Please check.");
return responseView;
}
try {
boolean deleteDone = mleClientService.deleteMLE(dataVO, getWhitelistService(req));
if (deleteDone) {
Map<Integer, List<MLEDataVO>> mapOfData = getPartitionListOfAllMle(req);
if (selectedPage > mapOfData.size()) {
selectedPage = mapOfData.size();
}
responseView.addObject("MLEDataVo", mapOfData.get(selectedPage));
responseView.addObject("noOfPages", mapOfData.size());
responseView.addObject("result", true);
}
} catch (WLMPortalException e) {
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
log.error(e.toString());
return responseView;
}
log.info("WLMDataController.deleteMLEData <<<");
return responseView;
}
use of com.intel.mountwilson.datamodel.MLEDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method getViewOEMForPageNo.
@SuppressWarnings("unchecked")
public ModelAndView getViewOEMForPageNo(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getViewOEMForPageNo >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
HttpSession session = req.getSession();
Map<Integer, List<MLEDataVO>> map = (Map<Integer, List<MLEDataVO>>) session.getAttribute("OEMList");
responseView.addObject("OEMDataVo", map.get(Integer.parseInt(req.getParameter("pageNo"))));
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("OEMDataVo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("WLMDataController.getViewOEMForPageNo <<");
return responseView;
}
Aggregations