Class ResourceServiceImpl
- java.lang.Object
-
- com.logicaldoc.webdav.resource.service.ResourceServiceImpl
-
- All Implemented Interfaces:
ResourceService,Serializable
public class ResourceServiceImpl extends Object implements ResourceService
Base implementation of a ResourceService- Author:
- Sebastian Wenzky
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ResourceServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckout(Resource resource, WebdavSession session)Versioning-part.voidcopyResource(Resource destinationResource, Resource resource, WebdavSession session)Copying of a resource within logicalDOC.ResourcecreateResource(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.voiddeleteResource(Resource resource, WebdavSession session)Deletion of a resource within logicalDOC.ResourcegetChildByName(Resource parentResource, String name)Based on the parent resource it will be tried to get a child by a specific nameList<Resource>getChildResources(Resource parentResource)On passing a validList<Resource>getHistory(Resource resource)Versioning-part.ResourcegetParentResource(Resource resource)Based on the current resource location it will be turned back the upper resourceResourcegetParentResource(String resourcePath, long userId, WebdavSession session)Based on a location pathResourcegetResource(String requestPath, WebdavSession session)On passing a location as well as the current session you gettin back the appropriated resource.booleanisCheckedOut(Resource resource)Resourcemove(Resource source, Resource destination, WebdavSession session)Moves a resource named target to the folder dictionary destinationbooleanresourceExists(Resource resource)Check for existing resource(logically)voidsetDocumentDAO(DocumentDAO documentDAO)voidsetDocumentManager(DocumentManager documentManager)voidsetFolderDAO(FolderDAO folderDAO)voidsetStorer(Storer storer)voidsetUserDAO(UserDAO userDAO)voidsetVersionDAO(VersionDAO versionDAO)voidstreamIn(Resource resource, InputStream is)Sets the stream for a resourceInputStreamstreamOut(Resource resource)Gets the stream for a resourcevoiduncheckout(Resource resource, WebdavSession session)Cancels a checkoutResourceupdateResource(Resource resource)Updating a resource on passing all new properties though a valid resource object.voidupdateResource(Resource resource, ImportContext context, WebdavSession session)Updating a resource on passing all new properties though a valid resource object.
-
-
-
Method Detail
-
setUserDAO
public void setUserDAO(UserDAO userDAO)
-
setDocumentDAO
public void setDocumentDAO(DocumentDAO documentDAO)
-
setDocumentManager
public void setDocumentManager(DocumentManager documentManager)
-
getChildResources
public List<Resource> getChildResources(Resource parentResource) throws org.apache.jackrabbit.webdav.DavException
Description copied from interface:ResourceServiceOn passing a valid- Specified by:
getChildResourcesin 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:
all resources (Folders as well as documents) will be returned - unsorted.
-
getResource
public Resource getResource(String requestPath, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException
Description copied from interface:ResourceServiceOn passing a location as well as the current session you gettin back the appropriated resource.- Specified by:
getResourcein 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)
Description copied from interface:ResourceServiceBased on a location path- Specified by:
getParentResourcein interfaceResourceService- Parameters:
resourcePath- the resource pathuserId- the user idsession- the current session- Returns:
- the parent resource
- See Also:
ResourceService.getChildByName(Resource, String)
-
createResource
public Resource createResource(Resource parentResource, String name, boolean isCollection, ImportContext context, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException
Description copied from interface:ResourceServiceHandle of resource creation by passed parent resource as well as the most import parameters needed for a resource creation.- Specified by:
createResourcein 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:ResourceServiceUpdating 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:
updateResourcein 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)
Description copied from interface:ResourceServiceBased on the parent resource it will be tried to get a child by a specific name- Specified by:
getChildByNamein interfaceResourceService- Parameters:
parentResource- The parent resourcename- name of the child must be- Returns:
- The resource that matches, else it will be returned null
-
resourceExists
public boolean resourceExists(Resource resource)
Description copied from interface:ResourceServiceCheck for existing resource(logically)- Specified by:
resourceExistsin interfaceResourceService- Parameters:
resource- The Resource- Returns:
- True if found else false
-
updateResource
public Resource updateResource(Resource resource)
Description copied from interface:ResourceServiceUpdating 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:
updateResourcein interfaceResourceService- Parameters:
resource- The updateable resource- Returns:
- the updated resource
-
move
public Resource move(Resource source, Resource destination, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException
Description copied from interface:ResourceServiceMoves a resource named target to the folder dictionary destination- Specified by:
movein interfaceResourceService- Parameters:
source- the resource that is involveddestination- the destination of the move operationsession- 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:ResourceServiceDeletion of a resource within logicalDOC.- Specified by:
deleteResourcein interfaceResourceService- Parameters:
resource- a valid resourcesession- the current session- Throws:
org.apache.jackrabbit.webdav.DavException- error in the DAV communication
-
copyResource
public void copyResource(Resource destinationResource, Resource resource, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException
Description copied from interface:ResourceServiceCopying of a resource within logicalDOC. Not supported those days.- Specified by:
copyResourcein interfaceResourceService- Parameters:
destinationResource- target resourceresource- the DAV resourcesession- the current session- Throws:
org.apache.jackrabbit.webdav.DavException- error in the DAV communication
-
getParentResource
public Resource getParentResource(Resource resource)
Description copied from interface:ResourceServiceBased on the current resource location it will be turned back the upper resource- Specified by:
getParentResourcein interfaceResourceService- Parameters:
resource- the current resource- Returns:
- the parent resource
-
streamIn
public void streamIn(Resource resource, InputStream is)
Description copied from interface:ResourceServiceSets the stream for a resource- Specified by:
streamInin interfaceResourceService- Parameters:
resource- the DAV resourceis- the stream gor the resource
-
streamOut
public InputStream streamOut(Resource resource)
Description copied from interface:ResourceServiceGets the stream for a resource- Specified by:
streamOutin interfaceResourceService- Parameters:
resource- the DAV resource- Returns:
- the stream of the resource
-
checkout
public void checkout(Resource resource, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException
Description copied from interface:ResourceServiceVersioning-part. Checkout causes the system to make a version "overwriteable" to put a new version on it.- Specified by:
checkoutin 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
-
isCheckedOut
public boolean isCheckedOut(Resource resource) throws NumberFormatException, PersistenceException
-
getHistory
public List<Resource> getHistory(Resource resource)
Description copied from interface:ResourceServiceVersioning-part. Based upon the current resource, the versionhistory is returned matches to this resource.- Specified by:
getHistoryin interfaceResourceService- Parameters:
resource- The appropriated resource- Returns:
- All Versions
-
uncheckout
public void uncheckout(Resource resource, WebdavSession session)
Description copied from interface:ResourceServiceCancels a checkout- Specified by:
uncheckoutin interfaceResourceService- Parameters:
resource- the DAV resourcesession- the current session
-
setVersionDAO
public void setVersionDAO(VersionDAO versionDAO)
-
setFolderDAO
public void setFolderDAO(FolderDAO folderDAO)
-
setStorer
public void setStorer(Storer storer)
-
-