Package org.nuxeo.drive.adapter.impl
Class DocumentBackedFolderItem
java.lang.Object
org.nuxeo.drive.adapter.impl.AbstractFileSystemItem
org.nuxeo.drive.adapter.impl.AbstractDocumentBackedFileSystemItem
org.nuxeo.drive.adapter.impl.DocumentBackedFolderItem
- All Implemented Interfaces:
Comparable<FileSystemItem>,FileSystemItem,FolderItem
- Direct Known Subclasses:
DefaultSyncRootFolderItem,UserSyncRootParentFolderItem,UserWorkspaceTopLevelFolderItem
public class DocumentBackedFolderItem
extends AbstractDocumentBackedFileSystemItem
implements FolderItem
DocumentModel backed implementation of a FolderItem.- Author:
- Antoine Taillefer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected booleanprotected static final Stringprotected static final intprotected static final Stringprotected static final intFields inherited from class org.nuxeo.drive.adapter.impl.AbstractDocumentBackedFileSystemItem
docId, docPath, docTitle, PERMISSION_CHECK_OPTIMIZED_PROPERTY, repositoryNameFields inherited from class org.nuxeo.drive.adapter.impl.AbstractFileSystemItem
canDelete, canRename, creationDate, creator, factoryName, FILE_SYSTEM_ITEM_ID_SEPARATOR, FILE_SYSTEM_ITEM_PATH_SEPARATOR, folder, id, lastContributor, lastModificationDate, lockInfo, name, parentId, path, principal, userName -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDocumentBackedFolderItem(String factoryName, FolderItem parentItem, DocumentModel doc) DocumentBackedFolderItem(String factoryName, FolderItem parentItem, DocumentModel doc, boolean relaxSyncRootConstraint) DocumentBackedFolderItem(String factoryName, FolderItem parentItem, DocumentModel doc, boolean relaxSyncRootConstraint, boolean getLockInfo) DocumentBackedFolderItem(String factoryName, DocumentModel doc) DocumentBackedFolderItem(String factoryName, DocumentModel doc, boolean relaxSyncRootConstraint) DocumentBackedFolderItem(String factoryName, DocumentModel doc, boolean relaxSyncRootConstraint, boolean getLockInfo) -
Method Summary
Modifier and TypeMethodDescriptionprotected List<FileSystemItem> adaptDocuments(DocumentModelList docs, CoreSession session) protected voidcheckBatchSize(int batchSize) createFile(Blob blob, boolean overwrite) createFolder(String name, boolean overwrite) protected ScrollFileSystemItemListdoScrollDescendants(String scrollId, int batchSize, long keepAlive) booleanprotected DocumentModelListfetchFromVCS(List<String> ids, CoreSession session) protected DocumentModelListfetchFromVcsChunk(List<String> ids, CoreSession session) Extracts batchSize elements from the input list.booleanbooleanReturnstrueif theFolderItem.scrollDescendants(String, int, long)API can be used.protected FileManagerprotected FolderItemgetFolderItem(Map<DocumentRef, FolderItem> cache, DocumentModel doc, FolderItem parentItem, boolean cacheItem) protected ScrollDocumentModelListgetScrollBatch(String scrollId, int batchSize, CoreSession session, long keepAlive) inthashCode()protected voidinitialize(DocumentModel doc) protected FolderItempopulateAncestorCache(Map<DocumentRef, FolderItem> cache, DocumentModel doc, CoreSession session, boolean cacheItem) voidscrollDescendants(String scrollId, int batchSize, long keepAlive) protected voidsetCanCreateChild(boolean canCreateChild) protected voidsetCanScrollDescendants(boolean canScrollDescendants) Methods inherited from class org.nuxeo.drive.adapter.impl.AbstractDocumentBackedFileSystemItem
canMove, computeId, delete, getDocId, getDocPath, getDocument, getDocumentById, getRepositoryName, getTrashService, handleCollectionMember, move, parseFileSystemId, setId, updateLastModificationDateMethods inherited from class org.nuxeo.drive.adapter.impl.AbstractFileSystemItem
compareTo, getCanDelete, getCanRename, getCreationDate, getCreator, getFileSystemItemAdapterService, getId, getLastContributor, getLastModificationDate, getLockInfo, getName, getParentId, getPath, getUserName, isFolder, setCanDelete, setCanRename, setCreationDate, setCreator, setFolder, setLastContributor, setLastModificationDate, setLockInfo, setName, setParentId, setPath, setUserName, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface org.nuxeo.drive.adapter.FileSystemItem
canMove, delete, getCanDelete, getCanRename, getCreationDate, getCreator, getId, getLastContributor, getLastModificationDate, getLockInfo, getName, getParentId, getPath, isFolder, move
-
Field Details
-
DESCENDANTS_SCROLL_CACHE
- See Also:
-
MAX_DESCENDANTS_BATCH_SIZE_PROPERTY
- See Also:
-
MAX_DESCENDANTS_BATCH_SIZE_DEFAULT
protected static final int MAX_DESCENDANTS_BATCH_SIZE_DEFAULT- See Also:
-
VCS_CHUNK_SIZE
protected static final int VCS_CHUNK_SIZE- See Also:
-
canCreateChild
protected boolean canCreateChild -
canScrollDescendants
protected boolean canScrollDescendants
-
-
Constructor Details
-
DocumentBackedFolderItem
-
DocumentBackedFolderItem
public DocumentBackedFolderItem(String factoryName, DocumentModel doc, boolean relaxSyncRootConstraint) -
DocumentBackedFolderItem
public DocumentBackedFolderItem(String factoryName, DocumentModel doc, boolean relaxSyncRootConstraint, boolean getLockInfo) -
DocumentBackedFolderItem
-
DocumentBackedFolderItem
public DocumentBackedFolderItem(String factoryName, FolderItem parentItem, DocumentModel doc, boolean relaxSyncRootConstraint) -
DocumentBackedFolderItem
public DocumentBackedFolderItem(String factoryName, FolderItem parentItem, DocumentModel doc, boolean relaxSyncRootConstraint, boolean getLockInfo) -
DocumentBackedFolderItem
protected DocumentBackedFolderItem()
-
-
Method Details
-
rename
- Specified by:
renamein interfaceFileSystemItem
-
getChildren
- Specified by:
getChildrenin interfaceFolderItem
-
getCanScrollDescendants
public boolean getCanScrollDescendants()Description copied from interface:FolderItemReturnstrueif theFolderItem.scrollDescendants(String, int, long)API can be used.- Specified by:
getCanScrollDescendantsin interfaceFolderItem
-
scrollDescendants
Description copied from interface:FolderItemRetrieves at mostbatchSizeFileSystemItemdescendants for the givenscrollId.When passing a null
scrollIdthe initial search request is executed and the first batch of results is returned along with ascrollIdwhich should be passed to the next call in order to retrieve the next batch of results.Ideally, the search context made available by the initial search request is kept alive during
keepAlivemilliseconds ifkeepAliveis positive.Results are not necessarily sorted.
This method is protected by a
Semaphore, made available byFileSystemItemAdapterService.getScrollBatchSemaphore(), to limit the number of concurrent executions and avoid too much memory pressure.- Specified by:
scrollDescendantsin interfaceFolderItem
-
doScrollDescendants
protected ScrollFileSystemItemList doScrollDescendants(String scrollId, int batchSize, long keepAlive) -
checkBatchSize
protected void checkBatchSize(int batchSize) -
getScrollBatch
protected ScrollDocumentModelList getScrollBatch(String scrollId, int batchSize, CoreSession session, long keepAlive) -
getBatch
Extracts batchSize elements from the input list. -
fetchFromVCS
-
fetchFromVcsChunk
-
adaptDocuments
-
populateAncestorCache
protected FolderItem populateAncestorCache(Map<DocumentRef, FolderItem> cache, DocumentModel doc, CoreSession session, boolean cacheItem) -
getFolderItem
protected FolderItem getFolderItem(Map<DocumentRef, FolderItem> cache, DocumentModel doc, FolderItem parentItem, boolean cacheItem) -
getCanCreateChild
public boolean getCanCreateChild()- Specified by:
getCanCreateChildin interfaceFolderItem
-
createFolder
- Specified by:
createFolderin interfaceFolderItem- Parameters:
overwrite- allows to overwrite an existing folder with the same title
-
createFile
- Specified by:
createFilein interfaceFolderItem- Parameters:
overwrite- allows to overwrite an existing file with the same title
-
equals
- Overrides:
equalsin classAbstractDocumentBackedFileSystemItem
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractDocumentBackedFileSystemItem
-
initialize
-
getFileManager
-
setCanCreateChild
protected void setCanCreateChild(boolean canCreateChild) -
setCanScrollDescendants
protected void setCanScrollDescendants(boolean canScrollDescendants)
-