RichFaces Photoalbum 4.3.5.Final

org.richfaces.photoalbum.manager
Class FileManager

java.lang.Object
  extended by org.richfaces.photoalbum.manager.FileManager

@Named
@ApplicationScoped
public class FileManager
extends Object


Constructor Summary
FileManager()
           
 
Method Summary
 boolean addImage(String fileName, FileHandler fileHandler)
          This method invoked after user upload new image
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileManager

public FileManager()
Method Detail

getFileByPath

public File getFileByPath(String path)
This method used to get reference to the file with the specified relative path to the uploadRoot field

Parameters:
path - - relative path of file
Returns:
File reference

onAlbumDeleted

public void onAlbumDeleted(@Observes
                           AlbumEvent ae)
This method observes Constants.ALBUM_DELETED_EVENT and invoked after the user delete album. This method delete album directory from the disk

Parameters:
album - - deleted album
path - - relative path of the album directory

onShelfDeleted

public void onShelfDeleted(@Observes
                           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

Parameters:
shelf - - deleted shelf
path - - relative path of the shelf directory

onUserDeleted

public void onUserDeleted(@Observes
                          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

Parameters:
user - - deleted user
path - - relative path of the user directory

onShelfAdded

public void onShelfAdded(@Observes
                         ShelfEvent se)
This method observes SHELF_ADDED_EVENT and invoked after the user add new shelf This method add shelf directory to the disk

Parameters:
shelf - - added shelf

onAlbumAdded

public void onAlbumAdded(@Observes
                         AlbumEvent ae)
This method observes ALBUM_ADDED_EVENT and invoked after the user add new album This method add album directory to the disk

Parameters:
album - - added album

saveAvatar

public boolean saveAvatar(File avatarData,
                          User user)
This method invoked after user set new avatar icon

Parameters:
avatarData - - avatar file
user - - user, that add avatar

deleteImage

public void deleteImage(@Observes
                        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

Parameters:
image - - deleted image
path - - relative path of the image file

addImage

public boolean addImage(String fileName,
                        FileHandler fileHandler)
                 throws IOException
This method invoked after user upload new image

Parameters:
fileName - - new relative path to the image file
tempFilePath - - absolute path to uploaded image
Throws:
IOException

transformPath

public String transformPath(String target,
                            String substitute)
This method used to transform one path to another. For example you want get path of the file with dimensioms 80 of image with path /user/1/2/image.jpg, this method return /user/1/2/image_substitute.jpg

Parameters:
target - - path to transform
substitute - - new 'addon' to the path

getFileByAbsolutePath

public File getFileByAbsolutePath(String path)
This method used to get reference to the file with the absolute path

Parameters:
path - - absolute path of file
Returns:
File reference

isDirectoryPresent

public boolean isDirectoryPresent(String path)
This utility method used to determine if the directory with specified relative path exist

Parameters:
path - - absolute path of directory
Returns:
File reference

isFilePresent

public boolean isFilePresent(String path)
This utility method used to determine if the file with specified relative path exist

Parameters:
path - - absolute path of file
Returns:
File reference

renameAlbumDirectory

public void renameAlbumDirectory(@Observes
                                 AlbumEvent ae)
This method observes 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 directory

Parameters:
album - - dragged album
pathOld - - old path of album directory

renameImageFile

public void renameImageFile(@Observes
                            ImageEvent ie)
This method observes 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 name

Parameters:
image - - dragged image
pathOld - - old path of image file

RichFaces Photoalbum 4.3.5.Final

Copyright © 2014 JBoss by Red Hat. All Rights Reserved.