Package org.json

Examples of org.json.JSONObject.optBoolean()


    /* gitapi/stash/<stashRev>/file/(...) */
    String stashRev = requestInfo.gitSegment;

    boolean applyIndex = requestPayload.optBoolean(GitConstants.KEY_STASH_APPLY_INDEX, true);
    boolean applyUntracked = requestPayload.optBoolean(GitConstants.KEY_STASH_APPLY_UNTRACKED, true);

    try {

      Git git = new Git(db);

View Full Code Here


  private boolean handlePost(HttpServletRequest request, HttpServletResponse response, String pathString) throws IOException, JSONException,
      ServletException, URISyntaxException, CoreException, NoHeadException, NoMessageException, ConcurrentRefUpdateException,
      WrongRepositoryStateException {
    // make sure required fields are set
    JSONObject toAdd = OrionServlet.readJSONRequest(request);
    if (toAdd.optBoolean(GitConstants.KEY_PULL, false)) {
      GitUtils.createGitCredentialsProvider(toAdd);
      GitCredentialsProvider cp = GitUtils.createGitCredentialsProvider(toAdd);
      boolean force = toAdd.optBoolean(GitConstants.KEY_FORCE, false);
      return pull(request, response, cp, pathString, force);
    }
View Full Code Here

    // make sure required fields are set
    JSONObject toAdd = OrionServlet.readJSONRequest(request);
    if (toAdd.optBoolean(GitConstants.KEY_PULL, false)) {
      GitUtils.createGitCredentialsProvider(toAdd);
      GitCredentialsProvider cp = GitUtils.createGitCredentialsProvider(toAdd);
      boolean force = toAdd.optBoolean(GitConstants.KEY_FORCE, false);
      return pull(request, response, cp, pathString, force);
    }

    Clone clone = new Clone();
    String url = toAdd.optString(GitConstants.KEY_URL, null);
View Full Code Here

        // make sure required fields are set
        JSONObject toCheckout = OrionServlet.readJSONRequest(request);
        JSONArray paths = toCheckout.optJSONArray(ProtocolConstants.KEY_PATH);
        String branch = toCheckout.optString(GitConstants.KEY_BRANCH_NAME, null);
        String tag = toCheckout.optString(GitConstants.KEY_TAG_NAME, null);
        boolean removeUntracked = toCheckout.optBoolean(GitConstants.KEY_REMOVE_UNTRACKED, false);
        if ((paths == null || paths.length() == 0) && branch == null && tag == null) {
          String msg = NLS.bind("Either '{0}' or '{1}' or '{2}' should be provided, got: {3}", new Object[] { ProtocolConstants.KEY_PATH,
              GitConstants.KEY_BRANCH_NAME, GitConstants.KEY_TAG_NAME, toCheckout });
          return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST, msg, null));
        }
View Full Code Here

    request = new GetMethodWebRequest(location);
    setAuthentication(request);
    response = webConversation.getResource(request);
    assertEquals("1.2", HttpURLConnection.HTTP_OK, response.getResponseCode());
    JSONObject result = new JSONObject(response.getText());
    assertTrue("1.3", result.optBoolean(key));
  }

  @Test
  public void testGetSingle() throws IOException, JSONException {
    List<String> locations = getTestPreferenceNodes();
View Full Code Here

      Script script = new Script();
      JSONArray stepsA = scriptO.getJSONArray("steps");
      for (int i = 0; i < stepsA.length(); i++) {
        JSONObject stepO = stepsA.getJSONObject(i);
        Script.Step step = new Script.Step(getStepTypeOfName(stepO.getString("type")));
        step.negated = stepO.optBoolean("negated", false);
        script.steps.add(step);
        JSONArray keysA = stepO.names();
        for (int j = 0; j < keysA.length(); j++) {
          String key = keysA.getString(j);
          if (key.equals("type") || key.equals("negated")) { continue; }
View Full Code Here

            /* loop over packages for fileIncludes */
            for (int i = 0; i < len; i++) {
                /* Build pkg and include file deps */
                JSONObject pkg = pkgs.getJSONObject(i)
                /* if we don't include dependencies, it must be fileIncludes */
                if (!pkg.optBoolean("includeDeps", false)) {
                    String targFileName = pkg.getString("file");
                   
                    String ext = fileHelper.getExtention(targFileName);         
                    if (".js".equals(ext) || (".css".equals(ext) && yuiCompressCss)) {
                        targFileName = fileHelper.insertFileSuffix(targFileName, debugSuffix);
View Full Code Here

            int len = pkgs.length();
            for (int i = 0; i < len; i++) {
                /* Build pkg and include file deps */
                JSONObject pkg = pkgs.getJSONObject(i)
                /* if we need to includeDeps, they should already be built. */
                if (pkg.optBoolean("includeDeps", false)) {
                    String targFileName = pkg.getString("file");
                   
                    String ext = fileHelper.getExtention(targFileName);         
                    if (".js".equals(ext) || (".css".equals(ext) && yuiCompressCss)) {
                      targFileName = fileHelper.insertFileSuffix(targFileName, debugSuffix);
View Full Code Here

                // filter
            boolean passFilter = true;
          for (String s : filterList)
            if (s!=null && name!=null && name.startsWith(s))
               { passFilter = false; break; }
            if (passFilter && (!removeTempPkg || pkg.optBoolean("keep", true)))
                continue;
               
                // build names and files                 
                String ext = fileHelper.getExtention(name);         
                if (".js".equals(ext) || (".css".equals(ext) && yuiCompressCss)) {
View Full Code Here

                }
            }
            return _data;
        } else if (data instanceof JSONObject) {
            JSONObject _data = (JSONObject)data;
            if (_data.optBoolean(KEY_PLACEHOLDER)) {
                int num = _data.optInt(KEY_NUM, -1);
                return num >= 0 && num < buffers.length ? buffers[num] : null;
            }
            Iterator<?> iterator = _data.keys();
            while (iterator.hasNext()) {
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.