Package org.olat.core.util.vfs

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


      if (DialogBoxUIFactory.isYesEvent(event)) { // ok to really delete this
                                                  // attachment
        DialogBoxController dbCtr = (DialogBoxController) source;
        Object userObj = dbCtr.getUserObject();
        if (userObj instanceof VFSLeaf) {
          VFSLeaf file = (VFSLeaf) userObj;
          file.delete();
          showInfo("delete.att.ok");
          createOrUpdateAttachmentListLayout(this.flc);
        }
      }
    }
View Full Code Here


    if (tmpMessage == null) throw new AssertException("Message may not be null to persist temp files");
    OlatRootFolderImpl msgContainer = fm.getMessageContainer(message.getForum().getKey(), message.getKey());
    if (msgContainer != null) {
      List<VFSItem> tmpFList = getTempFolderFileList();
      for (VFSItem file : tmpFList) {
        VFSLeaf leaf = (VFSLeaf) file;
        FileUtils.copy(leaf.getInputStream(), msgContainer.createChildLeaf(leaf.getName()).getOutputStream(false));
      }
    }
    removeTempUploadedFiles();
  }
View Full Code Here

   * @throws IOException
   * @throws InterruptedException
   */
  private void doIndexFile(String filename, Long forumKey, SearchResourceContext leafResourceContext, OlatFullIndexer indexWriter) throws IOException,InterruptedException {
    OlatRootFolderImpl forumContainer = DialogElementsController.getForumContainer(forumKey);
    VFSLeaf leaf = (VFSLeaf) forumContainer.getItems(new VFSLeafFilter()).get(0);
    if (log.isDebug()) log.debug("Analyse VFSLeaf=" + leaf.getName());
    try {
      if (FileDocumentFactory.getInstance().isFileSupported(leaf)) {
        leafResourceContext.setFilePath(filename);
        leafResourceContext.setDocumentType(TYPE_FILE);
        Document document = FileDocumentFactory.createDocument(leafResourceContext, leaf);
        indexWriter.addDocument(document);
      } else {
        if (log.isDebug()) log.debug("Documenttype not supported. file=" + leaf.getName());
      }
    } catch (DocumentAccessException e) {
      if (log.isDebug()) log.debug("Can not access document." + e.getMessage());
    } catch (DocumentNotImplementedException e) {
      if (log.isDebug()) log.debug("Documenttype not implemented.");
    } catch (DocumentException dex) {
      if (log.isDebug()) log.debug("DocumentException: Can not index leaf=" + leaf.getName());
    } catch (IOException ioEx) {
      log.warn("IOException: Can not index leaf=" + leaf.getName(), ioEx);
    } catch (InterruptedException iex) {
      throw new InterruptedException(iex.getMessage());
    } catch (Exception ex) {
      log.warn("Exception: Can not index leaf=" + leaf.getName(), ex);
    }
  }
View Full Code Here

    OLATResourceable ores = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repoRef, true).getOlatResource();
   
    VFSContainer container = WikiManager.getInstance().getWikiContainer(ores, WikiManager.WIKI_RESOURCE_FOLDER_NAME);
    if(container!=null) { //the container could be null if the wiki is an old empty one - so nothing to archive
      VFSContainer parent = container.getParentContainer();
      VFSLeaf wikiZip = WikiToZipUtils.getWikiAsZip(parent);
      destination.copyFrom(wikiZip);
    }
  }
