Class UploadedFileHelper
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.filestorage.UploadedFileHelper
-
public class UploadedFileHelper extends Object
A helper object to handle the mundane details of dealing with uploaded files in the model.
-
-
Constructor Summary
Constructors Constructor Description UploadedFileHelper(FileStorage fileStorage, WebappDaoFactory wadf, javax.servlet.ServletContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachFileToSubject(FileInfo fileInfo, String subjectUri, String predicateUri)FileInfocreateFile(String filename, String mimeType, InputStream inputStream)We have a filename, a mimetype, and some content.voidremoveMainImage(Individual entity)If this Individual has an image, remove it and the thumbnail.voidremoveUploadedFile(String subjectUri, String predicateUri, String fileUri)voidsetImagesOnEntity(String entityUri, FileInfo mainInfo, FileInfo thumbInfo)Record this image file and thumbnail on this entity.voidsetPublicFileName(FileInfo fileInfo, String uploadedFileName)
-
-
-
Constructor Detail
-
UploadedFileHelper
public UploadedFileHelper(FileStorage fileStorage, WebappDaoFactory wadf, javax.servlet.ServletContext ctx)
-
-
Method Detail
-
createFile
public FileInfo createFile(String filename, String mimeType, InputStream inputStream) throws FileAlreadyExistsException, IOException
We have a filename, a mimetype, and some content. Create a file in the file storage system and in the model.- Returns:
- information about the newly created file.
- Throws:
FileAlreadyExistsExceptionIOException
-
setImagesOnEntity
public void setImagesOnEntity(String entityUri, FileInfo mainInfo, FileInfo thumbInfo)
Record this image file and thumbnail on this entity.
-
removeMainImage
public void removeMainImage(Individual entity)
If this Individual has an image, remove it and the thumbnail. If the image file and/or the thumbnail file have no other references, delete them. Note: after this operation, entity is stale.
-
removeUploadedFile
public void removeUploadedFile(String subjectUri, String predicateUri, String fileUri)
-
attachFileToSubject
public void attachFileToSubject(FileInfo fileInfo, String subjectUri, String predicateUri)
-
-