Package org.olat.core.util.vfs

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


  // this method basically just returns the first element in the cp
  }

  public void testGetPageByItemId() {
    String href = mgr.getPageByItemId(cp, ITEM_ID);
    VFSItem file = cp.getRootDir().resolve(href);
    assertNotNull("The file path doesn't lead to a file.", file);
  }
View Full Code Here


               link = rootFilePath + link;
            } else {
              link = rootFilePath + "/" + link;
            }
          }
          VFSItem item = rootContainer.resolve(link);
          if ( (item != null) && (item instanceof VFSLeaf) ) {
            VFSLeaf subPageLeaf = (VFSLeaf)item;
            if (log.isDebug()) log.debug("subPageLeaf=" + subPageLeaf);
            String filePath = getPathFor(subPageLeaf);
            doIndexVFSLeafByMySelf(courseNodeResourceContext, subPageLeaf, indexWriter, filePath);
View Full Code Here

   */
  public SequencerModel getSequencerModel(String username, CourseEnvironment courseEnv, ScormCourseNode node) {
    VFSContainer scoDirectory = ScormDirectoryHelper.getScoDirectory(username, courseEnv, node);
    if(scoDirectory == null) return null;
   
    VFSItem reloadSettingsFile = scoDirectory.resolve(RELOAD_SETTINGS_FILE);
    if(reloadSettingsFile instanceof LocalFileImpl) {
      LocalFileImpl fileImpl = (LocalFileImpl)reloadSettingsFile;
      return new SequencerModel(fileImpl.getBasefile(), null);
    } else if (reloadSettingsFile != null) {
      throw new OLATRuntimeException(this.getClass(), "Programming error, SCORM results must be file based", null);
View Full Code Here

   * @param exportDirectory
   */
  public void doArchiveElement(DialogElement element, File exportDirectory) {
    VFSContainer forumContainer = getForumContainer(element.getForumKey());
    //there is only one file (leave) in the top forum container
    VFSItem dialogFile = (VFSLeaf)forumContainer.getItems(new VFSLeafFilter()).get(0);
    VFSContainer exportContainer = new LocalFolderImpl(exportDirectory);
   
    // append export timestamp to avoid overwriting previous export
    java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss_SSS");
    String exportDirName = getShortTitle()+"_"+element.getForumKey()+"_"+formatter.format(new Date(System.currentTimeMillis()));
View Full Code Here

  public void updateModuleConfigFromQTIFile(OLATResource res) {
    FileResourceManager frm = FileResourceManager.getInstance();
    File unzippedRoot = frm.unzipFileResource(res);
    //with VFS FIXME:pb:c: remove casts to LocalFileImpl and LocalFolderImpl if no longer needed.
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(unzippedRoot);
    VFSItem vfsQTI = vfsUnzippedRoot.resolve("qti.xml");
    if (vfsQTI==null){
      throw new AssertException("qti file did not exist even it should be guaranteed by repositor check-in "
          + ((LocalFileImpl)vfsQTI).getBasefile().getAbsolutePath());
    }
    //ensures that InputStream is closed in every case.
View Full Code Here

    log.debug("saveAttachedFile file-name=" + uploadedItem.getName());
    OlatRootFolderImpl uploadVFSContainer = new OlatRootFolderImpl(getAttamchmentRelativeRootPath(project,courseEnv,cNode), null);
    log.debug("saveAttachedFile uploadVFSContainer.relPath=" + uploadVFSContainer.getRelPath());
    // only one attachment, delete other file
    for (Iterator<VFSItem> iterator = uploadVFSContainer.getItems().iterator(); iterator.hasNext();) {
      VFSItem item =  iterator.next();
      // Project.getAttachmentFileName is the previous file-name, will not be deleted; student could have open detail-project page with previous attachemnt-link
      if (!item.getName().equals(project.getAttachmentFileName())) {
        item.delete();
      }
    }
    VFSLeaf newFile = (VFSLeaf)uploadVFSContainer.resolve(fileName);
    if (newFile == null) {
      newFile = uploadVFSContainer.createChildLeaf(fileName);
View Full Code Here

   * @param ureq
   * @param command
   */
  private void doFileDelivery(UserRequest ureq, String taskFile) {
    OlatRootFolderImpl forumContainer = new OlatRootFolderImpl(TACourseNode.getTaskFolderPathRelToFolderRoot(courseEnv, node), null);
    VFSItem item = forumContainer.resolve(taskFile);
    if (item instanceof VFSLeaf) {
      VFSLeaf leaf = (VFSLeaf)item;
      ureq.getDispatchResult().setResultingMediaResource(new VFSMediaResource(leaf));
    } else if (item==null) {
      Tracing.logWarn("Can not cast to VFSLeaf. item==null, taskFile=" + taskFile,null, TaskController.class);
    } else {
      Tracing.logWarn("Can not cast to VFSLeaf. item.class.name=" + item.getClass().getName() + ", taskFile="+taskFile,null, TaskController.class);
    }
  }
View Full Code Here

    currentPage = new CPPage(nodeID, cp);

    String filePath = cpMgm.getPageByItemId(cp, currentPage.getIdentifier());
    logInfo("I display the page with id: " + currentPage.getIdentifier(), null);

    VFSItem f = cp.getRootDir().resolve(filePath);
    if (filePath == null) {
      displayInfoPage();

    } else if (f == null) {
      displayNotFoundPage(filePath);
View Full Code Here

    File outFile = new File(dir, filename);
    // trigger the course log exporter - it will store the file to outFile
    log_.info("createLogFile: start exporting course log file "+outFile.getAbsolutePath());
    courseLogExporter.exportCourseLog(outFile, charset, oresID, begin, end, resourceAdminAction, anonymize);
    log_.info("createLogFile: finished exporting course log file "+outFile.getAbsolutePath());
    VFSItem logFile = vfsContainer.resolve(filename);
    if (logFile==null) {
      log_.warn("createLogFile: could not resolve "+filename);
    }
    return logFile;
  }
View Full Code Here

              valid = itemIds.isEmpty(); //empty podcast
            } else {
              int validItemsCount = 0;
              for (String itemId : itemIds) {
                // Try loading each item
                VFSItem itemContainer = itemsContainer.resolve(itemId);
                Item item = FeedManagerImpl.loadItem(itemContainer);
                if (item != null) {
                  // This item is valid, increase the counter
                  validItemsCount++;
                }
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.