org.alfresco.filesys.repo
Class CifsHelper

java.lang.Object
  extended by org.alfresco.filesys.repo.CifsHelper

public class CifsHelper
extends java.lang.Object

Class with supplying helper methods and potentially acting as a cache for queries.


Constructor Summary
CifsHelper()
          Class constructor
 
Method Summary
 org.alfresco.service.cmr.repository.NodeRef createNode(org.alfresco.service.cmr.repository.NodeRef rootNodeRef, java.lang.String path, org.alfresco.service.namespace.QName typeQName)
          Creates a file or directory using the given paths.
 ContentFileInfo getFileInformation(org.alfresco.service.cmr.repository.NodeRef nodeRef)
          Helper method to extract file info from a specific node.
 ContentFileInfo getFileInformation(org.alfresco.service.cmr.repository.NodeRef pathRootNodeRef, java.lang.String path)
          Extract a single node's file info, where the node is reference by a path relative to an ancestor node.
 java.lang.String getFileName(org.alfresco.service.cmr.repository.NodeRef node)
          Return the file name for a node
 org.alfresco.service.cmr.repository.NodeRef getNodeRef(org.alfresco.service.cmr.repository.NodeRef pathRootNodeRef, java.lang.String path)
          Attempts to fetch a specific single node at the given path.
 java.util.List getNodeRefs(org.alfresco.service.cmr.repository.NodeRef pathRootNodeRef, java.lang.String path)
          Finds the nodes being reference by the given directory and file paths.
 boolean hasLockedFilesAsOffline()
          Check if locked files should be marked as offline
 boolean isDirectory(org.alfresco.service.cmr.repository.NodeRef nodeRef)
           
 boolean isFolderEmpty(org.alfresco.service.cmr.repository.NodeRef folderNode)
          Check if the folder node is empty
 boolean isReadOnly()
           
 void move(org.alfresco.service.cmr.repository.NodeRef nodeToMoveRef, org.alfresco.service.cmr.repository.NodeRef newParentNodeRef, java.lang.String newName)
          Move a node
 void relinkNode(org.alfresco.service.cmr.repository.NodeRef tempNodeRef, org.alfresco.service.cmr.repository.NodeRef nodeToMoveRef, org.alfresco.service.cmr.repository.NodeRef newParentNodeRef, java.lang.String newName)
          Relink the content data from a new node to an existing node to preserve the version history.
 void rename(org.alfresco.service.cmr.repository.NodeRef nodeToRenameRef, java.lang.String newName)
          Rename a node
 void setAllowWrites(boolean allowWrites)
          Set whether the system allows files to be edited or not.
 void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)
           
 void setFileFolderService(FileFolderService fileFolderService)
           
 void setMarkLockedFilesAsOffline(boolean ena)
          Enable marking of locked files as offline
 void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)
           
 void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)
           
 void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CifsHelper

public CifsHelper()
Class constructor

Method Detail

setDictionaryService

public void setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService dictionaryService)

setNodeService

public void setNodeService(org.alfresco.service.cmr.repository.NodeService nodeService)

setFileFolderService

public void setFileFolderService(FileFolderService fileFolderService)

setMimetypeService

public void setMimetypeService(org.alfresco.service.cmr.repository.MimetypeService mimetypeService)

setPermissionService

public void setPermissionService(org.alfresco.service.cmr.security.PermissionService permissionService)

isReadOnly

public boolean isReadOnly()
Returns:
Returns true if all files/folders should be treated as read-only

setAllowWrites

public void setAllowWrites(boolean allowWrites)
Set whether the system allows files to be edited or not. The default is to allow writes.

Parameters:
allowWrites - true to allow writes, otherwise false for read-only mode

setMarkLockedFilesAsOffline

public final void setMarkLockedFilesAsOffline(boolean ena)
Enable marking of locked files as offline

Parameters:
ena - boolean

hasLockedFilesAsOffline

public final boolean hasLockedFilesAsOffline()
Check if locked files should be marked as offline

Returns:
boolean

isDirectory

public boolean isDirectory(org.alfresco.service.cmr.repository.NodeRef nodeRef)
Parameters:
serviceRegistry - for repo connection
nodeRef -
Returns:
Returns true if the node is a subtype of folder
Throws:
org.alfresco.error.AlfrescoRuntimeException - if the type is neither related to a folder or content

getFileInformation

