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; }
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); } }
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 + "}"); }