Search in sources :

Example 31 with JSONView

use of com.intel.mountwilson.util.JSONView 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;
}
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)

Example 32 with JSONView

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

the class WLMDataController method getAllOSList.

/*Methods to get data for pagination for OS Component */
public ModelAndView getAllOSList(HttpServletRequest req, HttpServletResponse res) {
    log.info("WLMDataController.getAllOSList >>");
    ModelAndView responseView = new ModelAndView(new JSONView());
    try {
        Map<Integer, List<OSDataVO>> map = getPartitionListOfAllOS(req);
        responseView.addObject("OSDataVo", map.get(1));
        responseView.addObject("noOfPages", map.size());
    } catch (WLMPortalException 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.getAllOSList <<");
    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) List(java.util.List)

Example 33 with JSONView

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

Example 34 with JSONView

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

the class RegisterUserController method handleRequestInternal.

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServletResponse res) throws Exception {
    logger.info("RegisterUserController >>");
    ModelAndView view = new ModelAndView(new JSONView());
    view.addObject("result", false);
    view.addObject("message", "Register user functionality not supported.");
    return view;
}
Also used : JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView)

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