use of com.intel.mountwilson.datamodel.OEMDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method updateOEMData.
public ModelAndView updateOEMData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.updateOEMData >>");
ModelAndView responseView = new ModelAndView(new JSONView());
int selectedPage;
try {
selectedPage = Integer.parseInt(req.getParameter("selectedPageNo"));
OEMDataVO dataVONew = new OEMDataVO();
dataVONew.setOemName(req.getParameter("oemName"));
dataVONew.setOemDescription(req.getParameter("inputDec"));
boolean updateDone = oemClientService.updateOEMInfo(dataVONew, getWhitelistService(req));
if (updateDone) {
Map<Integer, List<OEMDataVO>> mapOfData = getPartitionListOfAllOEM(req);
responseView.addObject("OEMDataVo", mapOfData.get(selectedPage));
responseView.addObject("noOfPages", mapOfData.size());
responseView.addObject("result", updateDone);
}
} catch (Exception e) {
log.error("Error Wile Editing OEM Data. Root cause " + e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
log.info("WLMDataController.updateOEMData <<<");
return responseView;
}
use of com.intel.mountwilson.datamodel.OEMDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method addOEMData.
public ModelAndView addOEMData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.addOEMData>>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
OEMDataVO dataVONew = new OEMDataVO();
dataVONew.setOemName(req.getParameter("oemName"));
dataVONew.setOemDescription(req.getParameter("oemDescription"));
System.out.println("New OEM data >>> " + dataVONew.toString());
responseView.addObject("result", oemClientService.addOEMInfo(dataVONew, getWhitelistService(req)));
} catch (WLMPortalException e) {
log.error("Error Wile Adding OEM Data. Root cause " + e.getStackTrace());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
log.info("WLMDataController.addOEMData <<<");
return responseView;
}
use of com.intel.mountwilson.datamodel.OEMDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method deleteOEMData.
public ModelAndView deleteOEMData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.deleteOEMData >>");
ModelAndView responseView = new ModelAndView(new JSONView());
int selectedPage;
try {
selectedPage = Integer.parseInt(req.getParameter("selectedPageNo"));
OEMDataVO dataVONew = new OEMDataVO();
dataVONew.setOemName(req.getParameter("oemName"));
//dataVONew.setOemDescription(req.getParameter("inputDec"));
boolean updateDone = oemClientService.deleteOEM(dataVONew, getWhitelistService(req));
if (updateDone) {
Map<Integer, List<OEMDataVO>> mapOfData = getPartitionListOfAllOEM(req);
if (selectedPage > mapOfData.size()) {
selectedPage = mapOfData.size();
}
responseView.addObject("OEMDataVo", mapOfData.get(selectedPage));
responseView.addObject("noOfPages", mapOfData.size());
responseView.addObject("result", updateDone);
}
} catch (Exception e) {
log.error("Error Wile Deleting OEM Data. Root cause " + e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
log.info("WLMDataController.deleteOEMData <<<");
return responseView;
}
use of com.intel.mountwilson.datamodel.OEMDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method getPartitionListOfAllOEM.
/**
* Method to get a Map View for all OEM 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<OEMDataVO>> getPartitionListOfAllOEM(HttpServletRequest req) throws WLMPortalException {
Map<Integer, List<OEMDataVO>> map = new HashMap<Integer, List<OEMDataVO>>();
//Get List of all OEM.
List<OEMDataVO> dataVOs = oemClientService.getAllOEM(getWhitelistService(req));
int no_row_per_page = WLMPConfig.getConfiguration().getInt("mtwilson.wlmp.pagingSize");
//Divide List of all OEM into a subList based on the value of host per page.
List<List<OEMDataVO>> list = Lists.partition(dataVOs, no_row_per_page);
int i = 1;
for (List<OEMDataVO> listForMap : list) {
map.put(i, listForMap);
i++;
}
//setting map into session attribute;
HttpSession session = req.getSession();
session.setAttribute("OEMList", map);
return map;
}
use of com.intel.mountwilson.datamodel.OEMDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method getHostOSForBios.
public ModelAndView getHostOSForBios(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getHostOSForBios >>");
ModelAndView responseView = new ModelAndView(new JSONView());
List<OEMDataVO> list = null;
try {
list = oemClientService.getAllOEM(getWhitelistService(req));
responseView.addObject("result", true);
} catch (WLMPortalException e) {
log.error("Error While getting Host OS Data for BIOS. Root cause " + e.getStackTrace());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
responseView.addObject("HostList", list);
responseView.addObject("message", "");
log.info("WLMDataController.getHostOSForBios <<<");
return responseView;
}
Aggregations