Пример #1
0
  /**
   * Delete document or folder.
   *
   * @throws IOException I/O exception
   */
  protected void del() throws IOException {
    final Session session = http.session();
    session.execute(new Open(db));
    session.execute(new Delete(path));

    // create dummy, if parent is an empty folder
    final int ix = path.lastIndexOf(SEP);
    if (ix > 0) createDummy(path.substring(0, ix));
  }
Пример #2
0
  /**
   * Rename document or folder.
   *
   * @param n new name
   * @throws IOException I/O exception
   */
  protected void rename(final String n) throws IOException {
    final Session session = http.session();
    session.execute(new Open(db));
    session.execute(new Rename(path, n));

    // create dummy, if old parent is an empty folder
    final int i1 = path.lastIndexOf(SEP);
    if (i1 > 0) createDummy(path.substring(0, i1));

    // delete dummy, if new parent is an empty folder
    final int i2 = n.lastIndexOf(SEP);
    if (i2 > 0) deleteDummy(n.substring(0, i2));
  }