use of com.intel.mountwilson.util.JSONView in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getAllOemInfo.
/**
* @param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView getAllOemInfo(HttpServletRequest req, HttpServletResponse res) {
log.info("DemoPortalDataController.getAllOemInfo >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
responseView.addObject("oemInfo", demoPortalServices.getAllOemInfo(getAttestationService(req, ApiClient.class)));
} catch (DemoPortalException e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("oemInfo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("DemoPortalDataController.getAllOemInfo <<<");
return responseView;
}
use of com.intel.mountwilson.util.JSONView in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getInfoForHostID.
/**
* @param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView getInfoForHostID(HttpServletRequest req, HttpServletResponse res) {
log.info("DemoPortalDataController.getInfoForHostID >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
String hostName = req.getParameter("hostName");
responseView.addObject("hostData", demoPortalServices.getSingleHostDetailFromDB(hostName, getAttestationService(req, AttestationService.class)));
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("oemInfo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("DemoPortalDataController.getInfoForHostID <<<");
return responseView;
}
use of com.intel.mountwilson.util.JSONView in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getDashBoardData.
/**
* Method is used to get Trust Status for Hosts to show on Home Screen.
*
* @param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView getDashBoardData(HttpServletRequest req, HttpServletResponse res) {
log.info("DemoPortalDataController.getDashBoardData >>");
Map<Integer, List<HostDetailsEntityVO>> map = null;
ModelAndView responseView = new ModelAndView(new JSONView());
try {
boolean forceVerify = Boolean.parseBoolean(req.getParameter("force_verify"));
//Get map view for All Host based on the value of Page_NO(this values is available from TDPConfig)
map = getAllHostDetailsFromDB(req);
//calling into a Service layer to get trust status for Host on Page No 1(using map.get(1)).
//responseView.addObject("hostVo",demoPortalServices.getTrustStatusForHost(map.get(1),getAttestationService(req,AttestationService.class),getTrustedCertificates(req)));
responseView.addObject("hostVo", demoPortalServices.getTrustStatusForHost(map.get(1), getAttestationService(req, AttestationService.class), getTrustedCertificates(req), forceVerify));
//setting no of page required to show all Host data while applying pagination in JSP
responseView.addObject("noOfPages", map.size());
} catch (Exception e) {
log.error("getDashBoardData exception: " + e.toString());
responseView.addObject("hostVo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
if (e.getMessage().toLowerCase().contains("currently there are no hosts configured")) {
responseView.addObject("noHosts", true);
}
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("DemoPortalDataController.getDashBoardData <<<");
return responseView;
}
use of com.intel.mountwilson.util.JSONView 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;
}
use of com.intel.mountwilson.util.JSONView 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;
}
Aggregations