Package org.olat.core.util.vfs

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


    VFSContainer container = new OlatRootFolderImpl(FolderConfig.getUserHomes() + File.separator + ureq.getIdentity().getName() + "/private/archive", null);
    // append export timestamp to avoid overwriting previous export
    Date tmp = new Date(System.currentTimeMillis());
    java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss");
    String folder = "forum_" + forum.getKey().toString()+"_"+formatter.format(tmp);
    VFSItem vfsItem = container.resolve(folder);
    if (vfsItem == null || !(vfsItem instanceof VFSContainer)) {
      vfsItem = container.createChildContainer(folder);
    }
    container = (VFSContainer) vfsItem;
    return container;
View Full Code Here


    } 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

      }
    }
    // Write the feed file. (Items are saved when adding them.)
    feed.sortItems();
    VFSContainer container = getFeedContainer(feed);
    VFSLeaf leaf = (VFSLeaf) container.resolve(FEED_FILE_NAME);
    XStreamHelper.writeObject(xstream, leaf, feed);
    initFeedCache().update(feed.getResourceableId().toString(), feed);
    enrichRepositoryEntryByFeedInformation(feed);
  }
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
View Full Code Here

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

    VFSContainer feedDir = null;

    if (ores != null) {
      VFSContainer resourceDir = getResourceContainer(ores);
      String feedDirName = getFeedKind(ores);
      feedDir = (VFSContainer) resourceDir.resolve(feedDirName);
      if (feedDir == null) {
        // If the folder does not exist create it.
        feedDir = resourceDir.createChildContainer(feedDirName);
      }
    }
View Full Code Here

   */
  public VFSContainer getItemMediaContainer(Item item, Feed feed) {
    VFSContainer itemMediaContainer = null;
    VFSContainer itemContainer = getItemContainer(item, feed);
    if (itemContainer != null) {
      itemMediaContainer = (VFSContainer) itemContainer.resolve(MEDIA_DIR);
    }
   
    return itemMediaContainer;
  }

View Full Code Here

  public File getItemEnclosureFile(Item item, Feed feed) {
    VFSContainer mediaDir = getItemMediaContainer(item, feed);
    Enclosure enclosure = item.getEnclosure();
    File file = null;
    if (mediaDir != null && enclosure != null) {
      VFSLeaf mediaFile = (VFSLeaf) mediaDir.resolve(enclosure.getFileName());
      if (mediaFile != null && mediaFile instanceof LocalFileImpl) {
        file = ((LocalFileImpl) mediaFile).getBasefile();
      }
    }
    return file;
View Full Code Here

   */
  private VFSContainer getItemsContainer(OLATResourceable feed) {
    VFSContainer items = null;
    VFSContainer feedContainer = getFeedContainer(feed);
    // If feed container is null we're in trouble
    items = (VFSContainer) feedContainer.resolve(ITEMS_DIR);
    if (items == null) {
      items = feedContainer.createChildContainer(ITEMS_DIR);
    }
    return items;
  }
View Full Code Here

   */
  public VFSContainer getFeedMediaContainer(OLATResourceable feed) {
    VFSContainer media = null;
    VFSContainer feedContainer = getFeedContainer(feed);
    // If feed container is null we're in trouble
    media = (VFSContainer) feedContainer.resolve(MEDIA_DIR);
    if (media == null) {
      media = feedContainer.createChildContainer(MEDIA_DIR);
    }
    return media;
  }
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.