Package org.olat.core.util.vfs.version

Examples of org.olat.core.util.vfs.version.Versionable


                newEntry = createIn.createChildLeaf(name);
                OutputStream out = newEntry.getOutputStream(false);
                if (!FileUtils.copy(oZip, out)) return false;
                FileUtils.closeSafely(out);
              } else if (newEntry instanceof Versionable) {
                Versionable versionable = (Versionable)newEntry;
                if(versionable.getVersions().isVersioned()) {
                  versionable.getVersions().addVersion(identity, "", oZip);
                }
              }
            } else {
              VFSLeaf newEntry = createIn.createChildLeaf(name);
              if (newEntry != null) {
View Full Code Here


        }
      };
    } else if (col.equals(SORT_REV)) {                                              // sort after revision number, folders always on top
      comparator = new Comparator<VFSItem>() {
        public int compare(VFSItem o1, VFSItem o2) {
          Versionable v1 = null;
          Versionable v2 = null;
          if (o1 instanceof Versionable) {
            v1 = (Versionable)o1;
          }
          if (o2 instanceof Versionable) {
            v2 = (Versionable)o2;
          }
          if(v1 == null) {
            return -1;
          } else if (v2 == null) {
            return 1;
          }
         
          String r1 = v1.getVersions().getRevisionNr();
          String r2 = v2.getVersions().getRevisionNr();
          if(v1 == null) {
            return -1;
          } else if (v2 == null) {
            return 1;
          }
View Full Code Here

    boolean canDelete = child.getParentContainer().canDelete() == VFSConstants.YES;
    boolean isAbstract = (child instanceof AbstractVirtualContainer);

    Versions versions = null;
    if(canContainerVersion && child instanceof Versionable) {
      Versionable versionable = (Versionable)child;
      if(versionable.getVersions().isVersioned()) {
        versions = versionable.getVersions();
      }
    }
    boolean canVersion = versions != null && !versions.getRevisions().isEmpty();
   
    VFSLeaf leaf = null;
View Full Code Here

    //used by move operations
    if(obj instanceof VFSResource) {
      VFSResource vfsResource = (VFSResource)obj;
      if(vfsResource.vfsItem instanceof Versionable
          && ((Versionable)vfsResource.vfsItem).getVersions().isVersioned()) {
        Versionable currentVersion = (Versionable)vfsResource.vfsItem;
        VersionsManager.getInstance().move(currentVersion, childLeaf.getParentContainer());
      }
    }
  }
View Full Code Here

    //used by move operations
    if(obj instanceof VFSResource) {
      VFSResource vfsResource = (VFSResource)obj;
      if(vfsResource.vfsItem instanceof Versionable
          && ((Versionable)vfsResource.vfsItem).getVersions().isVersioned()) {
        Versionable currentVersion = (Versionable)vfsResource.vfsItem;
        VersionsManager.getInstance().move(currentVersion, file.getParentContainer());
      }
    }
  }
View Full Code Here

            lockedFileDialog = DialogBoxUIFactory.createGenericDialog(ureq, getWindowControl(), translate("ul.lockedFile.title"), translate("ul.lockedFile.text", new String[] {existingVFSItem.getName(), renamedFilename} ), asList(translate("ul.overwrite.threeoptions.rename", renamedFilename), translate("ul.overwrite.threeoptions.cancel")));
            listenTo(lockedFileDialog);
            lockedFileDialog.activate();
          }
          else if (existingVFSItem instanceof Versionable && ((Versionable)existingVFSItem).getVersions().isVersioned()) {
            Versionable versionable = (Versionable)existingVFSItem;
            Versions versions = versionable.getVersions();
            String relPath = null;
            if(existingVFSItem instanceof OlatRootFileImpl) {
              relPath = ((OlatRootFileImpl)existingVFSItem).getRelPath();
            }
            int maxNumOfRevisions = FolderConfig.versionsAllowed(relPath);
View Full Code Here

     
      cleanUpCommentDialog();
      cleanUpRevisionDialog();

      //ok, new version of the file
      Versionable existingVersionableItem = (Versionable)existingVFSItem;
      boolean ok = existingVersionableItem.getVersions().addVersion(ureq.getIdentity(), comment, newFile.getInputStream());
      if(ok) {
        newFile.delete();
        VersionsManager.getInstance().delete(newFile, true);
        //what can i do if existingVFSItem is a container
        if(existingVFSItem instanceof VFSLeaf) {
          newFile = (VFSLeaf)existingVFSItem;
        }
      }
      finishUpload(ureq);
    } else if (source == unlockCtr) {
      // Overwrite...
      String fileName = existingVFSItem.getName();
      if(!unlockCtr.keepLocked()) {
        MetaInfo info = ((MetaTagged)existingVFSItem).getMetaInfo();
        info.setLocked(false);
        info.setLockedBy(null);
        info.write();
      }
     
      cleanUpUnlockDialog();
     
      existingVFSItem.delete();
      newFile.rename(fileName);

      // ... and notify listeners.
      finishUpload(ureq);
     
    } else if (source == revisionListCtr) {
      if(FolderCommandStatus.STATUS_CANCELED == revisionListCtr.getStatus()) {
        //don't want to delete revisions, clean the temporary file
        cleanUpRevisionDialog();
        newFile.delete();
        VersionsManager.getInstance().delete(newFile, true);
        fireEvent(ureq, Event.CANCELLED_EVENT);
      } else {
        if (existingVFSItem instanceof Versionable && ((Versionable)existingVFSItem).getVersions().isVersioned()) {
          cleanUpRevisionDialog();
 
          Versionable versionable = (Versionable)existingVFSItem;
          Versions versions = versionable.getVersions();
          int maxNumOfRevisions = FolderConfig.versionsAllowed(null);
          if(maxNumOfRevisions < 0 || maxNumOfRevisions > versions.getRevisions().size()) {
            commentVersionCtr = new VersionCommentController(ureq,getWindowControl(), askForLock(existingVFSItem, ureq), true);
            listenTo(commentVersionCtr);
            commentVersionDialogBox = new CloseableModalController(getWindowControl(), translate("save"), commentVersionCtr.getInitialComponent());
View Full Code Here

TOP

Related Classes of org.olat.core.util.vfs.version.Versionable

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.