Ejemplo n.º 1
0
  public FileVersion getLatestFileVersion() throws PortalException, SystemException {

    if (_latestFileVersion != null) {
      return _latestFileVersion;
    }

    List<Document> documents = getAllVersions();

    if (!documents.isEmpty()) {
      Document latestDocumentVersion = documents.get(0);

      _latestFileVersion =
          CMISRepositoryLocalServiceUtil.toFileVersion(getRepositoryId(), latestDocumentVersion);
    } else {
      _latestFileVersion =
          CMISRepositoryLocalServiceUtil.toFileVersion(getRepositoryId(), _document);
    }

    return _latestFileVersion;
  }
Ejemplo n.º 2
0
  public List<FileVersion> getFileVersions(int status) throws SystemException {

    try {
      List<Document> documents = getAllVersions();

      List<FileVersion> fileVersions = new ArrayList<FileVersion>(documents.size());

      for (Document document : documents) {
        FileVersion fileVersion =
            CMISRepositoryLocalServiceUtil.toFileVersion(getRepositoryId(), document);

        fileVersions.add(fileVersion);
      }

      return fileVersions;
    } catch (PortalException pe) {
      throw new RepositoryException(pe);
    }
  }
Ejemplo n.º 3
0
  public FileVersion getFileVersion(String version) throws PortalException, SystemException {

    if (Validator.isNull(version)) {
      return getFileVersion();
    }

    for (Document document : getAllVersions()) {
      if (version.equals(document.getVersionLabel())) {
        return CMISRepositoryLocalServiceUtil.toFileVersion(getRepositoryId(), document);
      }
    }

    throw new NoSuchFileVersionException(
        "No CMIS file version with {fileEntryId="
            + getFileEntryId()
            + ", version="
            + version
            + "}");
  }