Package org.json

Examples of org.json.JSONObject.optInt()


        state = userJson.optString("state");
        city = userJson.optString("city");
        aboutMe = userJson.optString("aboutMe");
        memberSince = FitbitApiService.getValidLocalDateOrNull(userJson.optString("memberSince"));
        timezone = DateTimeZone.forID(userJson.getString("timezone"));
        offsetFromUTCMillis = userJson.optInt("offsetFromUTCMillis");
        locale = userJson.optString("locale");
        avatar = userJson.optString("avatar");

        weightUnit = userJson.optString("weightUnit");
        distanceUnit = userJson.optString("distanceUnit");
View Full Code Here


            String[] groupByArray = new String[columns.length()];
            for (int i=0; i<columns.length(); ++i)
              groupByArray[i] = columns.getString(i);
            req.setGroupBy(groupByArray);
          }
          req.setMaxPerGroup(groupBy.optInt("top", groupBy.optInt("count", 1)));
        }

      // distinct
      JSONObject distinct = json.optJSONObject("distinct");
      if (distinct != null)
View Full Code Here

            String[] groupByArray = new String[columns.length()];
            for (int i=0; i<columns.length(); ++i)
              groupByArray[i] = columns.getString(i);
            req.setGroupBy(groupByArray);
          }
          req.setMaxPerGroup(groupBy.optInt("top", groupBy.optInt("count", 1)));
        }

      // distinct
      JSONObject distinct = json.optJSONObject("distinct");
      if (distinct != null)
View Full Code Here

        while (keyIter.hasNext()){
          String field = keyIter.next();
          JSONObject facetObj = facets.getJSONObject(field);
          if (facetObj!=null){
           FacetSpec facetSpec = new FacetSpec();
           facetSpec.setMaxCount(facetObj.optInt(RequestConverter2.FACETS_MAX, 10));
           facetSpec.setMinHitCount(facetObj.optInt(RequestConverter2.FACETS_MINCOUNT, 1));
           facetSpec.setExpandSelection(facetObj.optBoolean(RequestConverter2.FACETS_EXPAND, false));

           String orderBy = facetObj.optString(RequestConverter2.FACETS_ORDER, RequestConverter2.FACETS_ORDER_HITS);
           FacetSpec.FacetSortSpec facetOrder = FacetSpec.FacetSortSpec.OrderHitsDesc;
View Full Code Here

          String field = keyIter.next();
          JSONObject facetObj = facets.getJSONObject(field);
          if (facetObj!=null){
           FacetSpec facetSpec = new FacetSpec();
           facetSpec.setMaxCount(facetObj.optInt(RequestConverter2.FACETS_MAX, 10));
           facetSpec.setMinHitCount(facetObj.optInt(RequestConverter2.FACETS_MINCOUNT, 1));
           facetSpec.setExpandSelection(facetObj.optBoolean(RequestConverter2.FACETS_EXPAND, false));

           String orderBy = facetObj.optString(RequestConverter2.FACETS_ORDER, RequestConverter2.FACETS_ORDER_HITS);
           FacetSpec.FacetSortSpec facetOrder = FacetSpec.FacetSortSpec.OrderHitsDesc;
           if (RequestConverter2.FACETS_ORDER_VAL.equals(orderBy)){
View Full Code Here

            boolean strict = jsonParams.optBoolean(RequestConverter2.SELECTIONS_PATH_STRICT, false);
            sel.getSelectionProperties().setProperty(PathFacetHandler.SEL_PROP_NAME_STRICT, String.valueOf(strict));
          }

          if(jsonParams.has(RequestConverter2.SELECTIONS_PATH_DEPTH)){
            int depth = jsonParams.optInt(RequestConverter2.SELECTIONS_PATH_DEPTH, 1);
            sel.getSelectionProperties().setProperty(PathFacetHandler.SEL_PROP_NAME_DEPTH, String.valueOf(depth));
          }

          req.addSelection(sel);
        }
View Full Code Here

    this.attDescription = attDescription;
  }
 
  public int getOrientationLevel() throws Exception {
    JSONObject serverWorkObj = getJson();
    int orientationLevel = serverWorkObj.optInt(UploadConstants.SERVER_ORIENTATION_KEY, 0);
    return orientationLevel;
  }
 
  public void setOrientationLevel(int level) throws Exception {
    JSONObject serverWorkObj = getJson();
View Full Code Here

    serverWorkObj.put(UploadConstants.SERVER_ORIENTATION_KEY, UploadConstants.SERVER_ORIENTATION_VALUE);
  }
 
  public int getThumbnailLevel() throws Exception {
    JSONObject serverWorkObj = getJson();
    int thumbnailLevel = serverWorkObj.optInt(UploadConstants.SERVER_THUMBNAIL_KEY, 0);
    return thumbnailLevel;
  }
 
  public void setThumbnailLevel(int level) throws Exception {
    JSONObject serverWorkObj = getJson();
View Full Code Here

      try {
        SenseiRequest senseiRequest = RequestConverter2.fromJSON(request, facetInfo);
        SenseiResult senseiResult = browse(senseiRequest);
        JSONObject jsonResult = DefaultSenseiJSONServlet.buildJSONResult(senseiRequest, senseiResult);
        if (jsonResult != null) {
          numHits = jsonResult.optInt(PARAM_RESULT_NUMHITS);
          totalDocs = jsonResult.optInt(PARAM_RESULT_TOTALDOCS);
        }
        return jsonResult;
      }
      finally {
View Full Code Here

        SenseiRequest senseiRequest = RequestConverter2.fromJSON(request, facetInfo);
        SenseiResult senseiResult = browse(senseiRequest);
        JSONObject jsonResult = DefaultSenseiJSONServlet.buildJSONResult(senseiRequest, senseiResult);
        if (jsonResult != null) {
          numHits = jsonResult.optInt(PARAM_RESULT_NUMHITS);
          totalDocs = jsonResult.optInt(PARAM_RESULT_TOTALDOCS);
        }
        return jsonResult;
      }
      finally {
        if (queryLogger.isDebugEnabled() && request != null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.