@Named @ApplicationScoped public class FileManager extends Object
| Constructor and Description |
|---|
FileManager() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addImage(String fileName,
org.richfaces.model.UploadedFile file)
This method invoked after user upload new image
|
void |
create()
Method, that invoked at startup application.
|
void |
deleteImage(ImageEvent ie)
This method observes
Constants.IMAGE_DELETED_EVENT and invoked after the user delete her image This method
delete image and all thumbnails of this image from the disk |
File |
getFileByAbsolutePath(String path)
This method used to get reference to the file with the absolute path
|
File |
getFileByPath(String path)
This method used to get reference to the file with the specified relative path to the uploadRoot field
|
boolean |
isDirectoryPresent(String path)
This utility method used to determine if the directory with specified relative path exist
|
boolean |
isFilePresent(String path)
This utility method used to determine if the file with specified relative path exist
|
void |
onAlbumAdded(AlbumEvent ae)
This method observes
ALBUM_ADDED_EVENT and invoked after the user add new album This method add album
directory to the disk |
void |
onAlbumDeleted(AlbumEvent ae)
This method observes
Constants.ALBUM_DELETED_EVENT and invoked after the user delete album. |
void |
onShelfAdded(ShelfEvent se)
This method observes
SHELF_ADDED_EVENT and invoked after the user add new shelf This method add shelf
directory to the disk |
void |
onShelfDeleted(ShelfEvent se)
This method observes
Constants.SHELF_DELETED_EVENT and invoked after the user delete her shelf This method
delete shelf directory from the disk |
void |
onUserDeleted(SimpleEvent se)
This method observes
Constants.USER_DELETED_EVENT and invoked after the user was deleted(used in livedemo to
prevent flooding) This method delete user directory from the disk |
void |
renameAlbumDirectory(AlbumEvent ae)
This method observes
Constants.ALBUM_DRAGGED_EVENT and invoked after the user dragged album form one shelf
to the another. |
void |
renameImageFile(ImageEvent ie)
This method observes
Constants.IMAGE_DRAGGED_EVENT and invoked after the user dragged image form one album
to the another. |
boolean |
saveAvatar(File avatarData,
User user)
This method invoked after user set new avatar icon
|
String |
transformPath(String target,
String substitute)
This method used to transform one path to another.
|
@PostConstruct public void create()
public File getFileByPath(String path)
path - - relative path of filepublic void onAlbumDeleted(@Observes
AlbumEvent ae)
Constants.ALBUM_DELETED_EVENT and invoked after the user delete album. This method
delete album directory from the diskalbum - - deleted albumpath - - relative path of the album directorypublic void onShelfDeleted(@Observes
ShelfEvent se)
Constants.SHELF_DELETED_EVENT and invoked after the user delete her shelf This method
delete shelf directory from the diskshelf - - deleted shelfpath - - relative path of the shelf directorypublic void onUserDeleted(@Observes
SimpleEvent se)
Constants.USER_DELETED_EVENT and invoked after the user was deleted(used in livedemo to
prevent flooding) This method delete user directory from the diskuser - - deleted userpath - - relative path of the user directorypublic void onShelfAdded(@Observes
ShelfEvent se)
SHELF_ADDED_EVENT and invoked after the user add new shelf This method add shelf
directory to the diskshelf - - added shelfpublic void onAlbumAdded(@Observes
AlbumEvent ae)
ALBUM_ADDED_EVENT and invoked after the user add new album This method add album
directory to the diskalbum - - added albumpublic boolean saveAvatar(File avatarData, User user)
avatarData - - avatar fileuser - - user, that add avatarpublic void deleteImage(@Observes
ImageEvent ie)
Constants.IMAGE_DELETED_EVENT and invoked after the user delete her image This method
delete image and all thumbnails of this image from the diskimage - - deleted imagepath - - relative path of the image filepublic boolean addImage(String fileName, org.richfaces.model.UploadedFile file) throws IOException
fileName - - new relative path to the image filetempFilePath - - absolute path to uploaded imageIOExceptionpublic String transformPath(String target, String substitute)
target - - path to transformsubstitute - - new 'addon' to the pathpublic File getFileByAbsolutePath(String path)
path - - absolute path of filepublic boolean isDirectoryPresent(String path)
path - - absolute path of directorypublic boolean isFilePresent(String path)
path - - absolute path of filepublic void renameAlbumDirectory(@Observes
AlbumEvent ae)
Constants.ALBUM_DRAGGED_EVENT and invoked after the user dragged album form one shelf
to the another. This method rename album directory to the new directoryalbum - - dragged albumpathOld - - old path of album directorypublic void renameImageFile(@Observes
ImageEvent ie)
Constants.IMAGE_DRAGGED_EVENT and invoked after the user dragged image form one album
to the another. This method rename image file and all thumbnails to the new nameimage - - dragged imagepathOld - - old path of image fileCopyright © 2013 JBoss by Red Hat. All Rights Reserved.