Package org.json

Examples of org.json.JSONObject.optBoolean()


        final JSONObject article = get(articleId);
        if (null == article) {
            return false;
        }

        return article.optBoolean(Article.ARTICLE_IS_PUBLISHED);
    }

    @Override
    public List<JSONObject> getRandomly(final int fetchSize) throws RepositoryException {
        final List<JSONObject> ret = new ArrayList<JSONObject>();
View Full Code Here


        final JSONRenderer renderer = new JSONRenderer();
        context.setRenderer(renderer);
        renderer.setJSONObject(jsonObject);

        if (!jsonObject.optBoolean(Keys.STATUS_CODE)) {
            LOGGER.log(Level.WARNING, "Can't add comment[msg={0}]", jsonObject.optString(Keys.MSG));
            return;
        }

        final String captcha = requestJSONObject.optString(CaptchaProcessor.CAPTCHA);
View Full Code Here

        final JSONRenderer renderer = new JSONRenderer();
        context.setRenderer(renderer);
        renderer.setJSONObject(jsonObject);

        if (!jsonObject.optBoolean(Keys.STATUS_CODE)) {
            LOGGER.log(Level.WARNING, "Can't add comment[msg={0}]", jsonObject.optString(Keys.MSG));
            return;
        }

        final String captcha = requestJSONObject.optString(CaptchaProcessor.CAPTCHA);
View Full Code Here

                   new Object[]{event.getType(), data,
                                ArticleSender.class.getName()});
        try {
            final JSONObject originalArticle =
                    data.getJSONObject(Article.ARTICLE);
            if (!originalArticle.optBoolean(Common.POST_TO_COMMUNITY)
                || !originalArticle.getBoolean(Article.ARTICLE_IS_PUBLISHED)) {
                LOGGER.log(Level.FINER,
                           "Ignores post article[title={0}] to Rhythm",
                           originalArticle.getString(Article.ARTICLE_TITLE));
View Full Code Here

        final JSONObject preference = preferenceUtils.getPreference();
        if (null == preference) {
            throw new EventException("Not found preference");
        }

        final boolean enabled = preference.optBoolean(
                Preference.ENABLE_POST_TO_TENCENT_MICROBLOG);
        if (!enabled) {
            return;
        }
View Full Code Here

    boolean sendDenialEmail = false;
    JSONObject denialEmail = submissionDoc
      .getJSONObject("nunaliit_submission")
      .optJSONObject("denial_email");
    if( null != denialEmail ){
      boolean requested = denialEmail.optBoolean("requested",false);
      boolean sent = denialEmail.optBoolean("sent",false);
     
      if( requested && !sent ){
        sendDenialEmail = true;
      }
View Full Code Here

    JSONObject denialEmail = submissionDoc
      .getJSONObject("nunaliit_submission")
      .optJSONObject("denial_email");
    if( null != denialEmail ){
      boolean requested = denialEmail.optBoolean("requested",false);
      boolean sent = denialEmail.optBoolean("sent",false);
     
      if( requested && !sent ){
        sendDenialEmail = true;
      }
    }
View Full Code Here

    logger.debug("IN");
    JSONArray staticClosedFilters = template.optJSONArray(QbeJSONTemplateParser.STATIC_CLOSED_FILTERS);
    if (staticClosedFilters != null && staticClosedFilters.length() > 0) {
      for (int i = 0; i < staticClosedFilters.length(); i++) {
        JSONObject aStaticClosedFilter = (JSONObject) staticClosedFilters.get(i);
        boolean isSingleSelection = aStaticClosedFilter.optBoolean(QbeJSONTemplateParser.STATIC_CLOSED_FILTER_SINGLE_SELECTION);
        String filterGroupId = aStaticClosedFilter.getString(QbeJSONTemplateParser.ID);
        if (isSingleSelection) {
          String optionId = formViewerState.getXORFilterSelectedOption(filterGroupId);
          if (optionId != null && !optionId.trim().equals("") && !optionId.equalsIgnoreCase(QbeJSONTemplateParser.STATIC_CLOSED_FILTER_NO_SELECTION)) {
            JSONObject option = null;
View Full Code Here

        String name = cookie.optString("name");
        String value = cookie.optString("value");
        String domain = cookie.optString("domain");
        String path = cookie.optString("path");
        Date expiry = new Date(cookie.optLong("expires"));
        boolean isSecure = cookie.optBoolean("secure");
        Cookie c = new Cookie(name, value, domain, path, expiry, isSecure);
        res.add(c);
      }
      return res;
    } else {
View Full Code Here

    // validate branch metadata
    JSONObject branch = branchesArray.getJSONObject(0);
    assertEquals(Constants.MASTER, branch.getString(ProtocolConstants.KEY_NAME));
    assertBranchUri(branch.getString(ProtocolConstants.KEY_LOCATION));
    assertTrue(branch.optBoolean(GitConstants.KEY_BRANCH_CURRENT, false));
    branch = branchesArray.getJSONObject(1);
    assertEquals("z", branch.getString(ProtocolConstants.KEY_NAME));
    // assert properly sorted, current branch is first, then other branches sorted by timestamp
    long lastTime = Long.MAX_VALUE;
    for (int i = 1; i < branchesArray.length(); i++) {
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.