Package org.olat.core.util.vfs

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


   * @param searchResourceContext
   * @return Document the index document
   */
  public Document getIndexerDocument(RepositoryEntry repositoryEntry, SearchResourceContext searchResourceContext) {
    GlossaryItemManager gIMgr = GlossaryItemManager.getInstance();
    VFSContainer glossaryFolder = getGlossaryRootFolder(repositoryEntry.getOlatResource());
    VFSLeaf glossaryFile = gIMgr.getGlossaryFile(glossaryFolder);
    if (glossaryFile == null) { return null; }
    String glossaryContent = gIMgr.getGlossaryContent(glossaryFolder);
    // strip all html tags
    Filter htmlTagsFilter = FilterFactory.getHtmlTagsFilter();
View Full Code Here


   */
  public MediaResource getAsMediaResource(OLATResourceable res) {
    RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntry(res, false);
    String exportFileName = repoEntry.getDisplayname() + ".zip";
    File fExportZIP = new File(FolderConfig.getCanonicalTmpDir() + "/" + exportFileName);
    VFSContainer glossaryRoot = getGlossaryRootFolder(res);
    ZipUtil.zip(glossaryRoot.getItems(), new LocalFileImpl(fExportZIP));
    return new CleanupAfterDeliveryFileMediaResource(fExportZIP);
  }
View Full Code Here

   *
   * @return
   */
  public GlossaryResource createGlossary() {
    GlossaryResource resource = new GlossaryResource();
    VFSContainer rootContainer = FileResourceManager.getInstance().getFileResourceRootImpl(resource);
    if (rootContainer == null) return null;
    if (rootContainer.createChildContainer(INTERNAL_FOLDER_NAME) == null) return null;
    OLATResourceManager rm = OLATResourceManager.getInstance();
    OLATResource ores = rm.createOLATResourceInstance(resource);
    rm.saveOLATResource(ores);
    return resource;
  }
View Full Code Here

 
  public String archive(String archivFilePath, RepositoryEntry repoEntry) {
    String exportFileName = "del_glossar_" + repoEntry.getOlatResource().getResourceableId() + ".zip";
    String fullFilePath = archivFilePath + File.separator + exportFileName;
    File fExportZIP = new File(fullFilePath);
    VFSContainer glossaryRoot = getGlossaryRootFolder(repoEntry.getOlatResource());
    ZipUtil.zip(glossaryRoot.getItems(), new LocalFileImpl(fExportZIP));
    return fullFilePath;
  }
View Full Code Here

   * @param unzippedDir
   * @return True if is of type.
   */
  public static boolean validate(File unzippedDir) {
    //with VFS FIXME:pb:c: remove casts to LocalFileImpl and LocalFolderImpl if no longer needed.
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(unzippedDir);
    VFSItem vfsQTI = vfsUnzippedRoot.resolve("qti.xml");
    //getDocument(..) ensures that InputStream is closed in every case.
    Document doc = QTIHelper.getDocument((LocalFileImpl) vfsQTI);
    //if doc is null an error loading the document occured
    if (doc == null) return false;
    List metas = doc.selectNodes("questestinterop/assessment/qtimetadata/qtimetadatafield");
View Full Code Here

   */
  protected String addNewHTMLPage() {
    String newId = CPManager.getInstance().addBlankPage(cp, translate("cptreecontroller.newpage.title"), currentPage.getIdentifier());
    CPPage newPage = new CPPage(newId, cp);
    // Create an html file
    VFSContainer root = cp.getRootDir();
    VFSLeaf htmlFile = root.createChildLeaf(newId + ".html");
    newPage.setFile(htmlFile);
    updatePage(newPage);
    return newId;
  }
View Full Code Here

  /**
   * Upload the selected files and import them into the content package.
   */
  private void uploadFiles() {
    VFSContainer root = cp.getRootDir();
    String filenName = file.getUploadFileName();
    // don't check on mimetypes - some browser use different mime types when sending files (OLAT-4547)
    if (filenName.toLowerCase().endsWith(".zip")) {
      // unzip and add files
      VFSLeaf archive = new LocalFileImpl(file.getUploadFile());
      String archiveName = file.getUploadFileName();
      String unzipDirName = archiveName.substring(0, archiveName.toLowerCase().indexOf(".zip"));
      unzipDirName = VFSManager.similarButNonExistingName(root, unzipDirName);
      VFSContainer unzipDir = root.createChildContainer(unzipDirName);
      ZipUtil.unzip(archive, unzipDir);
      // add items of unzipDir to tree
      pageToBeSelected = addItem(unzipDir, currentPage.getIdentifier(), true);
      CPManager.getInstance().writeToFile(cp);

View Full Code Here

      cpMgr.updatePage(cp, newPage);
    }

    // Add any sub items
    if (item instanceof VFSContainer && containsItemsToAdd((VFSContainer) item, menuItemTypes)) {
      VFSContainer dir = (VFSContainer) item;
      addSubItems(dir, newPage.getIdentifier());
    }
    return newPage;
  }
View Full Code Here

          // node found, return
          return true;
        }
      } else {
        // enqueue successors
        VFSContainer parent = (VFSContainer) item;
        queue.addAll(parent.getItems());
      }
    } while (!queue.isEmpty());
    return false;
  }
View Full Code Here

    baseFile.mkdirs();
    return messageContainer;
  }

  private void deleteMessageContainer(Long forumKey, Long messageKey) {
    VFSContainer mContainer = getMessageContainer(forumKey, messageKey);
    mContainer.delete();
  }
View Full Code Here

TOP

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

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.