Examples of DbTpl


Examples of com.jeecms.core.entity.DbTpl

        + " and bean.directory=? order by bean.id";
    return find(hql, path, notLike, isDirectory);
  }

  public DbTpl findById(String id) {
    DbTpl entity = get(id);
    return entity;
  }
View Full Code Here

Examples of com.jeecms.core.entity.DbTpl

    getSession().save(bean);
    return bean;
  }

  public DbTpl deleteById(String id) {
    DbTpl entity = super.get(id);
    if (entity != null) {
      getSession().delete(entity);
    }
    return entity;
  }
View Full Code Here

Examples of com.jeecms.core.entity.DbTpl

    }
  }

  private void createParentDir(String name) {
    String[] dirs = DbTpl.getParentDir(name);
    DbTpl dirTpl;
    Tpl parentDir;
    for (String dir : dirs) {
      parentDir = get(dir);
      if (parentDir != null && !parentDir.isDirectory()) {
        throw new ParentDirIsFileExceptioin(
            "parent directory is a file: " + parentDir.getName());
      } else if (parentDir == null) {
        dirTpl = new DbTpl();
        dirTpl.setId(dir);
        dirTpl.setDirectory(true);
        dao.save(dirTpl);
      }
    }
  }
View Full Code Here

Examples of com.jeecms.core.entity.DbTpl

      }
    }
  }

  public void update(String name, String source) {
    DbTpl entity = (DbTpl) get(name);
    entity.setSource(source);
    entity.setLastModified(System.currentTimeMillis());
  }
View Full Code Here

Examples of com.jeecms.core.entity.DbTpl

    entity.setLastModified(System.currentTimeMillis());
  }

  public int delete(String[] names) {
    int count = 0;
    DbTpl tpl;
    for (String name : names) {
      tpl = dao.deleteById(name);
      count++;
      if (tpl.isDirectory()) {
        count += deleteByDir(tpl.getName());
      }
    }
    return names.length;
  }
View Full Code Here

Examples of com.jeecms.core.entity.DbTpl

    dirs.addAll(files);
    return dirs;
  }

  public void rename(String orig, String dist) {
    DbTpl tpl = dao.deleteById(orig);
    if (tpl == null) {
      return;
    }
    dao.deleteById(orig);
    String name = StringUtils.replace(tpl.getId(), orig, dist, 1);
    save(name, tpl.getSource(), tpl.isDirectory());
    createParentDir(name);
    if (tpl.isDirectory()) {
      List<DbTpl> list = dao.getStartWith(orig + "/");
      for (DbTpl t : list) {
        dao.deleteById(t.getId());
        name = StringUtils.replace(t.getId(), orig, dist, 1);
        save(name, t.getSource(), t.isDirectory());
View Full Code Here

Examples of com.jeecms.core.entity.DbTpl

    // do nothing.
  }

  @Transactional(readOnly = true)
  public Tpl get(String name) {
    DbTpl entity = dao.findById(name);
    return entity;
  }
View Full Code Here

Examples of com.jeecms.core.entity.DbTpl

    DbTpl entity = dao.findById(name);
    return entity;
  }

  public void save(String name, String source, boolean isDirectory) {
    DbTpl bean = new DbTpl();
    bean.setId(name);
    if (!isDirectory && source == null) {
      source = "";
    }
    bean.setSource(source);
    bean.setLastModified(System.currentTimeMillis());
    bean.setDirectory(isDirectory);
    dao.save(bean);
    createParentDir(name);
  }
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.