Class ResourceServiceImpl
java.lang.Object
com.logicaldoc.webdav.resource.service.ResourceServiceImpl
- All Implemented Interfaces:
ResourceService
,Serializable
@Component("ResourceService")
public class ResourceServiceImpl
extends Object
implements ResourceService
Base implementation of a ResourceService
- Author:
- Sebastian Wenzky
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBookmark
(Resource resource, WebdavSession session) void
checkout
(Resource resource, WebdavSession session) Versioning-part.void
copy
(Resource source, Resource destination, String newName, WebdavSession session) Copying of a resource within logicalDOC.createResource
(Resource parentResource, String name, boolean isCollection, ImportContext context, WebdavSession session) Handle of resource creation by passed parent resource as well as the most import parameters needed for a resource creation.void
deleteBookmark
(Resource resource, WebdavSession session) void
deleteResource
(Resource resource, WebdavSession session) Deletion of a resource within logicalDOC.getChildByName
(Resource parentResource, String name) Based on the parent resource it will be tried to get a child by a specific namegetChildResources
(Resource parentResource) On passing a validgetHistory
(Resource resource) Versioning-part.getParentResource
(Resource resource) Based on the current resource location it will be turned back the upper resourcegetParentResource
(String resourcePath, long userId, WebdavSession session) Based on a location pathgetResource
(String requestPath, WebdavSession session) On passing a location as well as the current session you gettin back the appropriated resource.move
(Resource source, Resource destination, String newName, WebdavSession session) Moves a resource named target to the folder dictionary destinationvoid
setDocumentDAO
(DocumentDAO documentDAO) void
setDocumentManager
(DocumentManager documentManager) void
setFolderDAO
(FolderDAO folderDAO) void
void
setUserDAO
(UserDAO userDAO) void
setVersionDAO
(VersionDAO versionDAO) Gets the stream for a resourcevoid
uncheckout
(Resource resource, WebdavSession session) Cancels a checkoutvoid
updateResource
(Resource resource, ImportContext context, WebdavSession session) Updating a resource on passing all new properties though a valid resource object.
-
Constructor Details
-
ResourceServiceImpl
public ResourceServiceImpl()
-
-
Method Details
-
setUserDAO
-
setDocumentDAO
-
setDocumentManager
-
setVersionDAO
-
setFolderDAO
-
setStorer
-
getChildResources
public List<Resource> getChildResources(Resource parentResource) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
On passing a valid- Specified by:
getChildResources
in interfaceResourceService
- Parameters:
parentResource
- The resource(mostly a folder) from which are all direct childs has to be fetched and turned back s- Returns:
- direct childs of the parent resource
- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication- See Also:
-
getResource
public Resource getResource(String requestPath, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
On passing a location as well as the current session you gettin back the appropriated resource.- Specified by:
getResource
in interfaceResourceService
- Parameters:
requestPath
- The location retrieved through (@see DavResourceLocator#getResourcePath())session
- The current session- Returns:
- the DAV resource
- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication
-
getParentResource
public Resource getParentResource(String resourcePath, long userId, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
Based on a location path- Specified by:
getParentResource
in interfaceResourceService
- Parameters:
resourcePath
- the resource pathuserId
- the user idsession
- the current session- Returns:
- the parent resource
- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication- See Also:
-
the system tries to get the parent resource
-
createResource
public Resource createResource(Resource parentResource, String name, boolean isCollection, ImportContext context, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
Handle of resource creation by passed parent resource as well as the most import parameters needed for a resource creation.- Specified by:
createResource
in interfaceResourceService
- Parameters:
parentResource
- The parent resource(mostly a folder)name
- the filename and titlename of the childisCollection
- is the resource folder?context
- for inputstreamsession
- the current session- Returns:
- the newly created
Resource
- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication
-
updateResource
public void updateResource(Resource resource, ImportContext context, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
Updating a resource on passing all new properties though a valid resource object. This resource object must correspond on the ID attribute with a valid resource in logicalDOC.- Specified by:
updateResource
in interfaceResourceService
- Parameters:
resource
- The updateable resourcecontext
- the ImportContextsession
- the current session- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication
-
getChildByName
public Resource getChildByName(Resource parentResource, String name) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
Based on the parent resource it will be tried to get a child by a specific name- Specified by:
getChildByName
in interfaceResourceService
- Parameters:
parentResource
- The parent resourcename
- name of the child must be- Returns:
- The resource that matches, else it will be returned null
- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication
-
move
public Resource move(Resource source, Resource destination, String newName, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
Moves a resource named target to the folder dictionary destination- Specified by:
move
in interfaceResourceService
- Parameters:
source
- the resource that is involveddestination
- the destination folder of the move operationnewName
- optional different name to give to the moved itemsession
- the current session- Returns:
- the moved resource
- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication
-
deleteResource
public void deleteResource(Resource resource, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
Deletion of a resource within logicalDOC.- Specified by:
deleteResource
in interfaceResourceService
- Parameters:
resource
- a valid resourcesession
- the current session- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication
-
copy
public void copy(Resource source, Resource destination, String newName, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
Copying of a resource within logicalDOC.- Specified by:
copy
in interfaceResourceService
- Parameters:
source
- the DAV resourcedestination
- target resource (must be a folder)newName
- optional new name for the copied resourcesession
- the current session- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication
-
getParentResource
public Resource getParentResource(Resource resource) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
Based on the current resource location it will be turned back the upper resource- Specified by:
getParentResource
in interfaceResourceService
- Parameters:
resource
- the current resource- Returns:
- the parent resource
- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication
-
streamOut
Description copied from interface:ResourceService
Gets the stream for a resource- Specified by:
streamOut
in interfaceResourceService
- Parameters:
resource
- the DAV resource- Returns:
- the stream of the resource
- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communicationn
-
checkout
public void checkout(Resource resource, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
Versioning-part. Checkout causes the system to make a version "overwriteable" to put a new version on it.- Specified by:
checkout
in interfaceResourceService
- Parameters:
resource
- The appropriated resource that has to be checked outsession
- the current session- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication
-
getHistory
Description copied from interface:ResourceService
Versioning-part. Based upon the current resource, the versionhistory is returned matches to this resource.- Specified by:
getHistory
in interfaceResourceService
- Parameters:
resource
- The appropriated resource- Returns:
- All Versions
-
uncheckout
public void uncheckout(Resource resource, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException Description copied from interface:ResourceService
Cancels a checkout- Specified by:
uncheckout
in interfaceResourceService
- Parameters:
resource
- the DAV resourcesession
- the current session- Throws:
org.apache.jackrabbit.webdav.DavException
- error in the DAV communication
-
addBookmark
public void addBookmark(Resource resource, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException - Specified by:
addBookmark
in interfaceResourceService
- Throws:
org.apache.jackrabbit.webdav.DavException
-
deleteBookmark
public void deleteBookmark(Resource resource, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException - Specified by:
deleteBookmark
in interfaceResourceService
- Throws:
org.apache.jackrabbit.webdav.DavException
-