Package org.olat.core.util.vfs

Examples of org.olat.core.util.vfs.VFSItem


      st = new StringTokenizer(subDirPath, "\\", false);
    }
    VFSContainer currentPath = base;
    while (st.hasMoreTokens()) {
      String nextSubpath = st.nextToken();
      VFSItem vfsSubpath = currentPath.resolve(nextSubpath);
      if (vfsSubpath == null && !create) {
        return null;
      }
      if (vfsSubpath == null || (vfsSubpath instanceof VFSLeaf)) {
        vfsSubpath = currentPath.createChildContainer(nextSubpath);
View Full Code Here


    if (target.exists()) return false;
    List<VFSItem> vfsFiles = new ArrayList<VFSItem>();
    LocalFolderImpl vfsRoot = new LocalFolderImpl(root);
    for (Iterator<String> iter = files.iterator(); iter.hasNext();) {
      String fileName = iter.next();
      VFSItem item = vfsRoot.resolve(fileName);
      if (item == null) return false;
      vfsFiles.add(item);
    }
    return zip(vfsFiles, new LocalFileImpl(target));
  } // zip
View Full Code Here

  public CustomCSS(final VFSContainer cssBaseContainer,
      final String relCssFilename, UserSession uSess) {
    cssUriMapper = new Mapper() {
      public MediaResource handle(String relPath,
          HttpServletRequest request) {
        VFSItem vfsItem = cssBaseContainer.resolve(relPath);
        MediaResource mr;
        if (vfsItem == null || !(vfsItem instanceof VFSLeaf))
          mr = new NotFoundMediaResource(relPath);
        else
          mr = new VFSMediaResource((VFSLeaf) vfsItem);
View Full Code Here

        return c.compare(((VFSItem)o1).getName(), ((VFSItem)o2).getName());
      }});

    boolean addedAtLeastOneChild = false;
    for (Iterator iter = children.iterator(); iter.hasNext();) {
      VFSItem child = (VFSItem) iter.next();
      String childName = child.getName();
      if (child instanceof VFSContainer) {
        // container node
        String filePath = parentPath + childName + "/";
        GenericTreeNode tChild = new GenericTreeNode(childName, filePath); // filePath is the information to be remembered later
        tChild.setIconCssClass("b_filetype_folder");
        tChild.setAltText(child.getName());
        tChild.setAccessible(selectableFolders ? (child.canWrite() == VFSConstants.YES) : false);
        tParent.addChild(tChild);
        boolean addedChildren = buildTree(tChild, (VFSContainer)child, filePath);
        if (foldersOnly || addedChildren) {
          addedAtLeastOneChild = true;
        } else {
View Full Code Here

    VFSContainer currentContainer = fc.getCurrentContainer();
    boolean canWrite = currentContainer.canWrite() == VFSConstants.YES;
    boolean canDelete = false;
    boolean canVersion = FolderConfig.versionsEnabled(fc.getCurrentContainer());
    for (Iterator<VFSItem> iter = fc.getCurrentContainerChildren().iterator(); iter.hasNext();) {
      VFSItem child = iter.next();
      if (child.canDelete() == VFSConstants.YES) {
        canDelete = true;
        break;
      }
    }
   
View Full Code Here

    // file uploads are relative to the currently edited file
    String[] dirs = this.fileName.split("/");
    VFSContainer fileUploadBase = rootDir;
    for (String subPath : dirs) {
      // try to resolve the given file path in the root container
      VFSItem subFolder = fileUploadBase.resolve(subPath);
      if (subFolder != null) {
        if (subFolder instanceof VFSContainer) {
          // a higher level found, use this one unless a better one is found
          fileUploadBase = (VFSContainer) subFolder;
        } else {
View Full Code Here

  public boolean setCurrentContainerPath(String relPath) {
    // get the container
    setDirty(true);
    if (relPath == null) relPath = "/";
    if (!(relPath.charAt(0) == '/')) relPath = "/" + relPath;
    VFSItem vfsItem = rootContainer.resolve(relPath);
    if (vfsItem == null || !(vfsItem instanceof VFSContainer)) {
      // unknown path, reset to root contaner...
      currentContainer = rootContainer;
      relPath = "";
      return false;
View Full Code Here

   */
  public static List<String> hasLockedFiles(VFSContainer container, FileSelection selection, UserRequest ureq) {
    List<String> lockedFiles = new ArrayList<String>();

    for (String file : selection.getFiles()) {
      VFSItem item = container.resolve(file);
      if (isLocked(item, ureq)) {
        lockedFiles.add(file);
      }
    }
    return lockedFiles;
View Full Code Here

    bgFlag = true;
    sb.append("<tbody>");
   
    Map<Long,Identity> identityMap = new HashMap<Long,Identity>();
    for (int i = 0; i < children.size(); i++) {
      VFSItem child = children.get(i);
      appendRenderedFile(fc, child, currentContainerPath, sb, ubu, translator, iframePostEnabled, canVersion, identityMap, i);
    }   
    sb.append("</tbody></table>");
    return sb.toString();
  } // getRenderedDirectoryContent
View Full Code Here

   * @return the object bound to name
   * @exception NamingException if a naming exception is encountered
   */
  public Object lookup(String name) throws NamingException {
   
    VFSItem item = resolveFile(name);
    if (item == null) throw new NamingException(smgr.getString("resources.notFound", name));

    if (item instanceof VFSContainer) {
      VFSDirContext tempContext = new VFSDirContext(env);
      tempContext.setVirtualDocBase(item);
View Full Code Here

TOP

Related Classes of org.olat.core.util.vfs.VFSItem

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.