Package org.olat.core.util.vfs

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


    } else if (feed.isInternal()) {
      // Load from virtual file system
      VFSContainer itemsContainer = getItemsContainer(feed);

      for (String itemId : feed.getItemIds()) {
        VFSItem itemContainer = itemsContainer.resolve(itemId);
        Item item = loadItem(itemContainer);
        if (item != null) {
          items.add(item);
        }
      }
View Full Code Here


        entry.setDisplayname(feed.getTitle());
        entry.setDescription(feed.getDescription());
        // Update the image
        VFSContainer repoHome = new LocalFolderImpl(new File(FolderConfig.getCanonicalRoot() + FolderConfig.getRepositoryHome()));
        String imageFilename = RepositoryEntryImageController.getImageFilename(entry);
        VFSItem oldEntryImage = repoHome.resolve(imageFilename);
        if (oldEntryImage != null) {
          // Delete the old File
          oldEntryImage.delete();
        }
        // Copy the feed image to the repository home folder unless it was
        // deleted.
        String feedImage = feed.getImageName();
        if (feedImage != null) {
          VFSItem newImage = getFeedMediaContainer(feed).resolve(feedImage);
          repoHome.copyFrom(newImage);
          VFSItem newEntryImage = repoHome.resolve(feed.getImageName());
          newEntryImage.rename(imageFilename);
        }
      }
    }
  }
View Full Code Here

  @Override
  public MediaResource createItemMediaFile(OLATResourceable feed, String itemId, String fileName) {
    VFSMediaResource mediaResource = null;
    // Brute force method for fast delivery
    try {
      VFSItem item = getItemsContainer(feed);
      item = item.resolve(itemId);
      item = item.resolve(MEDIA_DIR);
      item = item.resolve(fileName);
      mediaResource = new VFSMediaResource((VFSLeaf) item);
    } catch (NullPointerException e) {
      log.debug("Media resource could not be created from file: ", fileName);
    }
    return mediaResource;
View Full Code Here

  @Override
  public MediaResource createFeedMediaFile(OLATResourceable feed, String fileName) {
    VFSMediaResource mediaResource = null;
    // Brute force method for fast delivery
    try {
      VFSItem item = getFeedMediaContainer(feed);
      item = item.resolve(fileName);
      mediaResource = new VFSMediaResource((VFSLeaf) item);
    } catch (NullPointerException e) {
      log.debug("Media resource could not be created from file: ", fileName);
    }
    return mediaResource;
View Full Code Here

    // o_clusterOK by:fg
    VFSLeaf zip = CoordinatorManager.getCoordinator().getSyncer().doInSync(resource, new SyncerCallback<VFSLeaf>() {
      public VFSLeaf execute() {
        // Delete the old archive and recreate it from scratch
        String zipFileName = getZipFileName(resource);
        VFSItem oldArchive = rootContainer.resolve(zipFileName);
        if (oldArchive != null) {
          oldArchive.delete();
        }
        ZipUtil.zip(feedContainer.getItems(), rootContainer.createChildLeaf(zipFileName));
        return (VFSLeaf) rootContainer.resolve(zipFileName);
      }
    });
View Full Code Here

    assertNotNull("CourseConfiguration is not null", cc1);
    /*
     * delete configuration
     */
    ccm.deleteConfigOf(course1);
    VFSItem cc1File = CourseConfigManagerImpl.getConfigFile(course1);
    assertFalse("CourseConfig file no longer exists.", cc1File != null);
  }
View Full Code Here

  public void setDocumentMediaBase(final VFSContainer documentBaseContainer, String relFilePath, UserSession usess) {
    linkBrowserRelativeFilePath = relFilePath;
    // get a usersession-local mapper for the file storage (and tinymce's references to images and such)
    contentMapper = new Mapper() {
      public MediaResource handle(String relPath, HttpServletRequest request) {
        VFSItem vfsItem = documentBaseContainer.resolve(relPath);
        MediaResource mr;
        if (vfsItem == null || !(vfsItem instanceof VFSLeaf)) mr = new NotFoundMediaResource(relPath);
        else mr = new VFSMediaResource((VFSLeaf) vfsItem);
        return mr;
      }
View Full Code Here

      listenTo(spController);
      putInitialPanel(spController.getInitialComponent());
    } else {
      // Render a download link for file
      VFSContainer courseFolder = userCourseEnv.getCourseEnvironment().getCourseFolderContainer();
      VFSItem downloadItem = courseFolder.resolve(file);
      if (file != null && downloadItem instanceof VFSLeaf) {
        DownloadComponent downloadComp = new DownloadComponent("downloadComp"(VFSLeaf) downloadItem);
        VelocityContainer peekviewVC = createVelocityContainer("peekview");
        peekviewVC.put("downloadComp", downloadComp);
        putInitialPanel(peekviewVC);
View Full Code Here

    sb.append(" \\par}");
    // attachment(s)
    OlatRootFolderImpl msgContainer = fm.getMessageContainer((Long)(getMetainfo(ForumFormatter.MANDATORY_METAINFO_KEY)), mn.getKey());
    List attachments = msgContainer.getItems();
    if (attachments != null && attachments.size() > 0){
      VFSItem item = container.resolve("attachments");
      if (item == null){
        item = container.createChildContainer("attachments");
      }
      VFSContainer attachmentContainer = (VFSContainer)item;
      attachmentContainer.copyFrom(msgContainer);
     
      sb.append("{\\pard \\f0\\fs15 Attachment(s): ");
      boolean commaFlag = false;
      for (Iterator iter = attachments.iterator(); iter.hasNext();) {
        VFSItem attachment = (VFSItem) iter.next();
        if (commaFlag) sb.append(", ");
        sb.append(attachment.getName());
        commaFlag = true;
      }
      sb.append("} \\line");
    }
    sb.append("{\\pard \\brdrb\\brdrs\\brdrw10 \\par}");
View Full Code Here

   
    VFSContainer scormRoot = ScormDirectoryHelper.getScormRootFolder();
    List<Identity> users = ScoreAccountingHelper.loadUsers(courseEnv);
    for (Identity identity : users) {
      String username = identity.getName();
      VFSItem userFolder = scormRoot.resolve(username);
      if(userFolder instanceof VFSContainer) {
        VFSItem scosFolder = ((VFSContainer)userFolder).resolve(scoDirectoryName);
        if(scosFolder instanceof VFSContainer) {
          collectData(username, (VFSContainer)scosFolder, visitor);
        }
      }
    }
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.