@SuppressWarnings("unchecked") @RequestMapping( value = "/admin/options/paging.html", method = RequestMethod.POST, produces = "application/json") public @ResponseBody String pageOptions( HttpServletRequest request, HttpServletResponse response) { String optionName = request.getParameter("name"); AjaxResponse resp = new AjaxResponse(); try { Language language = (Language) request.getAttribute("LANGUAGE"); MerchantStore store = (MerchantStore) request.getAttribute("MERCHANT_STORE"); List<ProductOption> options = null; if (!StringUtils.isBlank(optionName)) { options = productOptionService.getByName(store, optionName, language); } else { options = productOptionService.listByStore(store, language); } for (ProductOption option : options) { @SuppressWarnings("rawtypes") Map entry = new HashMap(); entry.put("optionId", option.getId()); ProductOptionDescription description = option.getDescriptions().iterator().next(); entry.put("name", description.getName()); entry.put("type", option.getProductOptionType()); // TODO resolve with option type label resp.addDataEntry(entry); } resp.setStatus(AjaxResponse.RESPONSE_STATUS_SUCCESS); } catch (Exception e) { LOGGER.error("Error while paging options", e); resp.setStatus(AjaxResponse.RESPONSE_STATUS_FAIURE); } String returnString = resp.toJSONString(); return returnString; }