Examples of toJson()


Examples of org.eclipse.orion.server.git.objects.Branch.toJSON()

        result.put(ProtocolConstants.KEY_NEXT_LOCATION, next);
      }
      for (int i = firstBranch; i <= lastBranch; i++) {
        Branch branch = branches.get(i);
        if (commitsSize == 0) {
          children.put(branch.toJSON());
        } else {
          String branchName = branch.getName(true, false);
          ObjectId toObjectId = db.resolve(branchName);
          Ref toRefId = db.getRef(branchName);
          if (toObjectId == null) {
View Full Code Here

Examples of org.eclipse.orion.server.git.objects.Clone.toJSON()

      clone.setId(GitUtils.pathFromProject(workspace, project).toString());
      clone.setContentLocation(project.getProjectStore().toURI());
    }
    clone.setName(cloneName);
    clone.setBaseLocation(getURI(request));
    JSONObject cloneObject = clone.toJSON();
    String cloneLocation = cloneObject.getString(ProtocolConstants.KEY_LOCATION);

    String gitUserName = toAdd.optString(GitConstants.KEY_NAME, null);
    String gitUserMail = toAdd.optString(GitConstants.KEY_MAIL, null);
    Boolean initProject = toAdd.optBoolean(GitConstants.KEY_INIT_PROJECT, false);
View Full Code Here

Examples of org.eclipse.orion.server.git.objects.Commit.toJSON()

        // "git commit [--amend] -m '{message}' [-a|{path}]"
        RevCommit lastCommit = cc.setAmend(amend).setMessage(message).call();

        URI cloneLocation = BaseToCloneConverter.getCloneLocation(getURI(request), BaseToCloneConverter.COMMIT_REFRANGE);
        Commit commit = new Commit(cloneLocation, db, lastCommit, pattern);
        JSONObject result = commit.toJSON();
        OrionServlet.writeJSONResponse(request, response, result, JsonURIUnqualificationStrategy.ALL_NO_GIT);
        return true;
      } catch (GitAPIException e) {
        return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_BAD_REQUEST,
            "An error occured when commiting.", e));
View Full Code Here

Examples of org.eclipse.orion.server.git.objects.ConfigOption.toJSON()

      Repository db = null;
      try {
        db = FileRepositoryBuilder.create(gitDir);
        URI cloneLocation = BaseToCloneConverter.getCloneLocation(baseLocation, BaseToCloneConverter.CONFIG);
        ConfigOption configOption = new ConfigOption(cloneLocation, db);
        OrionServlet.writeJSONResponse(request, response, configOption.toJSON(/* all */), JsonURIUnqualificationStrategy.ALL_NO_GIT);
        return true;
      } finally {
        if (db != null) {
          db.close();
        }
View Full Code Here

Examples of org.eclipse.orion.server.git.objects.Log.toJSON()

              lc.add(toObjectId);
              lc.setMaxCount(this.commitsSize);
              Iterable<RevCommit> commits = lc.call();
              Log log = new Log(cloneLocation, db, commits, null, null, toRefId);
              log.setPaging(1, commitsSize);
              branch.put(GitConstants.KEY_TAG_COMMIT, log.toJSON());
              newChildren.put(branch);
            }
          }

          result.put(ProtocolConstants.KEY_CHILDREN, newChildren);
View Full Code Here

Examples of org.eclipse.orion.server.git.objects.Remote.toJSON()

      Git git = new Git(db);
      Set<String> configNames = db.getConfig().getSubsections(ConfigConstants.CONFIG_REMOTE_SECTION);
      for (String configN : configNames) {
        if (configN.equals(configName)) {
          Remote remote = new Remote(cloneLocation, db, configN);
          JSONObject result = remote.toJSON();
          if (!result.has(ProtocolConstants.KEY_CHILDREN)) {
            return new ServerStatus(Status.OK_STATUS, HttpServletResponse.SC_OK, result);
          }
          JSONArray children = result.getJSONArray(ProtocolConstants.KEY_CHILDREN);
          JSONArray filteredChildren = new JSONArray();
View Full Code Here

Examples of org.eclipse.orion.server.git.objects.RemoteBranch.toJSON()

      try {
        db = FileRepositoryBuilder.create(gitDir);
        Remote remote = new Remote(cloneLocation, db, p.segment(0));
        RemoteBranch remoteBranch = new RemoteBranch(cloneLocation, db, remote, GitUtils.decode(p.segment(1)));
        if (remoteBranch.exists()) {
          JSONObject result = remoteBranch.toJSON();
          OrionServlet.writeJSONResponse(request, response, result, JsonURIUnqualificationStrategy.ALL_NO_GIT);
          return true;
        }
      } finally {
        if (db != null) {
View Full Code Here

Examples of org.eclipse.orion.server.git.objects.StashPage.toJSON()

      Git git = new Git(db);
      StashListCommand stashList = git.stashList();
      Collection<RevCommit> stashedRefsCollection = stashList.call();

      StashPage stashPage = new StashPage(cloneLocation, db, stashedRefsCollection, page, pageSize, messageFilter);
      OrionServlet.writeJSONResponse(request, response, stashPage.toJSON());
      return true;

    } catch (Exception ex) {
      String msg = "An error occured for stash command.";
      return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, msg, ex));
View Full Code Here

Examples of org.eclipse.orion.server.git.objects.Status.toJSON()

      URI baseLocation = getURI(request);
      String relativePath = GitUtils.getRelativePath(path, set.iterator().next().getKey());
      IPath basePath = new Path(relativePath);
      Status status = new Status(baseLocation, db, gitStatus, basePath);
      OrionServlet.writeJSONResponse(request, response, status.toJSON(), JsonURIUnqualificationStrategy.ALL_NO_GIT);
      return true;

    } catch (Exception e) {
      return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
          "Error generating status response", e));
View Full Code Here

Examples of org.eclipse.orion.server.git.objects.Tag.toJSON()

        URI cloneLocation = BaseToCloneConverter.getCloneLocation(getURI(request), BaseToCloneConverter.TAG);

        Ref ref = db.getRefDatabase().getRef(Constants.R_TAGS + tagName);
        if (ref != null) {
          Tag tag = new Tag(cloneLocation, db, ref);
          OrionServlet.writeJSONResponse(request, response, tag.toJSON(), JsonURIUnqualificationStrategy.ALL_NO_GIT);
          return true;
        } else {
          String msg = NLS.bind("Tag not found: {0}", tagName);
          return statusHandler.handleRequest(request, response, new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_FOUND, msg, 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.