Search in sources :

Example 6 with OSDataVO

use of com.intel.mountwilson.datamodel.OSDataVO in project OpenAttestation by OpenAttestation.

the class WLMDataController method getPartitionListOfAllOS.

/**
	 * Method to get a Map View for all OS data from REST Services according to there page no.
	 * Return data is used in pagination.
	 * 
	 * @param req object of HttpServletRequest
	 * @return
	 * @throws WLMPortalException
	 */
private Map<Integer, List<OSDataVO>> getPartitionListOfAllOS(HttpServletRequest req) throws WLMPortalException {
    Map<Integer, List<OSDataVO>> mapOfData = new HashMap<Integer, List<OSDataVO>>();
    //Get List of all OS.
    List<OSDataVO> dataVOs = osClientService.getAllOS(getWhitelistService(req));
    int no_row_per_page = WLMPConfig.getConfiguration().getInt("mtwilson.wlmp.pagingSize");
    //Divide List of all OS into a subList based on the value of host per page. 
    List<List<OSDataVO>> list = Lists.partition(dataVOs, no_row_per_page);
    //Creating a Map view of OS list based on the Page No.
    int i = 1;
    for (List<OSDataVO> listForMap : list) {
        mapOfData.put(i, listForMap);
        i++;
    }
    //setting map into session attribute;
    HttpSession session = req.getSession();
    session.setAttribute("OSList", mapOfData);
    return mapOfData;
}
Also used : HashMap(java.util.HashMap) HttpSession(javax.servlet.http.HttpSession) ArrayList(java.util.ArrayList) List(java.util.List) OSDataVO(com.intel.mountwilson.datamodel.OSDataVO)

Aggregations

OSDataVO (com.intel.mountwilson.datamodel.OSDataVO)6 ArrayList (java.util.ArrayList)5 WLMPortalException (com.intel.mountwilson.common.WLMPortalException)4 JSONView (com.intel.mountwilson.util.JSONView)4 ModelAndView (org.springframework.web.servlet.ModelAndView)4 List (java.util.List)3 VmmHostDataVo (com.intel.mountwilson.datamodel.VmmHostDataVo)1 OsData (com.intel.mtwilson.datatypes.OsData)1 HashMap (java.util.HashMap)1 HttpSession (javax.servlet.http.HttpSession)1