Examples of VFSRevision


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

        if (CMD_DOWNLOAD.equals(tEvent.getActionId())) {
         
          MediaResource resource;
          if(row < versionedFile.getVersions().getRevisions().size()) {
            //restore current, do nothing
            VFSRevision version = versionedFile.getVersions().getRevisions().get(row);
            resource = new VFSRevisionMediaResource(version, true);
          } else {
            resource = new VFSMediaResource((VFSLeaf)versionedFile);
            ((VFSMediaResource)resource).setDownloadable(true);
          }
          ureq.getDispatchResult().setResultingMediaResource(resource);
        } else if (CMD_RESTORE.equals(tEvent.getActionId())) {
          if(row >= versionedFile.getVersions().getRevisions().size()) {
            //restore current, do nothing
            status = FolderCommandStatus.STATUS_SUCCESS;
            fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
          } else {
            VFSRevision version = versionedFile.getVersions().getRevisions().get(row);
            String comment = getTranslator().translate("version.restore.comment", new String[]{version.getRevisionNr()});
            if (versionedFile.getVersions().restore(ureq.getIdentity(), version, comment)) {
              status = FolderCommandStatus.STATUS_SUCCESS;
              fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
            } else {
              status = FolderCommandStatus.STATUS_FAILED;
View Full Code Here

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

    List<VFSRevision> allVersions = versionedFile.getVersions().getRevisions();

    List<VFSRevision> results = new ArrayList<VFSRevision>();
    for (int i = objectMarkers.nextSetBit(0); i >= 0; i = objectMarkers.nextSetBit(i + 1)) {
      if (i >= 0 && i < allVersions.size()) {
        VFSRevision elem = allVersions.get(i);
        results.add(elem);
      }
    }

    return results;
View Full Code Here

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

    public int getRowCount() {
      return versionList.size();
    }

    public Object getValueAt(int row, int col) {
      VFSRevision version = versionList.get(row);
      switch (col) {
        case 0:
          return version.getRevisionNr();
        case 1:
          return version.getAuthor();
        case 2: {
          String comment =  version.getComment();
          if (StringHelper.containsNonWhitespace(comment)) {
            return comment;
          } else if ("1".equals(version.getRevisionNr())) {
            return getTranslator().translate("version.initialRevision");
          }
          return "";
        }
        case 3:
          cal.setTimeInMillis(version.getLastModified());
          return format.format(cal.getTime());
        default:
          return "";
      }
    }
View Full Code Here

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

    if (source == deletedFilesListTableCtr) {
      if (event instanceof TableEvent) {
        TableEvent tEvent = (TableEvent) event;
        int row = tEvent.getRowId();
        if (CMD_DOWNLOAD.equals(tEvent.getActionId())) {
          VFSRevision version = getLastRevision(deletedFiles.get(row));
          MediaResource resource = new VFSRevisionMediaResource(version, true);
          ureq.getDispatchResult().setResultingMediaResource(resource);
        } else if (CMD_RESTORE.equals(tEvent.getActionId())) {
          VFSRevision version = getLastRevision(deletedFiles.get(row));
          if (VersionsManager.getInstance().restore(container, version)) {
            status = FolderCommandStatus.STATUS_SUCCESS;
            fireEvent(ureq, FolderCommand.FOLDERCOMMAND_FINISHED);
          } else {
            status = FolderCommandStatus.STATUS_FAILED;
View Full Code Here

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

 
  private String renderVersionsAsHtml(List<Versions> versions) {
    StringBuilder sb = new StringBuilder();
    sb.append("<ul>");
    for (Versions version:versions) {
      VFSRevision lastRevision = getLastRevision(version);
      if (lastRevision != null) {
        sb.append("<li>")
          .append(lastRevision.getName())
          .append("</li>");
      }
    }
    sb.append("</ul>");
    return sb.toString();
View Full Code Here

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

  protected List<VFSRevision> getSelectedRevisions(BitSet objectMarkers) {
    List<VFSRevision> results = new ArrayList<VFSRevision>();
    for (int i = objectMarkers.nextSetBit(0); i >= 0; i = objectMarkers.nextSetBit(i + 1)) {
      if (i >= 0 && i < deletedFiles.size()) {
        VFSRevision elem = getLastRevision(deletedFiles.get(i));
        if (elem != null) {
          results.add(elem);
        }
      }
    }
View Full Code Here

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

    }
    return results;
  }

  protected VFSRevision getLastRevision(Versions versions) {
    VFSRevision lastRevision = null;
    if (!versions.getRevisions().isEmpty()) {
      lastRevision = versions.getRevisions().get(versions.getRevisions().size() - 1);
    }
    return lastRevision;
  }
View Full Code Here

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

    public Object getValueAt(int row, int col) {
      Versions versioned = versionList.get(row);
      switch (col) {
        case 0: {
          VFSRevision lastRevision = getLastRevision(versioned);
          return lastRevision == null ? null : lastRevision.getName();
        }
        case 1:
          return versioned.getCreator();
        case 2: {
          VFSRevision lastRevision = getLastRevision(versioned);
          return lastRevision == null ? null : lastRevision.getAuthor();
        }
        case 3: {
          VFSRevision lastRevision = getLastRevision(versioned);
          if (lastRevision == null) return null;
          cal.setTimeInMillis(lastRevision.getLastModified());
          return format.format(cal.getTime());
        }
        default:
          return "";
      }
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.