Class FileResourceImpl

    • Constructor Detail

      • FileResourceImpl

        public FileResourceImpl​(org.springframework.web.multipart.MultipartFile file)
        Constructor
        Parameters:
        file - The multiPart file to construct the resource from
      • FileResourceImpl

        public FileResourceImpl​(javax.jcr.Node node)
        The node and the serverName to construct the resource from
        Parameters:
        node - The node
    • Method Detail

      • getId

        public String getId()
        Get the unique id (UUID) of this file
        Specified by:
        getId in interface FileResource
        Returns:
        The id of this file
      • getData

        public InputStream getData()
        Return the inputStream for the resource
        Specified by:
        getData in interface FileResource
        Returns:
        InputStream of the resource
      • getFileName

        public String getFileName()
        Return the filename for the resource
        Specified by:
        getFileName in interface FileResource
        Returns:
        File name of the resource
      • isPublic

        public boolean isPublic()
        Sets if the file resource is public or not
        Specified by:
        isPublic in interface FileResource
        Parameters:
        isPublic - true if it is public
        Returns:
        true if the file is public, false otherwise
      • getLastModified

        public Calendar getLastModified()
        Return the last modified date of the resource
        Specified by:
        getLastModified in interface FileResource
        Returns:
        Calendar with the last modified date of the resource
      • getMimeType

        public String getMimeType()
        Return the mimetype of the resource
        Specified by:
        getMimeType in interface FileResource
        Returns:
        Mimetype of the resource
      • getSize

        public long getSize()
        Returns the size in bytes of the resource
        Specified by:
        getSize in interface FileResource
        Returns:
        Size in bytes of the resource
      • getServerName

        public String getServerName()
        Return the servername on which the resource is stored.
        Specified by:
        getServerName in interface FileResource
        Returns:
      • getURL

        public String getURL()
        Return the URL that serves the file
        Specified by:
        getURL in interface FileResource
        Returns:
        URL that serves the file
      • getURL

        public String getURL​(String ownerUUID)
        Return the URL that serves the file for the given file owner
        Specified by:
        getURL in interface FileResource
        Parameters:
        ownerUUID - UUID of the JCR wrapper class that implements the FileResourceSecurityCheck interface. This class determines if the user is allowed to retrieve the file.
        Returns:
        URL that serves the file
      • mayView

        public boolean mayView​(javax.servlet.http.HttpServletRequest request)
        Description copied from interface: FileResource
        This method is invoked when a not public file is requested.
        Specified by:
        mayView in interface FileResource
        Returns:
        true is the user requesting the file is authorized for doing so, false otherwise
      • setPublic

        public void setPublic​(boolean isPublic)
        Description copied from interface: FileResource
        Sets whether this file is 'public'. This method should not be used to change the public state of a FileResource.
        Specified by:
        setPublic in interface FileResource
      • getMultipartFile

        public org.springframework.web.multipart.MultipartFile getMultipartFile()
        Description copied from interface: FileResource
        This method returns the belonging MultipartFile
        Specified by:
        getMultipartFile in interface FileResource
        Returns:
        The encapsulated MultipartFile if present, else null