@Override JSONStreamAware processRequest(HttpServletRequest req) { String[] assets = req.getParameterValues("assets"); boolean includeCounts = !"false".equalsIgnoreCase(req.getParameter("includeCounts")); JSONObject response = new JSONObject(); JSONArray assetsJSONArray = new JSONArray(); response.put("assets", assetsJSONArray); for (String assetIdString : assets) { if (assetIdString == null || assetIdString.equals("")) { continue; } try { Asset asset = Asset.getAsset(Convert.parseUnsignedLong(assetIdString)); if (asset == null) { return UNKNOWN_ASSET; } assetsJSONArray.add(JSONData.asset(asset, includeCounts)); } catch (RuntimeException e) { return INCORRECT_ASSET; } } return response; }
@Override protected void save(Connection con, Asset asset) throws SQLException { asset.save(con); }