use of com.intel.mountwilson.common.WLMPortalException 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.common.WLMPortalException in project OpenAttestation by OpenAttestation.
the class WLMDataController method getWhitelistService.
/**
* This method will return a WhitelistService Object from a Session.
* This object is stored into Session at time of user login.
* Check CheckLoginController.java for more Clarification.
*
* @param req
* @return
* @throws WLMPortalException
*/
private WhitelistService getWhitelistService(HttpServletRequest req) throws WLMPortalException {
//getting already created session object by passing false while calling into getSession();
HttpSession session = req.getSession(false);
WhitelistService service = null;
if (session != null) {
try {
//getting WhitelistService Object from Session, stored while log-in time.
service = (WhitelistService) session.getAttribute("apiClientObject");
} catch (Exception e) {
log.error("Error while creating ApiCliennt Object. " + e.getMessage());
throw new WLMPortalException("Error while creating ApiCliennt Object. " + e.getMessage(), e);
}
}
return service;
}
use of com.intel.mountwilson.common.WLMPortalException in project OpenAttestation by OpenAttestation.
the class WLMDataController method getAllOSList.
/*Methods to get data for pagination for OS Component */
public ModelAndView getAllOSList(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getAllOSList >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
Map<Integer, List<OSDataVO>> map = getPartitionListOfAllOS(req);
responseView.addObject("OSDataVo", map.get(1));
responseView.addObject("noOfPages", map.size());
} catch (WLMPortalException 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.getAllOSList <<");
return responseView;
}
use of com.intel.mountwilson.common.WLMPortalException in project OpenAttestation by OpenAttestation.
the class WLMDataController method viewSingleMLEData.
public ModelAndView viewSingleMLEData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.viewSingleMLEData>>");
ModelAndView responseView = new ModelAndView(new JSONView());
MLEDataVO dataVO = new MLEDataVO();
MLEDataVO detailMLEVO = null;
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.");
}
try {
// TODO: Had to temporarily store the detailed MLE object so that it can be reused to retrieve the mleSource details.
// The MleData object expects the MLE_Type detail to be present to get the OS/OEM details. Need to fix this
detailMLEVO = mleClientService.getSingleMleData(dataVO, getWhitelistService(req));
responseView.addObject("dataVo", detailMLEVO);
responseView.addObject("result", true);
} catch (WLMPortalException e) {
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
log.error(e.toString());
}
// was used for white listing this MLE.
try {
responseView.addObject("mleSource", mleClientService.getMleSourceHost(detailMLEVO, getWhitelistService(req)));
} catch (WLMPortalException e) {
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
log.error(e.toString());
}
log.info("WLMDataController.viewSingleMLEData <<<");
return responseView;
}
use of com.intel.mountwilson.common.WLMPortalException in project OpenAttestation by OpenAttestation.
the class MLEClientServiceImpl method getMleSourceHost.
/**
* Retries the name of the host that was used for white listing the MLE.
*
* @param dataVO : Object containing the details of the MLE for which the host information needs to be retrieved.
* @param apiClientServices: ApiClient object
* @return : Name of the host
* @throws WLMPortalException
*/
@Override
public String getMleSourceHost(MLEDataVO dataVO, WhitelistService apiClientServices) throws WLMPortalException {
log.info("MLEClientServiceImpl.getMleSourceHost >>");
String hostName;
try {
MleData mleDataObj = ConverterUtil.getMleApiClientObject(dataVO);
if (dataVO.getOemName() != null) {
mleDataObj.setOemName(dataVO.getOemName());
mleDataObj.setOsName("");
mleDataObj.setOsVersion("");
} else {
mleDataObj.setOsName(dataVO.getOsName());
mleDataObj.setOsVersion(dataVO.getOsVersion());
mleDataObj.setOemName("");
}
hostName = apiClientServices.getMleSource(mleDataObj);
} catch (Exception e) {
throw ConnectionUtil.handleException(e);
}
log.info("MLEClientServiceImpl.getMleSourceHost <<");
return hostName;
}
Aggregations