Search in sources :

Example 1 with WLMPortalException

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

Example 2 with WLMPortalException

use of com.intel.mountwilson.common.WLMPortalException 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;
}
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) OSDataVO(com.intel.mountwilson.datamodel.OSDataVO)

Example 3 with WLMPortalException

use of com.intel.mountwilson.common.WLMPortalException 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 4 with WLMPortalException

use of com.intel.mountwilson.common.WLMPortalException 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 5 with WLMPortalException

use of com.intel.mountwilson.common.WLMPortalException 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)

Aggregations

WLMPortalException (com.intel.mountwilson.common.WLMPortalException)17 JSONView (com.intel.mountwilson.util.JSONView)11 ModelAndView (org.springframework.web.servlet.ModelAndView)11 ArrayList (java.util.ArrayList)7 List (java.util.List)6 OSDataVO (com.intel.mountwilson.datamodel.OSDataVO)4 MLEDataVO (com.intel.mountwilson.datamodel.MLEDataVO)3 FileUploadException (org.apache.commons.fileupload.FileUploadException)3 OEMDataVO (com.intel.mountwilson.datamodel.OEMDataVO)2 MLESearchCriteria (com.intel.mtwilson.datatypes.MLESearchCriteria)2 OemData (com.intel.mtwilson.datatypes.OemData)2 VmmHostDataVo (com.intel.mountwilson.datamodel.VmmHostDataVo)1 WhitelistService (com.intel.mtwilson.WhitelistService)1 MleData (com.intel.mtwilson.datatypes.MleData)1 HttpSession (javax.servlet.http.HttpSession)1