use of com.intel.mountwilson.util.JSONView in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getHostsReport.
/**
* Method to Bulk Update trust status for selected host.
*
* @param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView getHostsReport(HttpServletRequest req, HttpServletResponse res) {
log.info("DemoPortalDataController.getHostsReport >>");
ModelAndView responseView = new ModelAndView(new JSONView());
String[] list = req.getParameterValues("selectedHost");
if (list == null) {
responseView.addObject("message", "No hosts were selected for reports.");
log.info("DemoPortalDataController.getHostsReport<<<");
return responseView;
}
List<String> hosts = Arrays.asList(list);
try {
responseView.addObject("reports", demoPortalServices.getHostTrustReport(hosts, getAttestationService(req, ApiClient.class)));
responseView.addObject("result", true);
} catch (DemoPortalException e) {
log.error(e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("message", "");
log.info("DemoPortalDataController.getHostsReport<<<");
return responseView;
}
use of com.intel.mountwilson.util.JSONView in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method trustVerificationDetailsXML.
/**
* Method to get Trust Verification Details using SAML.
*
* @param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView trustVerificationDetailsXML(HttpServletRequest req, HttpServletResponse res) {
log.info("DemoPortalDataController.trustVerificationDetailsXML >>");
ModelAndView responseView = new ModelAndView(new JSONView());
String hostName = req.getParameter("hostName");
try {
responseView.addObject("trustSamlDetails", demoPortalServices.trustVerificationDetails(hostName, getAttestationService(req, AttestationService.class), getTrustedCertificates(req)));
responseView.addObject("hostName", hostName);
responseView.addObject("result", true);
} catch (DemoPortalException e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
e.printStackTrace();
return responseView;
}
responseView.addObject("message", "");
responseView.addObject("result", true);
return responseView;
}
use of com.intel.mountwilson.util.JSONView 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.util.JSONView in project OpenAttestation by OpenAttestation.
the class WLMDataController method getUploadedMenifestFile.
public ModelAndView getUploadedMenifestFile(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.getUploadedMenifestFile >>");
ModelAndView responseView = new ModelAndView(new JSONView());
Object manifest = req.getSession().getAttribute("manifestValue");
boolean result = false;
if (manifest != null) {
result = true;
responseView.addObject("manifestValue", manifest);
}
responseView.addObject("result", result);
log.info("WLMDataController.getUploadedMenifestFile <<<");
return responseView;
}
use of com.intel.mountwilson.util.JSONView 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;
}
Aggregations