@AlfrescoPublicApi
public interface FileFolderService
files
and folders
.
So this interface provides a simple way of accessing simple trees of files and folders in Alfresco.ContentModel
Modifier and Type | Method and Description |
---|---|
FileInfo |
copy(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
org.alfresco.service.cmr.repository.NodeRef targetParentRef,
String newName)
Copy a source file or folder.
|
FileInfo |
create(org.alfresco.service.cmr.repository.NodeRef parentNodeRef,
String name,
org.alfresco.service.namespace.QName typeQName)
Create a file or folder; or any valid node of type derived from file or folder.
|
FileInfo |
create(org.alfresco.service.cmr.repository.NodeRef parentNodeRef,
String name,
org.alfresco.service.namespace.QName typeQName,
org.alfresco.service.namespace.QName assocQName)
Create a file or folder; or any valid node of type derived from file or folder
|
void |
delete(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Delete a file or folder
|
boolean |
exists(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Check the validity of a node reference
|
FileInfo |
getFileInfo(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Get the file info (name, folder, etc) for the given node
|
org.alfresco.service.cmr.repository.NodeRef |
getLocalizedSibling(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Uses the cm:name of the given node and attempts to find a sibling node
with a more specific localized name.
|
List<String> |
getNameOnlyPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
org.alfresco.service.cmr.repository.NodeRef nodeRef)
Get the file or folder names from the root down to and including the node provided.
|
List<FileInfo> |
getNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
org.alfresco.service.cmr.repository.NodeRef nodeRef)
Get the file or folder information from the root down to and including the node provided.
|
org.alfresco.service.cmr.repository.ContentReader |
getReader(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Get the reader to the file represented by the node according to the File/Folder model.
|
FileFolderServiceType |
getType(org.alfresco.service.namespace.QName typeQName)
Checks the type for whether it is a recognised file or folder type or is invalid for the FileFolderService.
|
org.alfresco.service.cmr.repository.ContentWriter |
getWriter(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Get the writer to the file represented by the node according to the File/Folder model.
|
boolean |
isHidden(org.alfresco.service.cmr.repository.NodeRef nodeRef)
|
List<FileInfo> |
list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef)
Lists immediate child files and folders of the given context node.
|
org.alfresco.query.PagingResults<FileInfo> |
list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
boolean files,
boolean folders,
Set<org.alfresco.service.namespace.QName> ignoreTypeQNames,
List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps,
org.alfresco.query.PagingRequest pagingRequest)
Lists page of immediate child files and/or folders of the given context node
with optional filtering (exclusion of certain child file/folder subtypes) and sorting
author janv |
org.alfresco.query.PagingResults<FileInfo> |
list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
boolean files,
boolean folders,
String pattern,
Set<org.alfresco.service.namespace.QName> ignoreTypeQNames,
List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps,
org.alfresco.query.PagingRequest pagingRequest)
Lists page of immediate child files and/or folders of the given context node
with pattern matching and optional filtering (exclusion of certain child file/folder subtypes) and sorting
Pattern uses '*' as a wildcard
|
org.alfresco.query.PagingResults<FileInfo> |
list(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
Set<org.alfresco.service.namespace.QName> searchTypeQNames,
Set<org.alfresco.service.namespace.QName> ignoreAspectQNames,
List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps,
org.alfresco.query.PagingRequest pagingRequest)
Lists page of immediate child objects of the given context node
with specification of which types to list and optional filtering (exclusion of certain child file/folder subtypes) and sorting
|
org.alfresco.query.PagingResults<FileInfo> |
list(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
Set<org.alfresco.service.namespace.QName> assocTypeQNames,
Set<org.alfresco.service.namespace.QName> searchTypeQNames,
Set<org.alfresco.service.namespace.QName> ignoreAspectQNames,
List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps,
List<FilterProp> filterProps,
org.alfresco.query.PagingRequest pagingRequest)
Lists page of immediate child objects of the given context node
with specification of which types to list and optional filtering (exclusion of certain child file/folder subtypes) and sorting
|
List<FileInfo> |
listDeepFolders(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
SubFolderFilter filter)
Deprecated.
|
List<FileInfo> |
listFiles(org.alfresco.service.cmr.repository.NodeRef contextNodeRef)
Lists all immediate child files of the given context node
Note: this could be a long list (and will be trimmed at a pre-configured maximum).
|
List<FileInfo> |
listFolders(org.alfresco.service.cmr.repository.NodeRef contextNodeRef)
Lists all immediate child folders of the given context node
Note: this could be a long list (and will be trimmed at a pre-configured maximum).
|
FileInfo |
move(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
org.alfresco.service.cmr.repository.NodeRef sourceParentRef,
org.alfresco.service.cmr.repository.NodeRef targetParentRef,
String newName)
Deprecated.
From 3.4.2, use
moveFrom(NodeRef, NodeRef, NodeRef, String) or
move(NodeRef, NodeRef, String) . See
ALF-7692 |
FileInfo |
move(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
org.alfresco.service.cmr.repository.NodeRef targetParentRef,
String newName)
Move a file or folder to a new name and/or location.
|
FileInfo |
moveFrom(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
org.alfresco.service.cmr.repository.NodeRef sourceParentRef,
org.alfresco.service.cmr.repository.NodeRef targetParentRef,
String newName)
Move a file or folder to a new name and/or location.
|
FileInfo |
rename(org.alfresco.service.cmr.repository.NodeRef fileFolderRef,
String newName)
Rename a file or folder in its current location
|
FileInfo |
resolveNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
List<String> pathElements)
Resolve a file or folder name path from a given root node down to the final node.
|
FileInfo |
resolveNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
List<String> pathElements,
boolean mustExist)
Resolve a file or folder name path from a given root node down to the final node.
|
List<FileInfo> |
search(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
String namePattern,
boolean includeSubFolders)
Deprecated.
for shallow search use list, listFolders, listFiles, searchSimple.
For deep listing use listDeepFolders.
Avoid calling this method with any name pattern except for "*".
|
List<FileInfo> |
search(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
String namePattern,
boolean fileSearch,
boolean folderSearch,
boolean includeSubFolders)
Deprecated.
for shallow search use list, listFolders, listFiles, searchSimple.
For deep listing use listDeepFolders.
Avoid calling this method with any name pattern except for "*".
|
org.alfresco.service.cmr.repository.NodeRef |
searchSimple(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
String name)
Get a node ref of the node that has the name within the parent node
|
void |
setHidden(org.alfresco.service.cmr.repository.NodeRef nodeRef,
boolean isHidden)
|
List<FileInfo> |
toFileInfoList(List<org.alfresco.service.cmr.repository.NodeRef> nodeRefs)
Helper method to transform a list of
NodeRef to a list of FileInfo |
@Auditable(parameters="contextNodeRef") List<FileInfo> list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef)
contextNodeRef
- the node to start searching in@Auditable(parameters={"contextNodeRef","files","folders","ignoreTypeQNames","sortProps","pagingRequest"}) org.alfresco.query.PagingResults<FileInfo> list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, boolean files, boolean folders, Set<org.alfresco.service.namespace.QName> ignoreTypeQNames, List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps, org.alfresco.query.PagingRequest pagingRequest)
@Auditable(parameters={"contextNodeRef","files","folders","ignoreTypeQNames","sortProps","pagingRequest"}) org.alfresco.query.PagingResults<FileInfo> list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, boolean files, boolean folders, String pattern, Set<org.alfresco.service.namespace.QName> ignoreTypeQNames, List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps, org.alfresco.query.PagingRequest pagingRequest)
@Auditable(parameters="folderNodeRef") List<FileInfo> listFiles(org.alfresco.service.cmr.repository.NodeRef contextNodeRef)
contextNodeRef
- the folder nodeRef to start searching in@Auditable(parameters="contextNodeRef") List<FileInfo> listFolders(org.alfresco.service.cmr.repository.NodeRef contextNodeRef)
contextNodeRef
- the node to start searching in@Auditable(parameters="contextNodeRef") List<FileInfo> listDeepFolders(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, SubFolderFilter filter)
contextNodeRef
- the node to start searching infilter
- - may be null in which case all sub-folders will be searched@Auditable(parameters="nodeRef") org.alfresco.service.cmr.repository.NodeRef getLocalizedSibling(org.alfresco.service.cmr.repository.NodeRef nodeRef)
the thread's default locale
.nodeRef
- the node that acts as the baseline for the search@Auditable(parameters={"contextNodeRef","name"}) org.alfresco.service.cmr.repository.NodeRef searchSimple(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, String name)
contextNodeRef
- the parent nodename
- the name of the node to search for@Auditable(parameters={"contextNodeRef","namePattern","includeSubFolders"}) List<FileInfo> search(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, String namePattern, boolean includeSubFolders)
contextNodeRef
- the context of the search. This node will never be returned
as part of the search results.namePattern
- the name of the file or folder to search for, or a
wildcard
pattern
to search for.includeSubFolders
- true to search the entire hierarchy below the search contextsearch(NodeRef, String, boolean, boolean, boolean)
@Auditable(parameters={"contextNodeRef","namePattern","fileSearch","folderSearch","includeSubFolders"}) List<FileInfo> search(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, String namePattern, boolean fileSearch, boolean folderSearch, boolean includeSubFolders)
contextNodeRef
- the context of the search. This node will never be returned
as part of the search results.namePattern
- the name of the file or folder to search for, or a
wildcard
pattern
to search for.fileSearch
- true if file types are to be included in the search resultsfolderSearch
- true if folder types are to be included in the search resultsincludeSubFolders
- true to search the entire hierarchy below the search context@Auditable(parameters={"fileFolderRef","newName"}) FileInfo rename(org.alfresco.service.cmr.repository.NodeRef fileFolderRef, String newName) throws FileExistsException, FileNotFoundException
fileFolderRef
- the file or folder to renamenewName
- the new nameFileExistsException
- if a file or folder with the new name already existsFileNotFoundException
- the file or folder reference doesn't exist@Auditable(parameters={"sourceNodeRef","targetParentRef","newName"}) FileInfo move(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef targetParentRef, String newName) throws FileExistsException, FileNotFoundException
If both the parent folder and name remain the same, then nothing is done.
sourceNodeRef
- the file or folder to movetargetParentRef
- the new parent node to move the node to - null means rename in situnewName
- the name to change the file or folder to - null to keep the existing nameFileExistsException
FileNotFoundException
@Auditable(parameters={"sourceNodeRef","sourceParentRef","targetParentRef","newName"}) FileInfo moveFrom(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef sourceParentRef, org.alfresco.service.cmr.repository.NodeRef targetParentRef, String newName) throws FileExistsException, FileNotFoundException
If both the parent folder and name remain the same, then nothing is done.
It is possible to specify which is the parent node when moving nodes; nodes can reside in multiple locations.sourceNodeRef
- the file or folder to movesourceParentRef
- the source parent of node - null means move from primary parenttargetParentRef
- the new parent node to move the node to - null means rename in situnewName
- the name to change the file or folder to - null to keep the existing nameFileExistsException
FileNotFoundException
@Auditable(parameters={"sourceNodeRef","sourceParentRef","targetParentRef","newName"}) FileInfo move(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef sourceParentRef, org.alfresco.service.cmr.repository.NodeRef targetParentRef, String newName) throws FileExistsException, FileNotFoundException
moveFrom(NodeRef, NodeRef, NodeRef, String)
or
move(NodeRef, NodeRef, String)
. See
ALF-7692@Auditable(parameters={"sourceNodeRef","targetParentRef","newName"}) FileInfo copy(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef targetParentRef, String newName) throws FileExistsException, FileNotFoundException
If both the parent folder and name remain the same, then nothing is done.
sourceNodeRef
- the file or folder to copytargetParentRef
- the new parent node to copy the node to - null means rename in situnewName
- the new name, or null to keep the existing name.FileExistsException
FileNotFoundException
@Auditable(parameters={"parentNodeRef","name","typeQName"}) FileInfo create(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, String name, org.alfresco.service.namespace.QName typeQName) throws FileExistsException
The association QName for the patch defaults to cm:filename i.e. the Content Model namespace with the filename as the local name.
parentNodeRef
- the parent node. The parent must be a valid
folder
.name
- the name of the nodetypeQName
- the type to createFileExistsException
@Auditable(parameters={"parentNodeRef","name","typeQName"}) FileInfo create(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, String name, org.alfresco.service.namespace.QName typeQName, org.alfresco.service.namespace.QName assocQName) throws FileExistsException
parentNodeRef
- the parent node. The parent must be a valid
folder
.name
- the name of the nodetypeQName
- the type to createassocQName
- the association QName to set for the path (may be null).FileExistsException
@Auditable(parameters="nodeRef") void delete(org.alfresco.service.cmr.repository.NodeRef nodeRef)
nodeRef
- the node to delete@Auditable(parameters={"rootNodeRef","nodeRef"}) List<FileInfo> getNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, org.alfresco.service.cmr.repository.NodeRef nodeRef) throws FileNotFoundException
rootNodeRef
- the start of the returned path, or null if the store root
node must be assumed.nodeRef
- a reference to the file or folderFileNotFoundException
- if the node could not be found@Auditable(parameters={"rootNodeRef","nodeRef"}) List<String> getNameOnlyPath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, org.alfresco.service.cmr.repository.NodeRef nodeRef) throws FileNotFoundException
rootNodeRef
- the start of the returned path, or null if the store root
node must be assumed.nodeRef
- a reference to the file or folderFileNotFoundException
- if the node could not be found@Auditable(parameters={"rootNodeRef","pathElements"}) FileInfo resolveNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, List<String> pathElements) throws FileNotFoundException
rootNodeRef
- the start point node - a cm:folder type or subtype, e.g. the Company Home's nodeRefpathElements
- a list of names in the path. Do not include the referenced rootNodeRef's path element.FileNotFoundException
- if no file or folder exists along the path@Auditable(parameters={"rootNodeRef","pathElements","mustExist"}) FileInfo resolveNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, List<String> pathElements, boolean mustExist) throws FileNotFoundException
rootNodeRef
- the start point node - a cm:folder type or subtype, e.g. the Company Home's nodeRefpathElements
- a list of names in the path. Do not include the referenced rootNodeRef's path element.null
if mustExist
is false
and the file does not existFileNotFoundException
- if no file or folder exists along the path and mustExist
is true
@Auditable(parameters="nodeRef") FileInfo getFileInfo(org.alfresco.service.cmr.repository.NodeRef nodeRef)
nodeRef
- the node to get info for@Auditable(parameters="nodeRef") org.alfresco.service.cmr.repository.ContentReader getReader(org.alfresco.service.cmr.repository.NodeRef nodeRef)
nodeRef
- the content node@Auditable(parameters="nodeRef") org.alfresco.service.cmr.repository.ContentWriter getWriter(org.alfresco.service.cmr.repository.NodeRef nodeRef)
nodeRef
- the content node@Auditable(parameters="nodeRef") boolean exists(org.alfresco.service.cmr.repository.NodeRef nodeRef)
@Auditable(parameters="typeQName") FileFolderServiceType getType(org.alfresco.service.namespace.QName typeQName)
typeQName
- the type to check@Deprecated boolean isHidden(org.alfresco.service.cmr.repository.NodeRef nodeRef)
@Deprecated void setHidden(org.alfresco.service.cmr.repository.NodeRef nodeRef, boolean isHidden)
@Auditable(parameters="rootNodeRef") org.alfresco.query.PagingResults<FileInfo> list(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, Set<org.alfresco.service.namespace.QName> searchTypeQNames, Set<org.alfresco.service.namespace.QName> ignoreAspectQNames, List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps, org.alfresco.query.PagingRequest pagingRequest)
rootNodeRef
- NodeRefsearchTypeQNames
- QNames of types to listpagingRequest
- PagingRequest@Auditable(parameters="rootNodeRef") org.alfresco.query.PagingResults<FileInfo> list(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, Set<org.alfresco.service.namespace.QName> assocTypeQNames, Set<org.alfresco.service.namespace.QName> searchTypeQNames, Set<org.alfresco.service.namespace.QName> ignoreAspectQNames, List<org.alfresco.util.Pair<org.alfresco.service.namespace.QName,Boolean>> sortProps, List<FilterProp> filterProps, org.alfresco.query.PagingRequest pagingRequest)
rootNodeRef
- NodeRefassocTypeQNames
- QNames of assoc types to listsearchTypeQNames
- QNames of node types to listpagingRequest
- PagingRequestCopyright © 2005–2017 Alfresco Software. All rights reserved.