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;
}
Aggregations