use of org.springframework.web.servlet.ModelAndView in project OpenAttestation by OpenAttestation.
the class DemoPortalDataController method getHostForViewForPage.
/**
* Method to get Host list to for View Host Page for given page no.
*
* @param req (HttpServletRequest Object)
* @param res (HttpServletResponse Object)
* @return
*/
public ModelAndView getHostForViewForPage(HttpServletRequest req, HttpServletResponse res) {
log.info("DemoPortalDataController.getHostForViewForPage >>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
int selectedPage = Integer.parseInt(req.getParameter("pageNo"));
HttpSession session = req.getSession();
@SuppressWarnings("unchecked") Map<Integer, List<HostDetailsEntityVO>> mapOfData = (Map<Integer, List<HostDetailsEntityVO>>) session.getAttribute("HostVoList");
responseView.addObject("hostVo", mapOfData.get(selectedPage));
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
responseView.addObject("hostVo", "");
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
return responseView;
}
responseView.addObject("result", true);
responseView.addObject("message", "");
log.info("DemoPortalDataController.getHostForViewForPage<<<");
return responseView;
}
use of org.springframework.web.servlet.ModelAndView in project OpenAttestation by OpenAttestation.
the class WLMDataController method logOutUser.
public ModelAndView logOutUser(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.logOutUser >>");
ModelAndView responseView = new ModelAndView("Login");
try {
HttpSession session = req.getSession(false);
if (session != null) {
session.invalidate();
}
//res.sendRedirect(req.getContextPath()+"/login.htm");
} catch (Exception e) {
log.error(e.toString());
e.printStackTrace();
}
log.info("WLMDataController.logOutUser <<");
return responseView;
}
use of org.springframework.web.servlet.ModelAndView in project OpenAttestation by OpenAttestation.
the class WLMDataController method updateOEMData.
public ModelAndView updateOEMData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.updateOEMData >>");
ModelAndView responseView = new ModelAndView(new JSONView());
int selectedPage;
try {
selectedPage = Integer.parseInt(req.getParameter("selectedPageNo"));
OEMDataVO dataVONew = new OEMDataVO();
dataVONew.setOemName(req.getParameter("oemName"));
dataVONew.setOemDescription(req.getParameter("inputDec"));
boolean updateDone = oemClientService.updateOEMInfo(dataVONew, getWhitelistService(req));
if (updateDone) {
Map<Integer, List<OEMDataVO>> mapOfData = getPartitionListOfAllOEM(req);
responseView.addObject("OEMDataVo", mapOfData.get(selectedPage));
responseView.addObject("noOfPages", mapOfData.size());
responseView.addObject("result", updateDone);
}
} catch (Exception e) {
log.error("Error Wile Editing OEM Data. Root cause " + e.getMessage());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
log.info("WLMDataController.updateOEMData <<<");
return responseView;
}
use of org.springframework.web.servlet.ModelAndView in project OpenAttestation by OpenAttestation.
the class WLMDataController method addOEMData.
public ModelAndView addOEMData(HttpServletRequest req, HttpServletResponse res) {
log.info("WLMDataController.addOEMData>>");
ModelAndView responseView = new ModelAndView(new JSONView());
try {
OEMDataVO dataVONew = new OEMDataVO();
dataVONew.setOemName(req.getParameter("oemName"));
dataVONew.setOemDescription(req.getParameter("oemDescription"));
System.out.println("New OEM data >>> " + dataVONew.toString());
responseView.addObject("result", oemClientService.addOEMInfo(dataVONew, getWhitelistService(req)));
} catch (WLMPortalException e) {
log.error("Error Wile Adding OEM Data. Root cause " + e.getStackTrace());
responseView.addObject("result", false);
responseView.addObject("message", e.getMessage());
}
log.info("WLMDataController.addOEMData <<<");
return responseView;
}
use of org.springframework.web.servlet.ModelAndView 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;
}
Aggregations