use of com.intel.mountwilson.datamodel.MLEDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method getAddMle.
@SuppressWarnings("serial")
public ModelAndView getAddMle(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getAddMle>>");
ModelAndView responseView = new ModelAndView(new JSONView());
String mleOb = null;
boolean newMle = false;
try {
mleOb = req.getParameter("mleObject");
newMle = Boolean.parseBoolean(req.getParameter("newMle"));
} catch (Exception e1) {
log.error("Error While in request parameters Data. " + e1.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", "Error While request parameters are Null. Please check.");
}
System.out.println(mleOb);
MLEDataVO dataVO = new MLEDataVO();
try {
Type mleDataType = new TypeToken<MLEDataVO>() {
}.getType();
dataVO = new Gson().fromJson(mleOb, mleDataType);
for (Map<String, String> manifestMap : dataVO.getManifestList()) {
for (Entry<String, String> manifest : manifestMap.entrySet()) {
manifest.setValue(manifest.getValue().toUpperCase());
}
}
System.out.println("dataVo >>" + dataVO);
if (newMle) {
responseView.addObject("result", mleClientService.addMLEInfo(dataVO, getWhitelistService(req)));
} else {
responseView.addObject("result", mleClientService.updateMLEInfo(dataVO, getWhitelistService(req)));
}
} catch (Exception e) {
log.error(e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
log.info("WLMDataController.getAddMle <<<");
return responseView;
}
use of com.intel.mountwilson.datamodel.MLEDataVO in project OpenAttestation by OpenAttestation.
the class WLMDataController method getViewMleForPageNo.
@SuppressWarnings("unchecked")
public ModelAndView getViewMleForPageNo(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getViewMleForPageNo >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
HttpSession session = req.getSession();
Map<Integer, List<MLEDataVO>> map = (Map<Integer, List<MLEDataVO>>) session.getAttribute("MleList");
responseView.addObject("MLEDataVo", map.get(Integer.parseInt(req.getParameter("pageNo"))));
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("MLEDataVo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("WLMDataController.getViewMleForPageNo <<");
return responseView;
}
use of com.intel.mountwilson.datamodel.MLEDataVO 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.datamodel.MLEDataVO in project OpenAttestation by OpenAttestation.
the class ConverterUtil method getMleDataVoObject.
public static MLEDataVO getMleDataVoObject(MleData data) {
MLEDataVO mleVo = new MLEDataVO();
mleVo.setMleName(data.getName());
mleVo.setMleVersion(data.getVersion());
mleVo.setMleDescription(data.getDescription());
mleVo.setOsName(data.getOsName());
mleVo.setOsVersion(data.getOsVersion());
mleVo.setAttestation_Type(data.getAttestationType());
mleVo.setOemName(data.getOemName());
mleVo.setManifestList(getManifestListFromApiClient(data.getManifestList()));
mleVo.setMleType(data.getMleType());
return mleVo;
}
use of com.intel.mountwilson.datamodel.MLEDataVO in project OpenAttestation by OpenAttestation.
the class MLEClientServiceImpl method getSingleMleData.
/**
* Method to get Single MLE Details from a rest services.
*
* @param dataVO
* @param apiClientServices
* @return
* @throws WLMPortalException
*/
@Override
public MLEDataVO getSingleMleData(MLEDataVO dataVO, WhitelistService apiClientServices) throws WLMPortalException {
log.info("MLEClientServiceImpl.getSingleMleData >>");
MLEDataVO mleObject = null;
try {
MLESearchCriteria criteria = new MLESearchCriteria();
criteria.mleName = dataVO.getMleName();
criteria.mleVersion = dataVO.getMleVersion();
if (dataVO.getOemName() != null) {
criteria.oemName = dataVO.getOemName();
criteria.osName = "";
criteria.osVersion = "";
} else {
criteria.osName = dataVO.getOsName();
criteria.osVersion = dataVO.getOsVersion();
criteria.oemName = "";
}
mleObject = ConverterUtil.getMleDataVoObject(apiClientServices.getMLEManifest(criteria));
} catch (Exception e) {
throw ConnectionUtil.handleException(e);
}
log.info("MLEClientServiceImpl.getSingleMleData <<");
return mleObject;
}
Aggregations