package org.alfresco.service.cmr.model; import java.util.List; import java.util.Set; import org.alfresco.api.AlfrescoPublicApi; import org.alfresco.query.PagingRequest; import org.alfresco.query.PagingResults; import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; import org.alfresco.util.Pair; import org.springframework.extensions.surf.util.I18NUtil; /** * Provides methods specific to manipulating {@link org.alfresco.model.ContentModel#TYPE_CONTENT files} * and {@link org.alfresco.model.ContentModel#TYPE_FOLDER folders}. * * So this interface provides a simple way of accessing simple trees of files and folders in Alfresco. * * @see org.alfresco.model.ContentModel * * @author Derek Hulley */ @AlfrescoPublicApi public interface FileFolderService { /** * Lists immediate child files and folders of the given context node. *
* Note: this could be a long list (and will be trimmed at a pre-configured maximum). You should consider using a paging request. * * @param contextNodeRef the node to start searching in * @return Returns a list of matching files and folders */ @Auditable(parameters = {"contextNodeRef"}) public List* If both the parent folder and name remain the same, then nothing is done. * * @param sourceNodeRef the file or folder to move * @param targetParentRef the new parent node to move the node to - null means rename in situ * @param newName the name to change the file or folder to - null to keep the existing name * @return Returns the new file info * @throws FileExistsException * @throws FileNotFoundException */ @Auditable(parameters = {"sourceNodeRef", "targetParentRef", "newName"}) public FileInfo move(NodeRef sourceNodeRef, NodeRef targetParentRef, String newName) throws FileExistsException, FileNotFoundException; /** * Move a file or folder to a new name and/or location. *
* 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. * * @param sourceNodeRef the file or folder to move * @param sourceParentRef the source parent of node - null means move from primary parent * @param targetParentRef the new parent node to move the node to - null means rename in situ * @param newName the name to change the file or folder to - null to keep the existing name * @return Returns the new file info * @throws FileExistsException * @throws FileNotFoundException */ @Auditable(parameters = { "sourceNodeRef", "sourceParentRef", "targetParentRef", "newName" }) public FileInfo moveFrom(NodeRef sourceNodeRef, NodeRef sourceParentRef, NodeRef targetParentRef, String newName) throws FileExistsException, FileNotFoundException; /** * @deprecated From 3.4.2, use {@link #moveFrom(NodeRef, NodeRef, NodeRef, String)} or * {@link #move(NodeRef, NodeRef, String)}. See * ALF-7692 */ @Auditable(parameters = { "sourceNodeRef", "sourceParentRef", "targetParentRef", "newName" }) public FileInfo move(NodeRef sourceNodeRef, NodeRef sourceParentRef, NodeRef targetParentRef, String newName) throws FileExistsException, FileNotFoundException; /** * Copy a source file or folder. The source can be optionally renamed and optionally moved into another folder. ** If both the parent folder and name remain the same, then nothing is done. * * @param sourceNodeRef the file or folder to copy * @param targetParentRef the new parent node to copy the node to - null means rename in situ * @param newName the new name, or null to keep the existing name. * @return Return the new file info * @throws FileExistsException * @throws FileNotFoundException */ @Auditable(parameters = {"sourceNodeRef", "targetParentRef", "newName"}) public FileInfo copy(NodeRef sourceNodeRef, NodeRef targetParentRef, String newName) throws FileExistsException, FileNotFoundException; /** * Create a file or folder; or any valid node of type derived from file or folder. *
* The association QName for the patch defaults to cm:filename i.e. the * Content Model namespace with the filename as the local name. * * @param parentNodeRef the parent node. The parent must be a valid * {@link org.alfresco.model.ContentModel#TYPE_FOLDER folder}. * @param name the name of the node * @param typeQName the type to create * @return Returns the new node's file information * @throws FileExistsException * */ @Auditable(parameters = {"parentNodeRef", "name", "typeQName"}) public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName) throws FileExistsException; /** * Create a file or folder; or any valid node of type derived from file or folder * * @param parentNodeRef the parent node. The parent must be a valid * {@link org.alfresco.model.ContentModel#TYPE_FOLDER folder}. * @param name the name of the node * @param typeQName the type to create * @param assocQName the association QName to set for the path (may be null). * @return Returns the new node's file information * @throws FileExistsException */ @Auditable(parameters = {"parentNodeRef", "name", "typeQName"}) public FileInfo create(NodeRef parentNodeRef, String name, QName typeQName, QName assocQName) throws FileExistsException; /** * Delete a file or folder * * @param nodeRef the node to delete */ @Auditable(parameters = {"nodeRef"}) public void delete(NodeRef nodeRef); /** * Get the file or folder information from the root down to and including the node provided. *
null
if mustExist
is false
and the file does not exist
* @throws FileNotFoundException if no file or folder exists along the path and mustExist
is true
*/
@Auditable(parameters = {"rootNodeRef", "pathElements", "mustExist"})
public FileInfo resolveNamePath(NodeRef rootNodeRef, List