public Folder getFolder() { Folder parentFolder = null; try { parentFolder = super.getParentFolder(); if (parentFolder != null) { return parentFolder; } } catch (Exception e) { } try { List<org.apache.chemistry.opencmis.client.api.Folder> cmisParentFolders = _document.getParents(); if (cmisParentFolders.isEmpty()) { _document = _document.getObjectOfLatestVersion(false); cmisParentFolders = _document.getParents(); } parentFolder = CMISRepositoryLocalServiceUtil.toFolder(getRepositoryId(), cmisParentFolders.get(0)); setParentFolder(parentFolder); } catch (Exception e) { _log.error(e, e); } return parentFolder; }
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 FileEntry getFileEntry() throws PortalException, SystemException { Document document = null; List<Document> allVersions = _document.getAllVersions(); if (allVersions.isEmpty()) { document = _document; } else { document = allVersions.get(0); } return CMISRepositoryLocalServiceUtil.toFileEntry(getRepositoryId(), document); }
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 + "}"); }