Examples of VFSContainer


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

  @Override
  public boolean delete(VFSItem item, boolean force) {
    if (item instanceof VFSContainer) {
      if (force) {
        VFSContainer container = (VFSContainer)item;
        VFSContainer versionContainer = getCanonicalVersionFolder(container, false);
        if (versionContainer == null) { return true; }
        return VFSConstants.YES.equals(versionContainer.delete());
      }
      return true;
    } else if (item instanceof VFSLeaf && item instanceof Versionable) {
      VFSLeaf leaf = (VFSLeaf)item;
      if (force) {
View Full Code Here

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

      VFSLeaf currentFile = (VFSLeaf) item;
      VFSLeaf versionFile = getCanonicalVersionXmlFile(currentFile, true);
      // infinite loop if rename is own versions file
      return VFSConstants.YES.equals(versionFile.rename(newname + ".xml"));
    } else if (item instanceof VFSContainer) {
      VFSContainer container = (VFSContainer) item;
      VFSContainer versionContainer = getCanonicalVersionFolder(container, false);
      if (versionContainer == null) { return true; }
      return VFSConstants.YES.equals(versionContainer.rename(newname));
    }
    return false;
  }
View Full Code Here

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

    VFSLeaf versionFile = getCanonicalVersionXmlFile(currentFile, true);
    if(versionFile == null) {
      return false;//cannot do something with the current file
    }
   
    VFSContainer versionContainer = versionFile.getParentContainer();

    String name = currentFile.getName();

    // read from the
    Versions v = readVersions(currentFile, versionFile);
    if (!(v instanceof VersionsFileImpl)) {
      log.error("Wrong implementation of Versions: " + v);
      return false;
    }
    VersionsFileImpl versions = (VersionsFileImpl) v;

    String uuid = UUID.randomUUID().toString() + "_" + name;
    String versionNr = getNextRevisionNr(versions);
    String currentAuthor = versions.getAuthor();
    long lastModifiedDate = 0;
    if (currentFile instanceof MetaTagged) {
      MetaInfo metaInfo = ((MetaTagged) currentFile).getMetaInfo();
      if(currentAuthor == null) {
        currentAuthor = metaInfo.getAuthor();
      }
      lastModifiedDate = metaInfo.getLastModified();
    }
   
    if(lastModifiedDate <= 0) {
      Calendar cal = Calendar.getInstance();
      cal.setTime(new Date());
      lastModifiedDate = cal.getTimeInMillis();
    }

    RevisionFileImpl newRevision = new RevisionFileImpl();
    newRevision.setName(name);
    newRevision.setFilename(uuid);
    newRevision.setRevisionNr(versionNr);
    newRevision.setComment(versions.getComment());
    newRevision.setAuthor(currentAuthor);
    newRevision.setLastModified(lastModifiedDate);

    if (versions.getRevisions().isEmpty() && currentVersion instanceof MetaTagged) {
      MetaTagged metaTagged = (MetaTagged) currentVersion;
      versions.setCreator(metaTagged.getMetaInfo().getAuthor());
    }

    VFSLeaf target = versionContainer.createChildLeaf(uuid);
    if (VFSManager.copyContent(currentFile, target)) {
      if (identity != null) {
        versions.setAuthor(identity.getName());
      }
      versions.setComment(comment);
View Full Code Here

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

    }
  }

  private boolean isVersioned(VFSItem item) {
    if (item == null) return false;
    VFSContainer parent = item.getParentContainer();
    return FolderConfig.versionsEnabled(parent);
  }
View Full Code Here

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

      // replace node delimiter with file system delimiter
      item = resolveFileForTreeNodeId(nodePath);
    }
    // load children of item and add them to the list
    if (item instanceof VFSContainer) {
      VFSContainer directory = (VFSContainer) item;
      List<VFSItem> childItems = directory.getItems(vfsFilter);
      for (VFSItem childItem : childItems) {
        AjaxTreeNode childNode = buildNode(childItem, nodePath);
        childNodes.add(childNode);
      }
    }
View Full Code Here

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

     
      // Setting some node attributes - see the Treenode or the extjs
      // documentation on what else you could use
      boolean isContainer = (vfsItem instanceof VFSContainer);
      if (isContainer) {
        VFSContainer directory = (VFSContainer) vfsItem;
        // mark as of type non-leaf for sorting
        node.put(AjaxTreeNode.CONF_IS_TYPE_LEAF, false);
        // set leaf = true when this container contains no children - no
        // expand icon!
        if (directory.getItems(vfsFilter).size() == 0) {
          node.put(AjaxTreeNode.CONF_LEAF, true);
          node.put(AjaxTreeNode.CONF_DISABLED, true);
        } else {
          node.put(AjaxTreeNode.CONF_LEAF, false);
        }
View Full Code Here

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

      // the relative path of the file is added to the vfs rootcontainer
      int sla = startURI.lastIndexOf('/');
      if (sla != -1) {
        String root = startURI.substring(0,sla);
        startURI = startURI.substring(sla+1);
        VFSContainer newroot = (VFSContainer)rootContainer.resolve(root);
        this.g_new_rootContainer = newroot;
      } else {
        this.g_new_rootContainer = rootContainer;       
      }
    } else {
View Full Code Here

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

            CoreLoggingResourceable.wrapSpUri(newUri));
      }
      else if (event instanceof ExternalSiteEvent) {
        ExternalSiteEvent ese = (ExternalSiteEvent)event;
        String startUri = ese.getStartUri();
        final VFSContainer finalRootContainer = g_new_rootContainer;
       
        if (mapper == null) {
          mr = MapperRegistry.getInstanceFor(ureq.getUserSession());
          mapper = createMapper(finalRootContainer);
          amapPath = mr.register(mapper);
View Full Code Here

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

        String relFilePath = "/" + fileName;
        // add current container path if not at root level
        if (!folderComponent.getCurrentContainerPath().equals("/")) {
          relFilePath = folderComponent.getCurrentContainerPath() + relFilePath;
        }
        VFSContainer writableRootContainer = folderComponent.getRootContainer();
        Object[] result = VFSManager.findWritableRootFolderFor(writableRootContainer, relFilePath);
        if (result != null) {
          writableRootContainer = (VFSContainer) result[0];
          relFilePath = (String) result[1];
        } else {
          // use fallback that always work: current directory and current file
          relFilePath = fileName;
          writableRootContainer = folderComponent.getCurrentContainer();
        }
        if (relFilePath.endsWith(".html") || relFilePath.endsWith(".htm")) {
          editorCtr = WysiwygFactory.createWysiwygController(ureq, getWindowControl(), writableRootContainer, relFilePath, true);       
          ((HTMLEditorController)editorCtr).setNewFile(true);
        }
        else {
          editorCtr = new PlainTextEditorController(ureq, getWindowControl(), (VFSLeaf)writableRootContainer.resolve(relFilePath), "utf-8", true, true, null);
        }

        this.listenTo(editorCtr);
       
        mainPanel.setContent(editorCtr.getInitialComponent());
View Full Code Here

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

    String relFilePath = "/" + currentItem.getName();
    // add current container path if not at root level
    if (!folderComponent.getCurrentContainerPath().equals("/")) {
      relFilePath = folderComponent.getCurrentContainerPath() + relFilePath;
    }
    VFSContainer writableRootContainer = folderComponent.getRootContainer();
    Object[] result = VFSManager.findWritableRootFolderFor(writableRootContainer, relFilePath);
    if (result != null) {
      writableRootContainer = (VFSContainer) result[0];
      relFilePath = (String) result[1];
    } else {
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.