Package org.olat.core.util.vfs

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


                //set author fallback
                item.setAuthor(author);
                //update item.xml
                VFSContainer itemContainer = getItemContainer(item, feed);
                if(itemContainer != null) {
                  VFSLeaf itemFile = (VFSLeaf)itemContainer.resolve(ITEM_FILE_NAME);
                  XStreamHelper.writeObject(xstream, itemFile, item);
                }
              }
            }
          }
View Full Code Here


  @Override
  public void deleteImage(Feed feed) {
    VFSContainer mediaContainer = getFeedMediaContainer(feed);
    String imageName = feed.getImageName();
    if (imageName != null) {
      VFSLeaf image = (VFSLeaf) mediaContainer.resolve(imageName);
      if (image != null) {
        image.delete();
        feed.setImageName(null);
      }
    }
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

   
    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

    VFSContainer rootContainer = SPCourseNode.getNodeFolderContainer((SPCourseNode) courseNode, course.getCourseEnvironment());
    String chosenFile = (String) courseNode.getModuleConfiguration().get(SPEditController.CONFIG_KEY_FILE);
    // First: Index choosen HTML file
    if (log.isDebug()) log.debug("Index chosen file in SP. chosenFile=" + chosenFile);
     VFSLeaf leaf = (VFSLeaf)rootContainer.resolve(chosenFile);
    if (leaf != null) {
      String filePath = getPathFor(leaf);
      if (log.isDebug()) log.debug("Found chosen file in SP. filePath=" + filePath );
      doIndexVFSLeafByMySelf(courseNodeResourceContext, leaf, indexWriter, filePath);
      if (!indexOnlyChosenFile) {
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

  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

    String sDisclaimer = (String)modConfig.get(IQEditController.CONFIG_KEY_DISCLAIMER);
    if (sDisclaimer != null) {
      VFSContainer baseContainer = userCourseEnv.getCourseEnvironment().getCourseFolderContainer();
      int lastSlash = sDisclaimer.lastIndexOf('/');
      if (lastSlash != -1) {
        baseContainer = (VFSContainer)baseContainer.resolve(sDisclaimer.substring(0, lastSlash));
        sDisclaimer = sDisclaimer.substring(lastSlash);
        // first check if disclaimer exists on filesystem
        if (baseContainer == null || baseContainer.resolve(sDisclaimer) == null) {
          showWarning("disclaimer.file.invalid", sDisclaimer);
        } else {
View Full Code Here

      int lastSlash = sDisclaimer.lastIndexOf('/');
      if (lastSlash != -1) {
        baseContainer = (VFSContainer)baseContainer.resolve(sDisclaimer.substring(0, lastSlash));
        sDisclaimer = sDisclaimer.substring(lastSlash);
        // first check if disclaimer exists on filesystem
        if (baseContainer == null || baseContainer.resolve(sDisclaimer) == null) {
          showWarning("disclaimer.file.invalid", sDisclaimer);
        } else {
          //screenreader do not like iframes, display inline
          if (getWindowControl().getWindowBackOffice().getWindowManager().isForScreenReader()) {
            HtmlStaticPageComponent disclaimerComp = new HtmlStaticPageComponent("disc", baseContainer);
View Full Code Here

    // resource. We know that the resource folder is valid.

    // Let's now copy the resource folder to the root folder.
    VFSContainer rootContainer = new LocalFolderImpl(root);
    String folderName = FeedManager.getInstance().getFeedKind(this);
    if (rootContainer.resolve(folderName) == null) {
      // If the podcast directory doesn't exist yet, create it and copy content
      // from uploaded folder
      rootContainer = rootContainer.createChildContainer(folderName);
      VFSContainer resourceContainer = new LocalFolderImpl(resourceFolder);
      for (VFSItem item : resourceContainer.getItems()) {
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.