public ContentFileInfo getFileInformation(org.alfresco.service.cmr.repository.NodeRef pathRootNodeRef,
                                          java.lang.String path)
                                   throws java.io.FileNotFoundException
Extract a single node's file info, where the node is reference by a path relative to an ancestor node.

Parameters:
pathRootNodeRef -
path -
Returns:
Returns the existing node reference
Throws:
java.io.FileNotFoundException

getFileInformation

public ContentFileInfo getFileInformation(org.alfresco.service.cmr.repository.NodeRef nodeRef)
                                   throws java.io.FileNotFoundException
Helper method to extract file info from a specific node.

This method goes direct to the repo for all information and no data is cached here.

Parameters:
nodeRef - the node that the path is relative to
path - the path to get info for
Returns:
Returns the file information pertinent to the node
Throws:
java.io.FileNotFoundException - if the path refers to a non-existent file

createNode

public org.alfresco.service.cmr.repository.NodeRef createNode(org.alfresco.service.cmr.repository.NodeRef rootNodeRef,
                                                              java.lang.String path,
                                                              org.alfresco.service.namespace.QName typeQName)
                                                       throws org.alfresco.jlan.server.filesys.FileExistsException
Creates a file or directory using the given paths.

If the directory path doesn't exist, then all the parent directories will be created. If the file path is null, then the file will not be created

Parameters:
rootNodeRef - the root node of the path
path - the path to a node
isFile - true if the node to be created must be a file
Returns:
Returns a newly created file or folder node
Throws:
org.alfresco.jlan.server.filesys.FileExistsException - if the file or folder already exists

getNodeRefs

public java.util.List getNodeRefs(org.alfresco.service.cmr.repository.NodeRef pathRootNodeRef,
                                  java.lang.String path)
Finds the nodes being reference by the given directory and file paths.

Examples of the path are:

Parameters:
searchRootNodeRef - the node from which to start the path search
path - the search path to either a folder or file
Returns:
Returns references to all matching nodes

getNodeRef

public org.alfresco.service.cmr.repository.NodeRef getNodeRef(org.alfresco.service.cmr.repository.NodeRef pathRootNodeRef,
                                                              java.lang.String path)
                                                       throws java.io.FileNotFoundException
Attempts to fetch a specific single node at the given path.

Throws:
java.io.FileNotFoundException - if the path can't be resolved to a node
See Also:
CifsHelper.getNodeRefs(NodeRef, String)

relinkNode

public void relinkNode(org.alfresco.service.cmr.repository.NodeRef tempNodeRef,
                       org.alfresco.service.cmr.repository.NodeRef nodeToMoveRef,
                       org.alfresco.service.cmr.repository.NodeRef newParentNodeRef,
                       java.lang.String newName)
                throws java.io.FileNotFoundException,
                       org.alfresco.jlan.server.filesys.FileExistsException
Relink the content data from a new node to an existing node to preserve the version history.

Parameters:
oldNodeRef - NodeRef
newNodeRef - NodeRef
Throws:
java.io.FileNotFoundException
org.alfresco.jlan.server.filesys.FileExistsException

move

public void move(org.alfresco.service.cmr.repository.NodeRef nodeToMoveRef,
                 org.alfresco.service.cmr.repository.NodeRef newParentNodeRef,
                 java.lang.String newName)
          throws org.alfresco.jlan.server.filesys.FileExistsException
Move a node

Parameters:
nodeToMoveRef - Node to be moved
newParentNodeRef - New parent folder node
newName - New name for the moved node
Throws:
org.alfresco.jlan.server.filesys.FileExistsException

rename

public void rename(org.alfresco.service.cmr.repository.NodeRef nodeToRenameRef,
                   java.lang.String newName)
            throws org.alfresco.jlan.server.filesys.FileExistsException
Rename a node

Parameters:
nodeToRenameRef - Node to be renamed
newName - New name for the node
Throws:
org.alfresco.jlan.server.filesys.FileExistsException

getFileName

public java.lang.String getFileName(org.alfresco.service.cmr.repository.NodeRef node)
Return the file name for a node

Parameters:
node - NodeRef
Returns:
String
Throws:
java.io.FileNotFoundException

isFolderEmpty

public boolean isFolderEmpty(org.alfresco.service.cmr.repository.NodeRef folderNode)
Check if the folder node is empty

Parameters:
folderNode - NodeRef
Returns:
boolean


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.