Search in sources :

Example 11 with JSONView

use of com.intel.mountwilson.util.JSONView 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;
}
Also used : JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) ArrayList(java.util.ArrayList) List(java.util.List) FileUploadException(org.apache.commons.fileupload.FileUploadException) WLMPortalException(com.intel.mountwilson.common.WLMPortalException) OEMDataVO(com.intel.mountwilson.datamodel.OEMDataVO)

Example 12 with JSONView

use of com.intel.mountwilson.util.JSONView 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;
}
Also used : WLMPortalException(com.intel.mountwilson.common.WLMPortalException) JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) OEMDataVO(com.intel.mountwilson.datamodel.OEMDataVO)

Example 13 with JSONView

use of com.intel.mountwilson.util.JSONView 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;
}
Also used : WLMPortalException(com.intel.mountwilson.common.WLMPortalException) JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) ArrayList(java.util.ArrayList) VmmHostDataVo(com.intel.mountwilson.datamodel.VmmHostDataVo) OSDataVO(com.intel.mountwilson.datamodel.OSDataVO)

Example 14 with JSONView

use of com.intel.mountwilson.util.JSONView in project OpenAttestation by OpenAttestation.

the class WLMDataController method deleteOEMData.

public ModelAndView deleteOEMData(HttpServletRequest req, HttpServletResponse res) {
    log.info("WLMDataController.deleteOEMData >>");
    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.deleteOEM(dataVONew, getWhitelistService(req));
        if (updateDone) {
            Map<Integer, List<OEMDataVO>> mapOfData = getPartitionListOfAllOEM(req);
            if (selectedPage > mapOfData.size()) {
                selectedPage = mapOfData.size();
            }
            responseView.addObject("OEMDataVo", mapOfData.get(selectedPage));
            responseView.addObject("noOfPages", mapOfData.size());
            responseView.addObject("result", updateDone);
        }
    } catch (Exception e) {
        log.error("Error Wile Deleting OEM Data. Root cause " + e.getMessage());
        responseView.addObject("result", false);
        responseView.addObject("message", e.getMessage());
    }
    log.info("WLMDataController.deleteOEMData <<<");
    return responseView;
}
Also used : JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) ArrayList(java.util.ArrayList) List(java.util.List) FileUploadException(org.apache.commons.fileupload.FileUploadException) WLMPortalException(com.intel.mountwilson.common.WLMPortalException) OEMDataVO(com.intel.mountwilson.datamodel.OEMDataVO)

Example 15 with JSONView

use of com.intel.mountwilson.util.JSONView in project OpenAttestation by OpenAttestation.

the class WLMDataController method getViewOSForPageNo.

@SuppressWarnings("unchecked")
public ModelAndView getViewOSForPageNo(HttpServletRequest req, HttpServletResponse res) {
    log.info("WLMDataController.getViewOSForPageNo >>");
    ModelAndView responseView = new ModelAndView(new JSONView());
    try {
        HttpSession session = req.getSession();
        Map<Integer, List<MLEDataVO>> map = (Map<Integer, List<MLEDataVO>>) session.getAttribute("OSList");
        responseView.addObject("OSDataVo", map.get(Integer.parseInt(req.getParameter("pageNo"))));
    } catch (Exception 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.getViewOSForPageNo <<");
    return responseView;
}
Also used : JSONView(com.intel.mountwilson.util.JSONView) HttpSession(javax.servlet.http.HttpSession) ModelAndView(org.springframework.web.servlet.ModelAndView) MLEDataVO(com.intel.mountwilson.datamodel.MLEDataVO) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) FileUploadException(org.apache.commons.fileupload.FileUploadException) WLMPortalException(com.intel.mountwilson.common.WLMPortalException)

Aggregations

JSONView (com.intel.mountwilson.util.JSONView)34 ModelAndView (org.springframework.web.servlet.ModelAndView)34 WLMPortalException (com.intel.mountwilson.common.WLMPortalException)19 List (java.util.List)16 DemoPortalException (com.intel.mountwilson.common.DemoPortalException)13 ArrayList (java.util.ArrayList)13 FileUploadException (org.apache.commons.fileupload.FileUploadException)10 MLEDataVO (com.intel.mountwilson.datamodel.MLEDataVO)7 IOException (java.io.IOException)6 HashMap (java.util.HashMap)6 Map (java.util.Map)6 JsonParseException (org.codehaus.jackson.JsonParseException)6 JsonMappingException (org.codehaus.jackson.map.JsonMappingException)6 HttpSession (javax.servlet.http.HttpSession)5 OEMDataVO (com.intel.mountwilson.datamodel.OEMDataVO)4 OSDataVO (com.intel.mountwilson.datamodel.OSDataVO)4 HostDetailsEntityVO (com.intel.mountwilson.datamodel.HostDetailsEntityVO)3 Gson (com.google.gson.Gson)1 VmmHostDataVo (com.intel.mountwilson.datamodel.VmmHostDataVo)1 AttestationService (com.intel.mtwilson.AttestationService)1