Collection unGroupedLincense = ServiceFactory.getLicenseService().getLicenseWithoutGroupBuyedBy(u, false);
Map code2ProdList = new HashMap();
for (Iterator iter = unGroupedLincense.iterator(); iter.hasNext();) {
License license = (License) iter.next();
if (ServiceFactory.getLicenseService().isGroupable(license)) {
ProductList prodList = null;
if (license.getOwner()!=null) {
// The license is in use by a user
prodList = new ProductList(license.getProductCode());
prodList.setOwner(license.getOwner().getLogin());
code2ProdList.put(license.getProductCode() + license.getOwner().getId(), prodList);
} else {
String code = license.getProductCode();
prodList = (ProductList) code2ProdList.get(code);
if (prodList == null) {
prodList = new ProductList(code);
code2ProdList.put(code, prodList);
}
}
prodList.addLicense(license);
prodList.increaseProductCount();
}
}
request.getSession().setAttribute(Params.USER_GROUP.SHOW.SESSION.PROD_LIST, code2ProdList);
}