Package com.jalios.jcms
Class AssociatedFilesManager
- java.lang.Object
 - 
- com.jalios.jcms.AssociatedFilesManager
 
 
- 
public class AssociatedFilesManager extends java.lang.ObjectManager class to deal with associated files 
- 
- 
Constructor Summary
Constructors Constructor Description AssociatedFilesManager() 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAssociatedFilesEventListener(AssociatedFilesEventListener listener)java.io.FileaddFile(java.io.File file, java.io.File associatedFile)Add a associatedFileto aFile.java.io.FileaddFile(java.io.File file, java.io.File associatedFile, boolean replace)Add a associatedFileto aFile.java.io.FileaddFile(java.io.File file, java.lang.String associatedFilename)Add a associatedFileto aFile.java.io.FileaddFile(java.io.File file, java.lang.String associatedFilename, boolean replace)Add a associatedFileto aFile.voiddeleteAllAssociatedFile(java.io.File fileDocument)voidfireAddEvent(java.io.File file, java.io.File associatedFile)voidfireDeleteEvent(java.io.File file, java.io.File associatedFile)voidfireUpdateEvent(java.io.File file, java.io.File associatedFile)java.io.FilegetAssociatedDirectory(FileDocument fileDoc)Returns theFilewhich is the directory in which associated files are storedjava.io.FilegetAssociatedDirectory(java.io.File file)Returns theFilewhich is the directory in which associated files are storedjava.io.FilegetAssociatedDirectory(java.io.File file, boolean createMissingDir)Returns theFilewhich is the directory in which associated files are storedjava.io.FilegetAssociatedFile(java.io.File file, java.lang.String filename)Returns theFileassociated with aFilewith provided namejava.util.List<AssociatedFilesEventListener>getAssociatedFilesEventListener()java.io.FilegetFile(java.io.File file, java.lang.String filename)java.util.Set<java.io.File>getFiles(java.io.File file)Retrieve all associated files of theFilestatic AssociatedFilesManagergetInstance()returns the singleton instancejava.io.FilegetOriginatedFile(java.io.File file)voidremoveAllAssociatedFilesEventListener()voidremoveAssociatedFilesEventListener(AssociatedFilesEventListener listener)voidremoveFile(java.io.File file, java.io.File associatedFile)RemoveFileassociated to aFilevoidremoveFile(java.io.File file, java.lang.String filename)RemoveFileassociated to aFile 
 - 
 
- 
- 
Method Detail
- 
getInstance
public static AssociatedFilesManager getInstance()
returns the singleton instance- Returns:
 - the singleton instance
 
 
- 
getFiles
public java.util.Set<java.io.File> getFiles(java.io.File file)
Retrieve all associated files of theFile- Parameters:
 file- theFile. It must not be a directory- Returns:
 - All associated files of the 
File 
 
- 
addFile
public java.io.File addFile(java.io.File file, java.io.File associatedFile, boolean replace) throws java.io.IOExceptionAdd a associatedFileto aFile. If the providedFileis not in the correct directory, the file is moved into correct directory and rename if replace is false.- Parameters:
 file- theFile. It must not be a directoryassociatedFile- theFilereplace- true if a associated file with the same name should be overwrite or not- Returns:
 - the moved and/or renamed 
File - Throws:
 java.io.IOException- Exception if any problem on file
 
- 
addFile
public java.io.File addFile(java.io.File file, java.io.File associatedFile) throws java.io.IOExceptionAdd a associatedFileto aFile. If the providedFileis not in the correct directory, the file is moved into correct directory and rename if needed.- Parameters:
 file- theFile. It must not be a directoryassociatedFile- theFile- Returns:
 - the moved and/or renamed 
File - Throws:
 java.io.IOException- Exception if any problem on file
 
- 
addFile
public java.io.File addFile(java.io.File file, java.lang.String associatedFilename) throws java.io.IOExceptionAdd a associatedFileto aFile. If theFilealready exists in associated directory, it will be overwrite.- Parameters:
 file- theFile. It must not be a directoryassociatedFilename- the file name- Returns:
 - the associated 
File - Throws:
 java.io.IOException- Exception if any problem on file
 
- 
addFile
public java.io.File addFile(java.io.File file, java.lang.String associatedFilename, boolean replace) throws java.io.IOExceptionAdd a associatedFileto aFile.- Parameters:
 file- theFile. It must not be a directoryassociatedFilename- the file namereplace- true if a associated file with the same name should be overwrite or not- Returns:
 - the associated 
File - Throws:
 java.io.IOException- Exception if any problem on file
 
- 
removeFile
public void removeFile(java.io.File file, java.lang.String filename)RemoveFileassociated to aFile- Parameters:
 file- theFile. It must not be a directoryfilename- the name of the associated file
 
- 
removeFile
public void removeFile(java.io.File file, java.io.File associatedFile)RemoveFileassociated to aFile- Parameters:
 file- theFile. It must not be a directoryassociatedFile- the associatedFile
 
- 
getAssociatedFile
public java.io.File getAssociatedFile(java.io.File file, java.lang.String filename)Returns theFileassociated with aFilewith provided name- Parameters:
 file- theFilefilename- the name of the associated associatedFile- Returns:
 - the 
Fileassociated with aFilewith provided name 
 
- 
getAssociatedDirectory
public java.io.File getAssociatedDirectory(FileDocument fileDoc)
Returns theFilewhich is the directory in which associated files are stored- Parameters:
 fileDoc- theFileDocument- Returns:
 - the 
Filewhich is the directory in which associated files are stored 
 
- 
getAssociatedDirectory
public java.io.File getAssociatedDirectory(java.io.File file)
Returns theFilewhich is the directory in which associated files are stored- Parameters:
 file- theFile- Returns:
 - the 
Filewhich is the directory in which associated files are stored 
 
- 
getAssociatedDirectory
public java.io.File getAssociatedDirectory(java.io.File file, boolean createMissingDir)Returns theFilewhich is the directory in which associated files are stored- Parameters:
 file- theFilecreateMissingDir- true if the directory should be created- Returns:
 - the 
Filewhich is the directory in which associated files are stored 
 
- 
fireAddEvent
public void fireAddEvent(java.io.File file, java.io.File associatedFile) 
- 
fireDeleteEvent
public void fireDeleteEvent(java.io.File file, java.io.File associatedFile) 
- 
fireUpdateEvent
public void fireUpdateEvent(java.io.File file, java.io.File associatedFile) 
- 
addAssociatedFilesEventListener
public void addAssociatedFilesEventListener(AssociatedFilesEventListener listener)
 
- 
removeAssociatedFilesEventListener
public void removeAssociatedFilesEventListener(AssociatedFilesEventListener listener)
 
- 
getAssociatedFilesEventListener
public java.util.List<AssociatedFilesEventListener> getAssociatedFilesEventListener()
 
- 
removeAllAssociatedFilesEventListener
public void removeAllAssociatedFilesEventListener()
 
- 
deleteAllAssociatedFile
public void deleteAllAssociatedFile(java.io.File fileDocument) throws java.io.IOException- Throws:
 java.io.IOException
 
- 
getFile
public java.io.File getFile(java.io.File file, java.lang.String filename) 
- 
getOriginatedFile
public java.io.File getOriginatedFile(java.io.File file)
 
 - 
 
 -