|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.alfresco.repo.model.filefolder.FileFolderServiceImpl
public class FileFolderServiceImpl
Implementation of the file/folder-specific service.
Nested Class Summary | |
---|---|
static class |
FileFolderServiceImpl.InvalidTypeException
Exception when the type is not a valid File or Folder type |
Constructor Summary | |
---|---|
FileFolderServiceImpl()
Default constructor |
Method Summary | |
---|---|
FileInfo |
copy(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
org.alfresco.service.cmr.repository.NodeRef targetParentRef,
java.lang.String newName)
Copy a source file or folder. |
FileInfo |
create(org.alfresco.service.cmr.repository.NodeRef parentNodeRef,
java.lang.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,
java.lang.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. |
java.util.List |
getNamePath(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. |
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. |
void |
init()
|
java.util.List |
list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef)
Lists immediate child files and folders of the given context node. |
org.alfresco.query.PagingResults |
list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
boolean files,
boolean folders,
java.util.Set ignoreTypeQNames,
java.util.List 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 |
org.alfresco.query.PagingResults |
list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
boolean files,
boolean folders,
java.lang.String pattern,
java.util.Set ignoreQNameTypes,
java.util.List 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 |
java.util.List |
listDeepFolders(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
SubFolderFilter filter)
Lists all folders below the given context node, both immediate and lower levels The filter parameter allows subfolders to be excluded from the search. |
java.util.List |
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). |
java.util.List |
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). |
static FileInfo |
makeFolders(FileFolderService service,
org.alfresco.service.cmr.repository.NodeRef parentNodeRef,
java.util.List pathElements,
org.alfresco.service.namespace.QName folderTypeQName)
Deprecated. Use FileFolderUtil.makeFolders rather than directly accessing this implementation class. |
FileInfo |
makeFolders(org.alfresco.service.cmr.repository.NodeRef parentNodeRef,
java.util.List pathElements,
org.alfresco.service.namespace.QName folderTypeQName)
Deprecated. Use FileFolderUtil.makeFolders rather than directly accessing this implementation class. |
FileInfo |
move(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
org.alfresco.service.cmr.repository.NodeRef sourceParentRef,
org.alfresco.service.cmr.repository.NodeRef targetParentRef,
java.lang.String newName)
Deprecated. |
FileInfo |
move(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
org.alfresco.service.cmr.repository.NodeRef targetParentRef,
java.lang.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,
java.lang.String newName)
Move a file or folder to a new name and/or location. |
FileInfo |
rename(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef,
java.lang.String newName)
Rename a file or folder in its current location |
FileInfo |
resolveNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
java.util.List pathElements)
Resolve a file or folder name path from a given root node down to the final node. |
java.util.List |
search(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
java.lang.String namePattern,
boolean includeSubFolders)
Searches for all files and folders with the matching name pattern, using wildcard characters * and ?. |
java.util.List |
search(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
java.lang.String namePattern,
boolean fileSearch,
boolean folderSearch,
boolean includeSubFolders)
Full search with all options |
org.alfresco.service.cmr.repository.NodeRef |
searchSimple(org.alfresco.service.cmr.repository.NodeRef contextNodeRef,
java.lang.String name)
Get a node ref of the node that has the name within the parent node |
void |
setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry cannedQueryRegistry)
Set the registry of canned queries |
void |
setContentService(ContentService contentService)
|
void |
setCopyService(CopyService copyService)
|
void |
setDefaultListMaxResults(int defaultListMaxResults)
|
void |
setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
|
void |
setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
|
void |
setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
|
void |
setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
|
void |
setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
|
void |
setSystemNamespaces(java.util.List systemNamespaces)
Set the namespaces that should be treated as 'system' namespaces. |
void |
setSystemPaths(java.util.List systemPaths)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileFolderServiceImpl()
Method Detail |
---|
public void setNamespaceService(org.alfresco.service.namespace.NamespaceService namespaceService)
public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
public void setCopyService(CopyService copyService)
public void setSearchService(org.alfresco.service.cmr.search.SearchService searchService)
public void setContentService(ContentService contentService)
public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
public void setCannedQueryRegistry(org.alfresco.util.registry.NamedObjectRegistry cannedQueryRegistry)
canned queries
public void setSystemNamespaces(java.util.List systemNamespaces)
When files or folders are renamed, the association path (QName) is normally modified to follow the name of the node. If, however, the namespace of the patch QName is in this list, the association path is left alone. This allows parts of the application to use well-known paths even if the end-user is able to modify the objects cm:name value.
systemNamespaces
- a list of system namespacespublic void setSystemPaths(java.util.List systemPaths)
public void setDefaultListMaxResults(int defaultListMaxResults)
public void init()
public boolean exists(org.alfresco.service.cmr.repository.NodeRef nodeRef)
FileFolderService
exists
in interface FileFolderService
public FileFolderServiceType getType(org.alfresco.service.namespace.QName typeQName)
FileFolderService
getType
in interface FileFolderService
typeQName
- the type to check
public java.util.List list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef)
FileFolderService
list
in interface FileFolderService
contextNodeRef
- the node to start searching in
@Auditable(parameters={"contextNodeRef", "files", "folders", "ignoreTypeQNames", "sortProps", "pagingRequest"}) public org.alfresco.query.PagingResults list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, boolean files, boolean folders, java.util.Set ignoreTypeQNames, java.util.List sortProps, org.alfresco.query.PagingRequest pagingRequest)
FileFolderService
list
in interface FileFolderService
public org.alfresco.query.PagingResults list(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, boolean files, boolean folders, java.lang.String pattern, java.util.Set ignoreQNameTypes, java.util.List sortProps, org.alfresco.query.PagingRequest pagingRequest)
FileFolderService
list
in interface FileFolderService
public java.util.List listFiles(org.alfresco.service.cmr.repository.NodeRef contextNodeRef)
FileFolderService
listFiles
in interface FileFolderService
public java.util.List listFolders(org.alfresco.service.cmr.repository.NodeRef contextNodeRef)
FileFolderService
listFolders
in interface FileFolderService
contextNodeRef
- the node to start searching in
public java.util.List listDeepFolders(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, SubFolderFilter filter)
FileFolderService
listDeepFolders
in interface FileFolderService
contextNodeRef
- the node to start searching infilter
- - may be null in which case all sub-folders will be searchedpublic org.alfresco.service.cmr.repository.NodeRef getLocalizedSibling(org.alfresco.service.cmr.repository.NodeRef nodeRef)
FileFolderService
the thread's default locale
.
getLocalizedSibling
in interface FileFolderService
nodeRef
- the node that acts as the baseline for the search
public org.alfresco.service.cmr.repository.NodeRef searchSimple(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, java.lang.String name)
FileFolderService
searchSimple
in interface FileFolderService
contextNodeRef
- the parent nodename
- the name of the node to search for
public java.util.List search(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, java.lang.String namePattern, boolean includeSubFolders)
FileFolderService
search
in interface FileFolderService
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 context
FileFolderServiceImpl.search(NodeRef, String, boolean, boolean, boolean)
public java.util.List search(org.alfresco.service.cmr.repository.NodeRef contextNodeRef, java.lang.String namePattern, boolean fileSearch, boolean folderSearch, boolean includeSubFolders)
search
in interface FileFolderService
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
public FileInfo rename(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, java.lang.String newName) throws FileExistsException, FileNotFoundException
FileFolderService
rename
in interface FileFolderService
sourceNodeRef
- the file or folder to renamenewName
- the new name
FileExistsException
- if a file or folder with the new name already exists
FileNotFoundException
- the file or folder reference doesn't existFileFolderServiceImpl.move(NodeRef, NodeRef, String)
public FileInfo move(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef targetParentRef, java.lang.String newName) throws FileExistsException, FileNotFoundException
FileFolderService
If both the parent folder and name remain the same, then nothing is done.
move
in interface FileFolderService
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 name
FileExistsException
FileNotFoundException
#moveOrCopy(NodeRef, NodeRef, String, boolean)
public FileInfo moveFrom(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef sourceParentRef, org.alfresco.service.cmr.repository.NodeRef targetParentRef, java.lang.String newName) throws FileExistsException, FileNotFoundException
FileFolderService
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.
moveFrom
in interface FileFolderService
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 name
FileExistsException
FileNotFoundException
#moveOrCopy(NodeRef, NodeRef, String, boolean)
public FileInfo move(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef sourceParentRef, org.alfresco.service.cmr.repository.NodeRef targetParentRef, java.lang.String newName) throws FileExistsException, FileNotFoundException
move
in interface FileFolderService
FileExistsException
FileNotFoundException
public FileInfo copy(org.alfresco.service.cmr.repository.NodeRef sourceNodeRef, org.alfresco.service.cmr.repository.NodeRef targetParentRef, java.lang.String newName) throws FileExistsException, FileNotFoundException
FileFolderService
If both the parent folder and name remain the same, then nothing is done.
copy
in interface FileFolderService
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
#moveOrCopy(NodeRef, NodeRef, String, boolean)
public FileInfo create(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, java.lang.String name, org.alfresco.service.namespace.QName typeQName) throws FileExistsException
FileFolderService
The association QName for the patch defaults to cm:filename i.e. the Content Model namespace with the filename as the local name.
create
in interface FileFolderService
parentNodeRef
- the parent node. The parent must be a valid
folder
.name
- the name of the nodetypeQName
- the type to create
FileExistsException
#create(NodeRef, String, QName, QName)}
public FileInfo create(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, java.lang.String name, org.alfresco.service.namespace.QName typeQName, org.alfresco.service.namespace.QName assocQName) throws FileExistsException
FileFolderService
create
in interface FileFolderService
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
public void delete(org.alfresco.service.cmr.repository.NodeRef nodeRef)
FileFolderService
delete
in interface FileFolderService
nodeRef
- the node to deletepublic FileInfo makeFolders(org.alfresco.service.cmr.repository.NodeRef parentNodeRef, java.util.List pathElements, org.alfresco.service.namespace.QName folderTypeQName)
An empty path list is not allowed as it would be impossible to necessarily return file info for the parent node - it might not be a folder node.
parentNodeRef
- the node under which the path will be createdpathElements
- the folder name path to create - may not be emptyfolderTypeQName
- the types of nodes to create. This must be a valid subtype of
they folder type
.
public static FileInfo makeFolders(FileFolderService service, org.alfresco.service.cmr.repository.NodeRef parentNodeRef, java.util.List pathElements, org.alfresco.service.namespace.QName folderTypeQName)
An empty path list is not allowed as it would be impossible to necessarily return file info for the parent node - it might not be a folder node.
parentNodeRef
- the node under which the path will be createdpathElements
- the folder name path to create - may not be emptyfolderTypeQName
- the types of nodes to create. This must be a valid subtype of
they folder type
.
public java.util.List getNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, org.alfresco.service.cmr.repository.NodeRef nodeRef) throws FileNotFoundException
FileFolderService
getNamePath
in interface FileFolderService
rootNodeRef
- the start of the returned path, or null if the store root
node must be assumed.nodeRef
- a reference to the file or folder
FileNotFoundException
- if the node could not be foundpublic FileInfo resolveNamePath(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, java.util.List pathElements) throws FileNotFoundException
FileFolderService
resolveNamePath
in interface FileFolderService
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 pathpublic FileInfo getFileInfo(org.alfresco.service.cmr.repository.NodeRef nodeRef)
FileFolderService
getFileInfo
in interface FileFolderService
nodeRef
- the node to get info for
public org.alfresco.service.cmr.repository.ContentReader getReader(org.alfresco.service.cmr.repository.NodeRef nodeRef)
FileFolderService
getReader
in interface FileFolderService
nodeRef
- the content node
public org.alfresco.service.cmr.repository.ContentWriter getWriter(org.alfresco.service.cmr.repository.NodeRef nodeRef)
FileFolderService
getWriter
in interface FileFolderService
nodeRef
- the content node
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |