use of com.intel.mountwilson.datamodel.OSDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method addOSData.
/**
* Method to add OS Data into REST Services.
*
* @param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView addOSData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.addOSData >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
OSDataVO dataVONew = new OSDataVO();
//Getting OS data from request parameter
dataVONew.setOsName(req.getParameter("osName"));
dataVONew.setOsVersion(req.getParameter("osVersion"));
dataVONew.setOsDescription(req.getParameter("osDescription"));
//Calling into Service Layer(OSClientServiceImpl) to add OS Data.
responseView.addObject("result", osClientService.addOSInfo(dataVONew, getWhitelistService(req)));
} catch (WLMPortalException e) {
log.error("Error Wile Adding OS Data. Root cause " + e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
log.info("WLMDataController.addOSData <<<");
return responseView;
}
use of com.intel.mountwilson.datamodel.OSDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method deleteOSData.
/**
* @param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView deleteOSData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.deleteOSData >>");
ModelAndView responseView = new ModelAndView(new JSONView());
int selectedPage;
try {
selectedPage = Integer.parseInt(req.getParameter("selectedPageNo"));
OSDataVO dataVONew = new OSDataVO();
dataVONew.setOsName(req.getParameter("osName"));
dataVONew.setOsVersion(req.getParameter("osVer"));
dataVONew.setOsDescription(req.getParameter("inputDec"));
boolean updateDone = osClientService.deleteOS(dataVONew, getWhitelistService(req));
if (updateDone) {
Map<Integer, List<OSDataVO>> mapOfData = getPartitionListOfAllOS(req);
if (selectedPage > mapOfData.size()) {
selectedPage = mapOfData.size();
}
responseView.addObject("OSDataVo", mapOfData.get(selectedPage));
responseView.addObject("noOfPages", mapOfData.size());
responseView.addObject("result", updateDone);
} else {
log.error("Error Wile deleting OS Data. Server Error.");
responseView.addObject("result", false);
responseView.addObject("message", "Api Client return false.");
}
} catch (WLMPortalException e) {
log.error("Error Wile deleting OS Data. Root cause " + e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
log.info("WLMDataController.deleteOSData <<<");
return responseView;
}
use of com.intel.mountwilson.datamodel.OSDataVO in project OpenAttestation by OpenAttestation.
the class ConverterUtil method getListToOSDataVO.
/**
* Method convert OS List from Api CLient into List OS OSDataVO.
*
* @param osListFromApiClient
* @return
*/
public static List<OSDataVO> getListToOSDataVO(List<OsData> osListFromApiClient) {
List<OSDataVO> list = new ArrayList<OSDataVO>();
for (OsData data : osListFromApiClient) {
OSDataVO osVo = new OSDataVO();
osVo.setOsName(data.getName());
osVo.setOsVersion(data.getVersion());
osVo.setOsDescription(data.getDescription());
list.add(osVo);
}
return list;
}
use of com.intel.mountwilson.datamodel.OSDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method getHostOSForVMM.
public ModelAndView getHostOSForVMM(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getHostOSForVMM >>");
ModelAndView responseView = new ModelAndView(new JSONView());
List<VmmHostDataVo> list = new ArrayList<VmmHostDataVo>();
VmmHostDataVo dataVo = null;
List<String> VmmNames = getVMMNameList(WLMPConfig.getConfiguration().getString("mtwilson.wlmp.openSourceHypervisors"));
try {
List<OSDataVO> osList = osClientService.getAllOS(getWhitelistService(req));
for (OSDataVO osDataVO : osList) {
dataVo = new VmmHostDataVo();
dataVo.setHostOS(osDataVO.getOsName());
dataVo.setHostVersion(osDataVO.getOsVersion());
dataVo.setVmmNames(VmmNames);
dataVo.setAttestationType("PCR");
list.add(dataVo);
}
} catch (WLMPortalException e) {
log.error("Error While getting Host OS Data for VMM. Root cause " + e.getStackTrace());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("HostList", list);
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("WLMDataController.getHostOSForVMM <<<");
return responseView;
}
use of com.intel.mountwilson.datamodel.OSDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method updateOSData.
/**
* Method to Update previously add OS Data into a REST Services.
*
*@param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView updateOSData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.updateOSData >>");
ModelAndView responseView = new ModelAndView(new JSONView());
int selectedPage;
try {
//Get Current select page no used in pagination.
selectedPage = Integer.parseInt(req.getParameter("selectedPageNo"));
//Get updated OS data from req object and create OSDataVO Object from it.
OSDataVO dataVONew = new OSDataVO();
dataVONew.setOsName(req.getParameter("osName"));
dataVONew.setOsVersion(req.getParameter("osVer"));
dataVONew.setOsDescription(req.getParameter("inputDec"));
//Calling into Service Layer(OSClientServiceImpl) to update OS Data.
boolean updateDone = osClientService.updateOSInfo(dataVONew, getWhitelistService(req));
// Once OS data is updated, get List of all OS for a current page to show while pagination.
if (updateDone) {
//Get map view of OS data from Services based on there page no.
Map<Integer, List<OSDataVO>> mapOfData = getPartitionListOfAllOS(req);
responseView.addObject("OSDataVo", mapOfData.get(selectedPage));
responseView.addObject("noOfPages", mapOfData.size());
responseView.addObject("result", updateDone);
} else {
log.error("Error Wile Editing OS Data. Api Client return false.");
responseView.addObject("result", false);
responseView.addObject("message", "Error Wile Editing OS Data. Api Client return false.");
}
} catch (WLMPortalException e) {
log.error("Error Wile Editing OS Data. Root cause " + e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
log.info("WLMDataController.updateOSData <<<");
return responseView;
}
Aggregations