예제 #1
0
파일: GetAssets.java 프로젝트: fitcoin/fimk
  @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;
  }
예제 #2
0
 @Override
 protected void save(Connection con, Asset asset) throws SQLException {
   asset.save(con);
 }