Package org.olat.core.util.vfs

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


      return null;
    }   
   
    List<String> lockedFiles = new ArrayList<String>();
    for (String sItem:selection.getFiles()) {
      VFSItem vfsItem = currentContainer.resolve(sItem);
      if (vfsItem instanceof VFSLeaf) {
        boolean isAdmin = ureq.getUserSession().getRoles().isOLATAdmin();
        lockedFiles.addAll(checkLockedFiles((VFSLeaf)vfsItem, currentContainer, ureq.getIdentity(), isAdmin));
      }
    }
View Full Code Here


      return null;
    }
   
    boolean fileNotExist = false;
    for (String sItem:selection.getFiles()) {
      VFSItem vfsItem = currentContainer.resolve(sItem);
      if (vfsItem != null && (vfsItem instanceof VFSLeaf)) {
        if (!doUnzip((VFSLeaf)vfsItem, currentContainer, ureq, wContr)) {
          status = FolderCommandStatus.STATUS_FAILED;
          break;
        }
View Full Code Here

       
        if (metaInfoCtr.isFileRenamed()) {
          // IMPORTANT: First rename the meta data because underlying file
          // has to exist in order to work properly on it's meta data.
          VFSContainer container = currentItem.getParentContainer();
          if(container.resolve(fileName) != null) {
            getWindowControl().setError(translator.translate("TargetNameAlreadyUsed"));
            status = FolderCommandStatus.STATUS_FAILED;
          } else {
            if (meta != null) {
              meta.rename(fileName);
View Full Code Here

          getWindowControl().setError(translator.translate("failed"));
          status = FolderCommandStatus.STATUS_FAILED;
          fireEvent(ureq, FOLDERCOMMAND_FINISHED);
        }
        for (String file : files) {
          VFSItem item = currentContainer.resolve(file);
          if (item != null && (item.canDelete() == VFSConstants.YES)) {
            if (item instanceof OlatRelPathImpl) {
              // delete all meta info
              MetaInfo meta = MetaInfoFactory.createMetaInfoFor((OlatRelPathImpl)item);
              if (meta != null) meta.deleteAll();
View Full Code Here

  }
   
  protected void doIndex(SearchResourceContext resourceContext, OlatFullIndexer indexWriter, File cpRoot)
  throws IOException,InterruptedException  {
    VFSContainer container = new LocalFolderImpl(cpRoot);
    VFSLeaf fManifest = (VFSLeaf)container.resolve("imsmanifest.xml");
    if(fManifest != null) {
      Element rootElement =  IMSLoader.loadIMSDocument(fManifest).getRootElement();
      Document manfiestDoc = createManifestDocument(fManifest, rootElement, resourceContext);
      indexWriter.addDocument(manfiestDoc);
     
View Full Code Here

          WikiPage page = Wiki.assignPropertiesToPage(propertiesFile);
          if (page == null) {
            // broken pages get automatically cleaned from filesystem
            String contentFileToBeDeleted = (propertiesFile.getName().substring(0,
                propertiesFile.getName().length() - WikiManager.WIKI_PROPERTIES_SUFFIX.length()) + WikiManager.WIKI_FILE_SUFFIX);
            folder.resolve(contentFileToBeDeleted).delete();
            propertiesFile.delete();
            continue;
          }
          // index and menu page are loaded by default
          if (page.getPageName().equals(WikiPage.WIKI_INDEX_PAGE) || page.getPageName().equals(WikiPage.WIKI_MENU_PAGE)) {
View Full Code Here

            propertiesFile.delete();
            continue;
          }
          // index and menu page are loaded by default
          if (page.getPageName().equals(WikiPage.WIKI_INDEX_PAGE) || page.getPageName().equals(WikiPage.WIKI_MENU_PAGE)) {
            VFSLeaf leaf = (VFSLeaf) folder.resolve(page.getPageId() + "." + WikiManager.WIKI_FILE_SUFFIX);
            page.setContent(FileUtils.load(leaf.getInputStream(), "utf-8"));
          }

          // due to a bug we have to rename some pages that start with an non
          // ASCII lowercase letter
View Full Code Here

          String idOutOfFileName = propertiesFile.getName().substring(0, propertiesFile.getName().indexOf("."));
          if (!page.getPageId().equals(idOutOfFileName)) {
            // rename corrupt prop file
            propertiesFile.rename(page.getPageId() + "." + WikiManager.WIKI_PROPERTIES_SUFFIX);
            // load content and delete corrupt content file
            VFSLeaf contentFile = (VFSLeaf) folder.resolve(idOutOfFileName + "." + WikiManager.WIKI_FILE_SUFFIX);
            contentFile.rename(page.getPageId() + "." + WikiManager.WIKI_FILE_SUFFIX);
          }

          wiki.addPage(page);
        }
View Full Code Here

    //cluster_OK by guido
    VFSContainer versionsContainer = getWikiContainer(ores, VERSION_FOLDER_NAME);
    VFSContainer wikiContentContainer = getWikiContainer(ores, WIKI_RESOURCE_FOLDER_NAME);
    // rename existing content file to version x and copy it to the version
    // container
    VFSItem item = wikiContentContainer.resolve(page.getPageId() + "." + WIKI_FILE_SUFFIX);
    if (item != null && incrementVersion) {
      if (page.getVersion() > 0) {
        versionsContainer.copyFrom(item);
        VFSItem copiedItem = versionsContainer.resolve(page.getPageId() + "." + WIKI_FILE_SUFFIX);
        String fileName = page.getPageId() + "." + WIKI_FILE_SUFFIX + "-" + page.getVersion();
View Full Code Here

      }
      item.delete();
    }
    // rename existing meta file to version x and copy it to the version
    // container
    item = wikiContentContainer.resolve(page.getPageId() + "." + WIKI_PROPERTIES_SUFFIX);
    if (item != null && incrementVersion) {
      // TODO renaming and coping does not work. Bug?? felix fragen
      if (page.getVersion() > 0) {
        versionsContainer.copyFrom(item);
        VFSItem copiedItem = versionsContainer.resolve(page.getPageId() + "." + WIKI_PROPERTIES_SUFFIX);
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.