List<Goods> goodsList = null;
try {
switch (showGoodsType) {
case Commands.SHOW_GOODS_BY_CATEGORY :
GoodsDao goodsDao = new GoodsDao();
int categoryUid = Integer.parseInt(request.getParameter(Commands.SHOW_GOODS_CATEGOTY));
goodsList = goodsDao.findEntitiesByCategory(categoryUid);
break;
case Commands.SHOW_GOODS_BY_DEPARTMENT :
GoodsDao goodsDepDao = new GoodsDao();
int departmentUid = Integer.parseInt(request.getParameter(Commands.SHOW_GOODS_DEPARTMENT));
goodsList = goodsDepDao.findEntitiesByDepartment(departmentUid);
break;
default:
AbstractDao<Goods> abstrGoodsDao = new GoodsDao();
goodsList = abstrGoodsDao.findAll();
break;
}
} catch (DaoException e) {
log.error("Was not able to get goods data", e);
}