nl.gx.webmanager.api.implementation
Class FileResourceImpl

java.lang.Object
  extended by nl.gx.webmanager.api.implementation.FileResourceImpl
All Implemented Interfaces:
FileResource

public class FileResourceImpl
extends java.lang.Object
implements FileResource

This class implements a resource.


Constructor Summary
FileResourceImpl(org.springframework.web.multipart.MultipartFile file)
          Constructor
FileResourceImpl(javax.jcr.Node node)
          The node and the servername to construct the resource from
 
Method Summary
 java.io.InputStream getData()
          Return the inputstream for the resource
 java.lang.String getFileName()
          Return the filename for the resource
 java.lang.String getId()
          Get the unique id (UUID) of this file
 java.util.Calendar getLastModified()
          Return the last modified date of the resource
 java.lang.String getMimeType()
          Return the mimetype of the resource
 org.springframework.web.multipart.MultipartFile getMultipartFile()
          This method returns the belonging MultipartFile
 java.lang.String getServerName()
          Return the servername on which the resource is stored.
 long getSize()
          Returns the size in bytes of the resource
 java.lang.String getURL()
          Return the URL that serves the file
 java.lang.String getURL(java.lang.String ownerUUID)
          Return the URL that serves the file for the given file owner
 boolean isPublic()
          Sets if the file resource is public or not
 boolean mayView(javax.servlet.http.HttpServletRequest request)
          This method is invoked when a not public file is requested.
 void setPublic(boolean isPublic)
          Sets whether this file is 'public'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 java.lang.String getId()
Get the unique id (UUID) of this file

Specified by:
getId in interface FileResource
Returns:
The id of this file

getData

public java.io.InputStream getData()
Return the inputstream for the resource

Specified by:
getData in interface FileResource
Returns:
InputStream of the resource

getFileName

public java.lang.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 java.util.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 java.lang.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 java.lang.String getServerName()
Return the servername on which the resource is stored.

Specified by:
getServerName in interface FileResource
Returns:

getURL

public java.lang.String getURL()
Return the URL that serves the file

Specified by:
getURL in interface FileResource
Returns:
URL that serves the file

getURL

public java.lang.String getURL(java.lang.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


Copyright © 2007-2011 GX Software BV. All Rights Reserved.