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 aFolderItem
.- Author:
- Antoine Taillefer
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
canCreateChild
protected boolean
canScrollDescendants
protected static String
DESCENDANTS_SCROLL_CACHE
protected static int
MAX_DESCENDANTS_BATCH_SIZE_DEFAULT
protected static String
MAX_DESCENDANTS_BATCH_SIZE_PROPERTY
protected static int
VCS_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 protected
DocumentBackedFolderItem()
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 void
checkBatchSize(int batchSize)
FileItem
createFile(Blob blob, boolean overwrite)
FolderItem
createFolder(String name, boolean overwrite)
protected ScrollFileSystemItemList
doScrollDescendants(String scrollId, int batchSize, long keepAlive)
boolean
equals(Object obj)
protected DocumentModelList
fetchFromVCS(List<String> ids, CoreSession session)
protected DocumentModelList
fetchFromVcsChunk(List<String> ids, CoreSession session)
protected List<String>
getBatch(List<String> ids, int batchSize)
Extracts batchSize elements from the input list.boolean
getCanCreateChild()
boolean
getCanScrollDescendants()
Returnstrue
if theFolderItem.scrollDescendants(String, int, long)
API can be used.List<FileSystemItem>
getChildren()
protected FileManager
getFileManager()
protected FolderItem
getFolderItem(Map<DocumentRef,FolderItem> cache, DocumentModel doc, FolderItem parentItem, boolean cacheItem)
protected ScrollDocumentModelList
getScrollBatch(String scrollId, int batchSize, CoreSession session, long keepAlive)
int
hashCode()
protected void
initialize(DocumentModel doc)
protected FolderItem
populateAncestorCache(Map<DocumentRef,FolderItem> cache, DocumentModel doc, CoreSession session, boolean cacheItem)
void
rename(String name)
ScrollFileSystemItemList
scrollDescendants(String scrollId, int batchSize, long keepAlive)
protected void
setCanCreateChild(boolean canCreateChild)
protected void
setCanScrollDescendants(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:
rename
in interfaceFileSystemItem
-
getChildren
public List<FileSystemItem> getChildren()
- Specified by:
getChildren
in interfaceFolderItem
-
getCanScrollDescendants
public boolean getCanScrollDescendants()
Description copied from interface:FolderItem
Returnstrue
if theFolderItem.scrollDescendants(String, int, long)
API can be used.- Specified by:
getCanScrollDescendants
in interfaceFolderItem
-
scrollDescendants
public ScrollFileSystemItemList scrollDescendants(String scrollId, int batchSize, long keepAlive)
Description copied from interface:FolderItem
Retrieves at mostbatchSize
FileSystemItem
descendants for the givenscrollId
.When passing a null
scrollId
the initial search request is executed and the first batch of results is returned along with ascrollId
which 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
keepAlive
milliseconds ifkeepAlive
is 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:
scrollDescendants
in 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:
getCanCreateChild
in interfaceFolderItem
-
createFolder
public FolderItem createFolder(String name, boolean overwrite)
- Specified by:
createFolder
in interfaceFolderItem
overwrite
- allows to overwrite an existing folder with the same title
-
createFile
public FileItem createFile(Blob blob, boolean overwrite)
- Specified by:
createFile
in interfaceFolderItem
overwrite
- allows to overwrite an existing file with the same title
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classAbstractDocumentBackedFileSystemItem
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractDocumentBackedFileSystemItem
-
initialize
protected void initialize(DocumentModel doc)
-
getFileManager
protected FileManager getFileManager()
-
setCanCreateChild
protected void setCanCreateChild(boolean canCreateChild)
-
setCanScrollDescendants
protected void setCanScrollDescendants(boolean canScrollDescendants)
-
-