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
Modifier and TypeFieldDescriptionprotected boolean
protected boolean
protected static final String
protected static final int
protected static final String
protected static final int
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
ModifierConstructorDescriptionprotected
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
Modifier and TypeMethodDescriptionprotected List<FileSystemItem>
adaptDocuments
(DocumentModelList docs, CoreSession session) protected void
checkBatchSize
(int batchSize) createFile
(Blob blob, boolean overwrite) createFolder
(String name, boolean overwrite) protected ScrollFileSystemItemList
doScrollDescendants
(String scrollId, int batchSize, long keepAlive) boolean
protected DocumentModelList
fetchFromVCS
(List<String> ids, CoreSession session) protected DocumentModelList
fetchFromVcsChunk
(List<String> ids, CoreSession session) Extracts batchSize elements from the input list.boolean
boolean
Returnstrue
if theFolderItem.scrollDescendants(String, int, long)
API can be used.protected FileManager
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
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
-
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:
rename
in interfaceFileSystemItem
-
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
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
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:
getCanCreateChild
in interfaceFolderItem
-
createFolder
- Specified by:
createFolder
in interfaceFolderItem
overwrite
- allows to overwrite an existing folder with the same title
-
createFile
- Specified by:
createFile
in interfaceFolderItem
overwrite
- allows to overwrite an existing file with the same title
-
equals
- Overrides:
equals
in classAbstractDocumentBackedFileSystemItem
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractDocumentBackedFileSystemItem
-
initialize
-
getFileManager
-
setCanCreateChild
protected void setCanCreateChild(boolean canCreateChild) -
setCanScrollDescendants
protected void setCanScrollDescendants(boolean canScrollDescendants)
-