View Full Code Here

      } else if (event.getCommand().equals(FolderEvent.UPLOAD_EVENT)) {
        String filename = null;
        try {
          // get size of file
          OlatRootFolderImpl forumContainer = getForumContainer(recentDialogElement.getForumKey());
          VFSLeaf vl = (VFSLeaf) forumContainer.getItems().get(0);
          String fileSize = StringHelper.formatMemory(vl.getSize());

          // new dialog element
          filename = ((FolderEvent) event).getFilename();
          DialogElement element = new DialogElement();
          element.setAuthor(recentDialogElement.getAuthor());
View Full Code Here

   * @param ureq
   * @param command
   */
  private void doFileDelivery(UserRequest ureq, Long forumKey) {
    OlatRootFolderImpl forumContainer = getForumContainer(forumKey);
    VFSLeaf vl = (VFSLeaf) forumContainer.getItems(new VFSLeafFilter()).get(0);
   
    //ureq.getDispatchResult().setResultingMediaResource(new FileDialogMediaResource(vl));
    ureq.getDispatchResult().setResultingMediaResource(new VFSMediaResource(vl));
  }
View Full Code Here

    return forumContainer;
  }
 
  public static String getFileSize(Long forumKey){
    OlatRootFolderImpl forumContainer = getForumContainer(forumKey);
    VFSLeaf vl = (VFSLeaf) forumContainer.getItems().get(0);
    return StringHelper.formatMemory(vl.getSize());
  }
View Full Code Here

   * @return Document the index document
   */
  public Document getIndexerDocument(RepositoryEntry repositoryEntry, SearchResourceContext searchResourceContext) {
    GlossaryItemManager gIMgr = GlossaryItemManager.getInstance();
    VFSContainer glossaryFolder = getGlossaryRootFolder(repositoryEntry.getOlatResource());
    VFSLeaf glossaryFile = gIMgr.getGlossaryFile(glossaryFolder);
    if (glossaryFile == null) { return null; }
    String glossaryContent = gIMgr.getGlossaryContent(glossaryFolder);
    // strip all html tags
    Filter htmlTagsFilter = FilterFactory.getHtmlTagsFilter();
    glossaryContent = htmlTagsFilter.filter(glossaryContent);
   
    // create standard olat index document with this data
    OlatDocument glossaryDocument = new OlatDocument();
    if (repositoryEntry.getInitialAuthor() != null) {
      glossaryDocument.setAuthor(repositoryEntry.getInitialAuthor());
    }
    if (repositoryEntry.getDisplayname() != null) {
      glossaryDocument.setTitle(repositoryEntry.getDisplayname());
    }
    if (repositoryEntry.getDescription() != null) {
      glossaryDocument.setDescription(htmlTagsFilter.filter(repositoryEntry.getDescription()));
    }
    glossaryDocument.setContent(glossaryContent);
    glossaryDocument.setCreatedDate(repositoryEntry.getCreationDate());
    glossaryDocument.setLastChange(new Date(glossaryFile.getLastModified()));
    glossaryDocument.setResourceUrl(searchResourceContext.getResourceUrl());
    glossaryDocument.setDocumentType(searchResourceContext.getDocumentType());
    glossaryDocument.setCssIcon("o_FileResource-GLOSSARY_icon");
    return glossaryDocument.getLuceneDocument()
  }
View Full Code Here

  /**
   * @see org.olat.course.config.CourseConfigManager#deleteConfigOf(org.olat.course.ICourse)
   */
  public boolean deleteConfigOf(ICourse course) {
    VFSLeaf configFile = getConfigFile(course);
    if (configFile != null) { return configFile.delete() == VFSConstants.YES; }
    return false;
  }
View Full Code Here

  /**
   * @see org.olat.course.config.CourseConfigManager#loadConfigFor(org.olat.course.ICourse)
   */
  public CourseConfig loadConfigFor(ICourse course) {
    CourseConfig retVal = null;
    VFSLeaf configFile = getConfigFile(course);
    if (configFile == null) {
      //config file does not exist! create one, init the defaults, save it.
      retVal = new CourseConfig();
      retVal.initDefaults();
      saveConfigTo(course, retVal);
    } else {
      //file exists, load it with XStream, resolve version
      Object tmp = XStreamHelper.readObject(configFile.getInputStream());
      if (tmp instanceof CourseConfig) {
        retVal = (CourseConfig) tmp;
        if (retVal.resolveVersionIssues()){
          configFile = null;
          saveConfigTo(course, retVal);
View Full Code Here

TOP

Related Classes of org.olat.core.util.vfs.VFSLeaf

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.