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:
  • Constructor Details

    • ResourceServiceImpl

      public ResourceServiceImpl()
  • Method Details

    • 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: ResourceService
      On passing a valid
      Specified by:
      getChildResources in interface ResourceService
      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 interface ResourceService
      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: ResourceService
      Based on a location path
      Specified by:
      getParentResource in interface ResourceService
      Parameters:
      resourcePath - the resource path
      userId - the user id
      session - the current session
      Returns:
      the parent resource
      See Also:
    • 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 interface ResourceService
      Parameters:
      parentResource - The parent resource(mostly a folder)
      name - the filename and titlename of the child
      isCollection - is the resource folder?
      context - for inputstream
      session - 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 interface ResourceService
      Parameters:
      resource - The updateable resource
      context - the ImportContext
      session - 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: ResourceService
      Based on the parent resource it will be tried to get a child by a specific name
      Specified by:
      getChildByName in interface ResourceService
      Parameters:
      parentResource - The parent resource
      name - 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: ResourceService
      Check for existing resource(logically)
      Specified by:
      resourceExists in interface ResourceService
      Parameters:
      resource - The Resource
      Returns:
      True if found else false
    • updateResource

      public Resource updateResource(Resource resource)
      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 interface ResourceService
      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: ResourceService
      Moves a resource named target to the folder dictionary destination
      Specified by:
      move in interface ResourceService
      Parameters:
      source - the resource that is involved
      destination - the destination of the move operation
      session - 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 interface ResourceService
      Parameters:
      resource - a valid resource
      session - 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: ResourceService
      Copying of a resource within logicalDOC. Not supported those days.
      Specified by:
      copyResource in interface ResourceService
      Parameters:
      destinationResource - target resource
      resource - the DAV resource
      session - the current session
      Throws:
      org.apache.jackrabbit.webdav.DavException - error in the DAV communication
    • getParentResource

      public Resource getParentResource(Resource resource)
      Description copied from interface: ResourceService
      Based on the current resource location it will be turned back the upper resource
      Specified by:
      getParentResource in interface ResourceService
      Parameters:
      resource - the current resource
      Returns:
      the parent resource
    • streamIn

      public void streamIn(Resource resource, InputStream is)
      Description copied from interface: ResourceService
      Sets the stream for a resource
      Specified by:
      streamIn in interface ResourceService
      Parameters:
      resource - the DAV resource
      is - the stream gor the resource
    • streamOut

      public InputStream streamOut(Resource resource)
      Description copied from interface: ResourceService
      Gets the stream for a resource
      Specified by:
      streamOut in interface ResourceService
      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: ResourceService
      Versioning-part. Checkout causes the system to make a version "overwriteable" to put a new version on it.
      Specified by:
      checkout in interface ResourceService
      Parameters:
      resource - The appropriated resource that has to be checked out
      session - the current session
      Throws:
      org.apache.jackrabbit.webdav.DavException - error in the DAV communication
    • isCheckedOut

      public boolean isCheckedOut(Resource resource) throws NumberFormatException, PersistenceException
      Throws:
      NumberFormatException
      PersistenceException
    • getHistory

      public List<Resource> getHistory(Resource resource)
      Description copied from interface: ResourceService
      Versioning-part. Based upon the current resource, the versionhistory is returned matches to this resource.
      Specified by:
      getHistory in interface ResourceService
      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 interface ResourceService
      Parameters:
      resource - the DAV resource
      session - the current session
      Throws:
      org.apache.jackrabbit.webdav.DavException - error in the DAV communication
    • setVersionDAO

      public void setVersionDAO(VersionDAO versionDAO)
    • setFolderDAO

      public void setFolderDAO(FolderDAO folderDAO)
    • setStorer

      public void setStorer(Storer storer)
    • addBookmark

      public void addBookmark(Resource resource, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException
      Specified by:
      addBookmark in interface ResourceService
      Throws:
      org.apache.jackrabbit.webdav.DavException
    • deleteBookmark

      public void deleteBookmark(Resource resource, WebdavSession session) throws org.apache.jackrabbit.webdav.DavException
      Specified by:
      deleteBookmark in interface ResourceService
      Throws:
      org.apache.jackrabbit.webdav.DavException