Package org.vosao.entity

Examples of org.vosao.entity.FolderEntity


    return selectOne(q, "getByParentName", params(parentId, name));
  }

  @Override
  public FolderEntity getByPath(String path) {
    FolderEntity result = getByParentName(null, "/");
    for (String name : path.split("/")) {
      if (name.equals("")) {
        continue;
      }
      result = getByParentName(result.getId(), name);
      if (result == null) {
        return null;
      }
    }
    return result;
View Full Code Here


    return result;
  }

  @Override
  public String getFolderPath(Long folderId) {
    FolderEntity folder = getById(folderId);
    List<String> names = new ArrayList<String>();
    while(folder != null) {
      names.add(folder.getName());
      folder = getById(folder.getParent());
    }
    Collections.reverse(names);
    StringBuffer result = new StringBuffer();
    for (String name : names) {
      if (!name.equals("/")) {
View Full Code Here

  }

  @Override
  public List<FolderEntity> getAncestors(FolderEntity folder) {
    List<FolderEntity> result = new ArrayList<FolderEntity>();
    FolderEntity current = folder;
    while (current.getParent() != null) {
      FolderEntity parent = getById(current.getParent());
      if (parent == null) {
        break;
      }
      result.add(parent);
      current = parent;
View Full Code Here

    return null;
  }

  public List<String> validateBeforeUpdate(final FolderEntity folder) {
    List<String> errors = new ArrayList<String>();
    FolderEntity securityFolder = folder;
    if (folder.getId() == null) {
      FolderEntity myFolder = getDao().getFolderDao().getByParentName(
          folder.getParent(), folder.getName());
      if (myFolder != null) {
        errors.add(Messages.get("folder_already_exists"));
      }
      securityFolder = getDao().getFolderDao().getById(folder.getParent());
View Full Code Here

      return root.getEntity();
    }
    String[] chain;
    chain = FolderUtil.getPathChain(path);
    String currentDir = "";
    FolderEntity parent = root.getEntity();
    for (String dir : chain) {
      currentDir += "/" + dir;
      TreeItemDecorator<FolderEntity> folder = findFolderByPath(root,
          currentDir);
      if (folder == null) {
        if (haveWriteAccess(parent)) {
          FolderEntity newFolder = new FolderEntity(dir);
          newFolder.setParent(parent.getId());
          getDao().getFolderDao().save(newFolder);
          parent = newFolder;
        }
        else {
          logger.error("access denied " + path);
View Full Code Here

  }

  @Override
  public void recursiveRemove(List<Long> folderIds) {
    for (Long id : folderIds) {
      FolderEntity folder = getDao().getFolderDao().getById(id);
      if (id != null) {
        recursiveRemove(folder);
      }
    }
   
View Full Code Here

        VosaoContext.getInstance().getUser()).isChangeGranted();
  }

  @Override
  public FolderEntity getById(Long id) {
    FolderEntity folder = getDao().getFolderDao().getById(id);
    if (folder != null && haveReadAccess(folder)) {
      return folder;
    }
    return null;
  }
View Full Code Here

      GroupEntity group = getDao().getGroupDao().getById(Long.valueOf((
        vo.get("groupId"))));
      if (group == null) {
        throw new ServiceException(Messages.get("group_not_found"));
      }
      FolderEntity folder = getDao().getFolderDao().getById(
          Long.valueOf(vo.get("folderId")));
      if (folder == null) {
        throw new ServiceException(Messages.get("folder.not_found",
            vo.get("folderId")));
      }
View Full Code Here

    }
  }

  @Override
  public List<FolderPermissionVO> selectByFolder(Long folderId) {
    FolderEntity folder = getDao().getFolderDao().getById(folderId);
    if (folder == null) {
      return Collections.EMPTY_LIST;
    }
    List<FolderPermissionEntity> inherited = getBusiness()
        .getFolderPermissionBusiness().getInheritedPermissions(folder);
View Full Code Here

    return false;
  }

  @Override
  public FolderPermissionEntity getPermission(Long folderId) {
    FolderEntity folder = getDao().getFolderDao().getById(folderId);
    if (folder != null) {
      return getBusiness().getFolderPermissionBusiness().getPermission(
        folder, VosaoContext.getInstance().getUser());
    }
    return null;
View Full Code Here

TOP

Related Classes of org.vosao.entity.FolderEntity

Copyright © 2018 www.massapicom. 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.