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
DocumentModelbacked implementation of aFolderItem.- Author:
- Antoine Taillefer
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancanCreateChildprotected booleancanScrollDescendantsprotected static StringDESCENDANTS_SCROLL_CACHEprotected static intMAX_DESCENDANTS_BATCH_SIZE_DEFAULTprotected static StringMAX_DESCENDANTS_BATCH_SIZE_PROPERTYprotected static intVCS_CHUNK_SIZE-
Fields inherited from class org.nuxeo.drive.adapter.impl.AbstractDocumentBackedFileSystemItem
docId, docPath, docTitle, PERMISSION_CHECK_OPTIMIZED_PROPERTY, repositoryName
-
Fields 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
Constructors Modifier Constructor Description protectedDocumentBackedFolderItem()DocumentBackedFolderItem(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<FileSystemItem>adaptDocuments(DocumentModelList docs, CoreSession session)protected voidcheckBatchSize(int batchSize)FileItemcreateFile(Blob blob, boolean overwrite)FolderItemcreateFolder(String name, boolean overwrite)protected ScrollFileSystemItemListdoScrollDescendants(String scrollId, int batchSize, long keepAlive)booleanequals(Object obj)protected DocumentModelListfetchFromVCS(List<String> ids, CoreSession session)protected DocumentModelListfetchFromVcsChunk(List<String> ids, CoreSession session)protected List<String>getBatch(List<String> ids, int batchSize)Extracts batchSize elements from the input list.booleangetCanCreateChild()booleangetCanScrollDescendants()Returnstrueif theFolderItem.scrollDescendants(String, int, long)API can be used.List<FileSystemItem>getChildren()protected FileManagergetFileManager()protected 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)voidrename(String name)ScrollFileSystemItemListscrollDescendants(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, updateLastModificationDate
-
Methods 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, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.nuxeo.drive.adapter.FileSystemItem
canMove, delete, getCanDelete, getCanRename, getCreationDate, getCreator, getId, getLastContributor, getLastModificationDate, getLockInfo, getName, getParentId, getPath, isFolder, move
-
Methods inherited from interface org.nuxeo.drive.adapter.FolderItem
createFile, createFolder
-
-
-
-
Field Detail
-
DESCENDANTS_SCROLL_CACHE
protected static final String DESCENDANTS_SCROLL_CACHE
- See Also:
- Constant Field Values
-
MAX_DESCENDANTS_BATCH_SIZE_PROPERTY
protected static final String MAX_DESCENDANTS_BATCH_SIZE_PROPERTY
- See Also:
- Constant Field Values
-
MAX_DESCENDANTS_BATCH_SIZE_DEFAULT
protected static final int MAX_DESCENDANTS_BATCH_SIZE_DEFAULT
- See Also:
- Constant Field Values
-
VCS_CHUNK_SIZE
protected static final int VCS_CHUNK_SIZE
- See Also:
- Constant Field Values
-
canCreateChild
protected boolean canCreateChild
-
canScrollDescendants
protected boolean canScrollDescendants
-
-
Constructor Detail
-
DocumentBackedFolderItem
public DocumentBackedFolderItem(String factoryName, DocumentModel doc)
-
DocumentBackedFolderItem
public DocumentBackedFolderItem(String factoryName, DocumentModel doc, boolean relaxSyncRootConstraint)
-
DocumentBackedFolderItem
public DocumentBackedFolderItem(String factoryName, DocumentModel doc, boolean relaxSyncRootConstraint, boolean getLockInfo)
-
DocumentBackedFolderItem
public DocumentBackedFolderItem(String factoryName, FolderItem parentItem, DocumentModel doc)
-
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 Detail
-
rename
public void rename(String name)
- Specified by:
renamein interfaceFileSystemItem
-
getChildren
public List<FileSystemItem> 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
public ScrollFileSystemItemList scrollDescendants(String scrollId, int batchSize, long keepAlive)
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
protected List<String> getBatch(List<String> ids, int batchSize)
Extracts batchSize elements from the input list.
-
fetchFromVCS
protected DocumentModelList fetchFromVCS(List<String> ids, CoreSession session)
-
fetchFromVcsChunk
protected DocumentModelList fetchFromVcsChunk(List<String> ids, CoreSession session)
-
adaptDocuments
protected List<FileSystemItem> adaptDocuments(DocumentModelList docs, CoreSession session)
-
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
public FolderItem createFolder(String name, boolean overwrite)
- Specified by:
createFolderin interfaceFolderItemoverwrite- allows to overwrite an existing folder with the same title
-
createFile
public FileItem createFile(Blob blob, boolean overwrite)
- Specified by:
createFilein interfaceFolderItemoverwrite- allows to overwrite an existing file with the same title
-
equals
public boolean equals(Object obj)
- Overrides:
equalsin classAbstractDocumentBackedFileSystemItem
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractDocumentBackedFileSystemItem
-
initialize
protected void initialize(DocumentModel doc)
-
getFileManager
protected FileManager getFileManager()
-
setCanCreateChild
protected void setCanCreateChild(boolean canCreateChild)
-
setCanScrollDescendants
protected void setCanScrollDescendants(boolean canScrollDescendants)
-
-