Package org.olat.core.commons.modules.bc.vfs

Examples of org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl.resolve()


          if (getTempFolderFileList().contains(fileName)) {
            fileExists = true;
          }
          if (message.getKey() != null) {
            OlatRootFolderImpl msgContainer = fm.getMessageContainer(message.getForum().getKey(), message.getKey());
            if (msgContainer.resolve(fileName) != null) {
              fileExists = true;
            }
          }

          if (fileExists) {
View Full Code Here


   * @return
   */
  public OlatRootFolderImpl getGlossaryRootFolder(OLATResourceable res) {
    OlatRootFolderImpl resRoot = FileResourceManager.getInstance().getFileResourceRootImpl(res);
    if (resRoot == null) return null;
    VFSItem glossaryRoot = resRoot.resolve(INTERNAL_FOLDER_NAME);
    if (glossaryRoot == null) {
      // Glossary has been imported but not yet renamed to the internal folder.
      // This is ugly but no other way to do since the add resource callback
      // somehow does not provide this hook?
      VFSItem unzipped = resRoot.resolve(FileResourceManager.ZIPDIR);
View Full Code Here

    VFSItem glossaryRoot = resRoot.resolve(INTERNAL_FOLDER_NAME);
    if (glossaryRoot == null) {
      // Glossary has been imported but not yet renamed to the internal folder.
      // This is ugly but no other way to do since the add resource callback
      // somehow does not provide this hook?
      VFSItem unzipped = resRoot.resolve(FileResourceManager.ZIPDIR);
      if (unzipped == null) {
        // Should not happen, but since we have no unzipped folder we better
        // continue with an empty glossary than crashing
        resRoot.createChildContainer(INTERNAL_FOLDER_NAME);
      } else {
View Full Code Here

      } else {
        // We do not use the unzipped folder anymore, this was only for import.
        // We rename it to the internal glossary folder and use it from now on
        unzipped.rename(INTERNAL_FOLDER_NAME);
      }
      glossaryRoot = resRoot.resolve(INTERNAL_FOLDER_NAME);
    }
    return (OlatRootFolderImpl) glossaryRoot;
  }
 
  /**
 
View Full Code Here

    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

   *
   *
   */
  public void archiveWikiToCP() {
    LocalFolderImpl tempFolder =  new OlatRootFolderImpl("/tmp/"+ident.getKey()+"-"+ores.getResourceableId(), null);
    if (tempFolder.resolve("imsmanifest.xml") != null) {
      tempFolder.delete(); //delete all content if already exists...
      tempFolder =  new OlatRootFolderImpl("/tmp/"+ident.getKey()+"-"+ores.getResourceableId(), null);
    }
    Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
    String dateStamp = Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
View Full Code Here

    // very old fancy code
    // Mapper is cleaned up automatically by basic controller
    String baseUrl = registerMapper(new Mapper() {
      public MediaResource handle(String relPath, HttpServletRequest request) {
        OlatRootFolderImpl rootFolder = new OlatRootFolderImpl(ProjectBrokerManagerFactory.getProjectBrokerManager().getAttamchmentRelativeRootPath(project,courseEnv,cNode),null);
        VFSLeaf vfsfile = (VFSLeaf) rootFolder.resolve(relPath);
        if (vfsfile == null) {
          return new NotFoundMediaResource(relPath);
        } else {
          return new VFSMediaResource(vfsfile);
        }
View Full Code Here

      // 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);
    }
    BufferedInputStream in = new BufferedInputStream(uploadedItem.getInputStream());
    BufferedOutputStream out = new BufferedOutputStream(newFile.getOutputStream(false));
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);
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.