Package org.olat.core.util.vfs

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


      Date tmp = new Date(System.currentTimeMillis());
      java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH_mm_ss_SSS");
      forumName += "_"+formatter.format(tmp);
     
      VFSContainer container = new LocalFolderImpl(exportDirectory);
      VFSItem vfsItem = container.resolve(forumName);
     
      if (vfsItem == null || !(vfsItem instanceof VFSContainer)){
        vfsItem = container.createChildContainer(forumName);
      }
      container = (VFSContainer)vfsItem;
View Full Code Here


    tmpLayout.contextPut("myself", this);

    // add delete links for each attachment if user is allowed to see them
    int attNr = 1;
    for (Iterator<VFSItem> iterator = attachments.iterator(); iterator.hasNext();) {
      VFSItem tmpFile = iterator.next();
      FormLink tmpLink = formUIf.addFormLink(CMD_DELETE_ATTACHMENT + attNr, tmpLayout, Link.BUTTON_XSMALL);
      if (!(forumCallback.mayEditMessageAsModerator() || ((userIsMsgCreator) && (msgHasChildren == false)))) {
        tmpLink.setEnabled(false)
        tmpLink.setVisible(false);
      }
View Full Code Here

   *
   * @param fileName
   * @param obj
   */
  private void writeObject(String fileName, Object obj) {
    VFSItem vfsItem = getCourseBaseContainer().resolve(fileName);
    if (vfsItem == null) {
      vfsItem = getCourseBaseContainer().createChildLeaf(fileName);
    }
    XStreamHelper.writeObject((VFSLeaf)vfsItem, obj);
  }
View Full Code Here

   * @param fileName
   * @return de-serialized object
   * @throws OLATRuntimeException if de-serialization fails.
   */
  private Object readObject(String fileName) {
    VFSItem vfsItem = getCourseBaseContainer().resolve(fileName);
    if (vfsItem == null || !(vfsItem instanceof VFSLeaf))
      throw new AssertException("Cannot resolve file: " + fileName + " course=" + this.toString());
    return XStreamHelper.readObject(((VFSLeaf)vfsItem).getInputStream());
  }
View Full Code Here

    ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.LEARNING_RESOURCE_OPEN, getClass());
    translator = new PackageTranslator(PACKAGE, ureq.getLocale());

    vcDisplay = new VelocityContainer("main", VELOCITY_ROOT + "/display.html", translator, this);

    VFSItem item = null;
    item = sharedFolder.resolve(INDEXDOTHTML);
    if (item == null) item = sharedFolder.resolve(INDEXDOTHTM);
    if (item == null) item = sharedFolder.resolve(DEFAULTDOTHTML);
    if (item == null) item = sharedFolder.resolve(DEFAULTDOTHTM);

    if (item == null) {
      sharedFolder.setLocalSecurityCallback(new ReadOnlyCallback());
      controller = new FolderRunController(sharedFolder, true, true, ureq, getWindowControl());
      controller.addControllerListener(this);
    } else {
      controller = new WebsiteDisplayController(ureq, getWindowControl(), sharedFolder, item.getName());
    }
    vcDisplay.put("displayer", controller.getInitialComponent());

    // Add html header with css definitions to this velocity container
    if (previewBackground) {
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);
      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 {
        // 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

   *
   * @param course
   * @return the configuration file or null if file does not exist
   */
  static VFSLeaf getConfigFile(ICourse course) {
    VFSItem item = course.getCourseBaseContainer().resolve(COURSECONFIG_XML);
    if (item == null || !(item instanceof VFSLeaf)) return null;
    return (VFSLeaf)item;
  }
View Full Code Here

   * @return True if is of type.
   */
  public static boolean validate(File unzippedDir) {
    //with VFS FIXME:pb:c: remove casts to LocalFileImpl and LocalFolderImpl if no longer needed.
    VFSContainer vfsUnzippedRoot = new LocalFolderImpl(unzippedDir);
    VFSItem vfsQTI = vfsUnzippedRoot.resolve("qti.xml");
    //getDocument(..) ensures that InputStream is closed in every case.
    Document doc = QTIHelper.getDocument((LocalFileImpl) vfsQTI);
    //if doc is null an error loading the document occured
    if (doc == null) return false;
    List metas = doc.selectNodes("questestinterop/assessment/qtimetadata/qtimetadatafield");
View Full Code Here

    LinkedList<VFSItem> queue = new LinkedList<VFSItem>();
    // enqueue root node
    queue.add(container);
    do {
      // dequeue and exmaine
      VFSItem item = queue.poll();
      if (item instanceof VFSLeaf) {
        if (isToBeAdded((VFSLeaf) item, menuItemTypes)) {
          // node found, return
          return true;
        }
View Full Code Here

      myContent.put("cpContent", cpContentCtr.getInitialComponent());
    }

    // even if we do not show the menu, we need to build parse the manifest and
    // find the first node to display at startup
    VFSItem mani = rootContainer.resolve("imsmanifest.xml");
    if (mani == null || !(mani instanceof VFSLeaf)) { throw new OLATRuntimeException("error.manifest.missing", null, this.getClass()
        .getPackage().getName(), "CP " + rootContainer + " has no imsmanifest", null); }
    // initialize tree model in any case
    ctm = new CPManifestTreeModel((VFSLeaf) mani);
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.