示例#1
0
文件: Edit.java 项目: joncv/bespin
  /**
   * Returns a copy of the list of edits for a given file
   *
   * @param path
   * @return
   */
  private List<JSONObject> getEdits(String path) throws IOException {
    // first get the file handle
    java.io.File file = getFilesystem().getFileHandle(getUser(), path);

    // get the edit session
    EditSession editSession = getSessionTracker().getSession(file, getUser());

    if (editSession != null) {
      return editSession.getEdits();
    } else {
      return new ArrayList<JSONObject>();
    }
  }
示例#2
0
文件: Edit.java 项目: joncv/bespin
  private void addEdits(String path, JSONObject... edits) throws IOException {
    // first get the file handle
    java.io.File file = getFilesystem().getFileHandle(getUser(), path);

    // get the edit session
    EditSession editSession = getSessionTracker().getSession(file, getUser());
    if (editSession == null) {
      getCtx().getResp().sendError(400, "No edit session open for file");
      return;
    }

    editSession.addEdits(edits);
  }