Search in sources :

Example 6 with JSONView

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

the class WLMDataController method getViewMle.

/*
	 * Method to get All MLE Data for Pagination
	 */
public ModelAndView getViewMle(HttpServletRequest req, HttpServletResponse res) {
    log.info("WLMDataController.getViewMle >>");
    ModelAndView responseView = new ModelAndView(new JSONView());
    try {
        Map<Integer, List<MLEDataVO>> map = getPartitionListOfAllMle(req);
        responseView.addObject("MLEDataVo", map.get(1));
        responseView.addObject("noOfPages", map.size());
    } catch (WLMPortalException 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.getViewMle <<");
    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 7 with JSONView

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

the class WLMDataController method getWhiteListForMle.

public ModelAndView getWhiteListForMle(HttpServletRequest req, HttpServletResponse res) {
    log.info("WLMDataController.getWhiteListForMle>>");
    ModelAndView responseView = new ModelAndView(new JSONView());
    MLEDataVO dataVO = new MLEDataVO();
    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.");
    }
    log.info("WLMDataController.getWhiteListForMle <<<");
    return responseView;
}
Also used : 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 8 with JSONView

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

the class WLMDataController method getAllOEMList.

/*Methods to get data for pagination for OEM Component */
public ModelAndView getAllOEMList(HttpServletRequest req, HttpServletResponse res) {
    log.info("WLMDataController.getAllOEMList >>");
    ModelAndView responseView = new ModelAndView(new JSONView());
    try {
        Map<Integer, List<OEMDataVO>> map = getPartitionListOfAllOEM(req);
        responseView.addObject("OEMDataVo", map.get(1));
        responseView.addObject("noOfPages", map.size());
    } catch (WLMPortalException 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.getAllOEMList <<");
    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 9 with JSONView

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

the class DemoPortalDataController method getOSVMMInfo.

/**
	 * @param req (HttpServletRequest Object)
	 * @param res (HttpServletResponse Object)
	 * @return
	 */
public ModelAndView getOSVMMInfo(HttpServletRequest req, HttpServletResponse res) {
    log.info("DemoPortalDataController.getOSVMMInfo >>");
    ModelAndView responseView = new ModelAndView(new JSONView());
    try {
        responseView.addObject("osInfo", demoPortalServices.getOSAndVMMInfo(getAttestationService(req, ApiClient.class)));
    } catch (DemoPortalException e) {
        log.error(e.toString());
        e.printStackTrace();
        responseView.addObject("osInfo", "");
        responseView.addObject("result", false);
        responseView.addObject("message", e.getMessage());
        return responseView;
    }
    responseView.addObject("result", true);
    responseView.addObject("message", "");
    log.info("DemoPortalDataController.getOSVMMInfo <<<");
    return responseView;
}
Also used : JSONView(com.intel.mountwilson.util.JSONView) ModelAndView(org.springframework.web.servlet.ModelAndView) DemoPortalException(com.intel.mountwilson.common.DemoPortalException)

Example 10 with JSONView

use of com.intel.mountwilson.util.JSONView 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;
}
Also used : JSONView(com.intel.mountwilson.util.JSONView) HttpSession(javax.servlet.http.HttpSession) HostDetailsEntityVO(com.intel.mountwilson.datamodel.HostDetailsEntityVO) ModelAndView(org.springframework.web.servlet.ModelAndView) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map) JsonMappingException(org.codehaus.jackson.map.JsonMappingException) IOException(java.io.IOException) DemoPortalException(com.intel.mountwilson.common.DemoPortalException) JsonParseException(org.codehaus.jackson.JsonParseException)

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