Package org.olat.core.util.vfs

Examples of org.olat.core.util.vfs.VFSContainer.resolve()


              }
              name = name.substring(dirSepIndex + 1);
            }
           
            if(versioning) {
              VFSLeaf newEntry = (VFSLeaf)createIn.resolve(name);
              if(newEntry == null) {
                newEntry = createIn.createChildLeaf(name);
                OutputStream out = newEntry.getOutputStream(false);
                if (!FileUtils.copy(oZip, out)) return false;
                FileUtils.closeSafely(out);
View Full Code Here


                continue;
              }
              name = name.substring(dirSepIndex + 1);
            }
           
            VFSLeaf newEntry = (VFSLeaf)createIn.resolve(name);
            if(MetaInfoHelper.isLocked(newEntry, identity, isAdmin)) {
              lockedFiles.add(name);
            }
          }
        }
View Full Code Here

      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

    // 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

        if (relFilePath.endsWith(".html") || relFilePath.endsWith(".htm")) {
          editorCtr = WysiwygFactory.createWysiwygController(ureq, getWindowControl(), writableRootContainer, relFilePath, true);       
          ((HTMLEditorController)editorCtr).setNewFile(true);
        }
        else {
          editorCtr = new PlainTextEditorController(ureq, getWindowControl(), (VFSLeaf)writableRootContainer.resolve(relFilePath), "utf-8", true, true, null);
        }

        this.listenTo(editorCtr);
       
        mainPanel.setContent(editorCtr.getInitialComponent());
View Full Code Here

   * @return
   */
  public static final int sanityCheck3(WindowControl wControl, FolderComponent fc, FileSelection selection) {
    VFSContainer container = fc.getCurrentContainer();
    for(String filename : selection.getFiles()) {
      if(container.resolve(filename) == null) {
        wControl.setError(fc.getTranslator().translate("FileDoesNotExist"));
        return FolderCommandStatus.STATUS_FAILED;
      }
    }
    return FolderCommandStatus.STATUS_SUCCESS; 
View Full Code Here

          isInputValid = false;
          return isInputValid;
        }
        //ok, folder name is sanitized, let's see if a folder with this name already exists
        VFSContainer currentContainer = folderComponent.getCurrentContainer();       
        VFSItem item = currentContainer.resolve(name);
        if (item != null) {
          textElement.setErrorKey("cf.exists", new String[] {name});
          isInputValid = false;
        } else {
          isInputValid = true;
View Full Code Here

          abortFailed(ureq, "failed");
          return;
        }
        VFSStatus vfsStatus = VFSConstants.SUCCESS;
        VFSContainer rootContainer = folderComponent.getRootContainer();
        VFSItem vfsItem = rootContainer.resolve(selectedPath);
        if (vfsItem == null || (vfsItem.canWrite() != VFSConstants.YES)) {
          abortFailed(ureq, "failed");
          return;
        }
        // copy the files
View Full Code Here

            // copy the metainfo first
            MetaInfo meta = MetaInfoFactory.createMetaInfoFor((OlatRelPathImpl)vfsSource);
            meta.moveCopyToDir((OlatRelPathImpl)target, move);
          }
         
          VFSItem targetFile = target.resolve(vfsSource.getName());
          if(vfsSource instanceof VFSLeaf && targetFile != null && targetFile instanceof Versionable
              && ((Versionable)targetFile).getVersions().isVersioned()) {
            //add a new version to the file
            ((Versionable)targetFile).getVersions().addVersion(null, "", ((VFSLeaf)vfsSource).getInputStream());
          } else {
View Full Code Here

          //add html extension if missing
          fileName = fileName + ".html";
        }
        //ok, file name is sanitized, let's see if a file with this name already exists
        VFSContainer currentContainer = folderComponent.getCurrentContainer();
        VFSItem item = currentContainer.resolve(fileName);
        if (item != null) {
          textElement.setErrorKey("cfile.already.exists", new String[] {fileName});
          isInputValid = false;
        } else {
          isInputValid = true;         
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.