Package org.nuxeo.drive.service.impl
Class FileSystemItemManagerImpl
- java.lang.Object
-
- org.nuxeo.drive.service.impl.FileSystemItemManagerImpl
-
- All Implemented Interfaces:
FileSystemItemManager
public class FileSystemItemManagerImpl extends Object implements FileSystemItemManager
Default implementation of theFileSystemItemManager
.- Author:
- Antoine Taillefer
-
-
Constructor Summary
Constructors Constructor Description FileSystemItemManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canMove(String srcId, String destId, NuxeoPrincipal principal)
Return true if theFileSystemItem
with the given source id can be moved to theFileSystemItem
with the given destination id for the given principal.FileItem
createFile(String parentId, Blob blob, NuxeoPrincipal principal, boolean overwrite)
Creates a file with the given blob in theFileSystemItem
with the given id for the given principal.FolderItem
createFolder(String parentId, String name, NuxeoPrincipal principal, boolean overwrite)
Creates a folder with the given name in theFileSystemItem
with the given id for the given principal.void
delete(String id, String parentId, NuxeoPrincipal principal)
Deletes theFileSystemItem
with the given id and parent id for the given principal.void
delete(String id, NuxeoPrincipal principal)
Deletes theFileSystemItem
with the given id for the given principal.protected void
delete(FileSystemItem fsItem)
boolean
exists(String id, NuxeoPrincipal principal)
Returns true if aFileSystemItem
with the given id exists for the given principal.List<FileSystemItem>
getChildren(String id, NuxeoPrincipal principal)
Gets the children of theFileSystemItem
with the given id for the given principal.protected FileSystemItemAdapterService
getFileSystemItemAdapterService()
FileSystemItem
getFileSystemItemById(String id, String parentId, NuxeoPrincipal principal)
Gets theFileSystemItem
with the given id and parent id for the given principal.FileSystemItem
getFileSystemItemById(String id, NuxeoPrincipal principal)
Gets theFileSystemItem
with the given id for the given principal.FolderItem
getTopLevelFolder(NuxeoPrincipal principal)
Gets the top levelFolderItem
for the given principal.FileSystemItem
move(String srcId, String destId, NuxeoPrincipal principal)
Moves theFileSystemItem
with the given source id to theFileSystemItem
with the given destination id for the given principal.FileSystemItem
rename(String id, String name, NuxeoPrincipal principal)
Renames theFileSystemItem
with the given id with the given name for the given principal.ScrollFileSystemItemList
scrollDescendants(String id, NuxeoPrincipal principal, String scrollId, int batchSize, long keepAlive)
Retrieves at mostbatchSize
descendants of theFolderItem
with the givenid
for the givenprincipal
and the givenscrollId
.FileItem
updateFile(String id, String parentId, Blob blob, NuxeoPrincipal principal)
Updates theFileSystemItem
with the given id and parent id with the given blob for the given principal.FileItem
updateFile(String id, Blob blob, NuxeoPrincipal principal)
Updates theFileSystemItem
with the given id with the given blob for the given principal.protected FileItem
updateFile(FileSystemItem fsItem, Blob blob)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.drive.service.FileSystemItemManager
createFile, createFolder
-
-
-
-
Method Detail
-
getTopLevelFolder
public FolderItem getTopLevelFolder(NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Gets the top levelFolderItem
for the given principal.- Specified by:
getTopLevelFolder
in interfaceFileSystemItemManager
-
exists
public boolean exists(String id, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Returns true if aFileSystemItem
with the given id exists for the given principal.- Specified by:
exists
in interfaceFileSystemItemManager
- See Also:
FileSystemItemFactory.exists(String, NuxeoPrincipal)
-
getFileSystemItemById
public FileSystemItem getFileSystemItemById(String id, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Gets theFileSystemItem
with the given id for the given principal.- Specified by:
getFileSystemItemById
in interfaceFileSystemItemManager
- Returns:
- the
FileSystemItem
or null if none matches the given id - See Also:
FileSystemItemFactory.getFileSystemItemById(String, NuxeoPrincipal)
-
getFileSystemItemById
public FileSystemItem getFileSystemItemById(String id, String parentId, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Gets theFileSystemItem
with the given id and parent id for the given principal.- Specified by:
getFileSystemItemById
in interfaceFileSystemItemManager
- Returns:
- the
FileSystemItem
or null if none matches the given id and parent id - See Also:
FileSystemItemManager.getFileSystemItemById(String, NuxeoPrincipal)
-
getChildren
public List<FileSystemItem> getChildren(String id, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Gets the children of theFileSystemItem
with the given id for the given principal.- Specified by:
getChildren
in interfaceFileSystemItemManager
- See Also:
FolderItem.getChildren()
-
scrollDescendants
public ScrollFileSystemItemList scrollDescendants(String id, NuxeoPrincipal principal, String scrollId, int batchSize, long keepAlive)
Description copied from interface:FileSystemItemManager
Retrieves at mostbatchSize
descendants of theFolderItem
with the givenid
for the givenprincipal
and 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.
- Specified by:
scrollDescendants
in interfaceFileSystemItemManager
- See Also:
FolderItem.scrollDescendants(String, int, long)
-
canMove
public boolean canMove(String srcId, String destId, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Return true if theFileSystemItem
with the given source id can be moved to theFileSystemItem
with the given destination id for the given principal.- Specified by:
canMove
in interfaceFileSystemItemManager
- See Also:
FileSystemItem.canMove(FolderItem)
-
createFolder
public FolderItem createFolder(String parentId, String name, NuxeoPrincipal principal, boolean overwrite)
Description copied from interface:FileSystemItemManager
Creates a folder with the given name in theFileSystemItem
with the given id for the given principal.- Specified by:
createFolder
in interfaceFileSystemItemManager
overwrite
- allows to overwrite an existing folder with the same title- See Also:
FolderItem.createFolder(String, boolean)
-
createFile
public FileItem createFile(String parentId, Blob blob, NuxeoPrincipal principal, boolean overwrite)
Description copied from interface:FileSystemItemManager
Creates a file with the given blob in theFileSystemItem
with the given id for the given principal.- Specified by:
createFile
in interfaceFileSystemItemManager
overwrite
- allows to overwrite an existing file with the same title- See Also:
FolderItem.createFile(Blob, boolean)
-
updateFile
public FileItem updateFile(String id, Blob blob, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Updates theFileSystemItem
with the given id with the given blob for the given principal.- Specified by:
updateFile
in interfaceFileSystemItemManager
- See Also:
FileItem.setBlob(Blob)
-
updateFile
public FileItem updateFile(String id, String parentId, Blob blob, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Updates theFileSystemItem
with the given id and parent id with the given blob for the given principal.- Specified by:
updateFile
in interfaceFileSystemItemManager
- See Also:
FileSystemItemManager.updateFile(String, Blob, NuxeoPrincipal)
-
delete
public void delete(String id, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Deletes theFileSystemItem
with the given id for the given principal.- Specified by:
delete
in interfaceFileSystemItemManager
- See Also:
FileSystemItem.delete()
-
delete
public void delete(String id, String parentId, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Deletes theFileSystemItem
with the given id and parent id for the given principal.- Specified by:
delete
in interfaceFileSystemItemManager
- See Also:
FileSystemItemManager.delete(String, NuxeoPrincipal)
-
rename
public FileSystemItem rename(String id, String name, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Renames theFileSystemItem
with the given id with the given name for the given principal.- Specified by:
rename
in interfaceFileSystemItemManager
- See Also:
FileSystemItem.rename(String)
-
move
public FileSystemItem move(String srcId, String destId, NuxeoPrincipal principal)
Description copied from interface:FileSystemItemManager
Moves theFileSystemItem
with the given source id to theFileSystemItem
with the given destination id for the given principal.- Specified by:
move
in interfaceFileSystemItemManager
- See Also:
FileSystemItem.move(FolderItem)
-
getFileSystemItemAdapterService
protected FileSystemItemAdapterService getFileSystemItemAdapterService()
-
updateFile
protected FileItem updateFile(FileSystemItem fsItem, Blob blob)
-
delete
protected void delete(FileSystemItem fsItem)
-
-