Package org.ametys.cms.schedule
Class AbstractDeleteFilesSchedulable.DeleteFilesConfiguration
- java.lang.Object
-
- org.ametys.cms.schedule.AbstractDeleteFilesSchedulable.DeleteFilesConfiguration
-
- Enclosing class:
- AbstractDeleteFilesSchedulable
protected static class AbstractDeleteFilesSchedulable.DeleteFilesConfiguration extends Object
Inner class to store configuration for deletion.
-
-
Field Summary
Fields Modifier and Type Field Description private Instant_ageLimitprivate boolean_deleteEmptyFoldersprivate boolean_deleteRecursivelyprivate boolean_deleteRootprivate Path_rootPath
-
Constructor Summary
Constructors Constructor Description DeleteFilesConfiguration(Path rootPath)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandeleteEmptyFolders()When a folder is empty, do it needs to be deleted ?booleandeleteRecursively()Do the folders needs to be deleted recursively ?booleandeleteRoot()Do the root needs to be deleted or emptied ?InstantgetAgeLimit()Only delete files older than this instant.PathgetRootPath()Get the root folder or file to deletevoidsetAgeLimit(Instant ageLimit)Set the age limit of files to delete.voidsetDeleteEmptyFolders(boolean deleteEmptyFolders)Set totrueto delete empty folders.voidsetDeleteRecursively(boolean deleteRecursively)Set totrueto delete files recursively.voidsetDeleteRoot(boolean deleteRoot)Set totrueto delete the root folder.
-
-
-
Field Detail
-
_deleteRoot
private boolean _deleteRoot
-
_deleteRecursively
private boolean _deleteRecursively
-
_deleteEmptyFolders
private boolean _deleteEmptyFolders
-
-
Constructor Detail
-
DeleteFilesConfiguration
public DeleteFilesConfiguration(Path rootPath)
Constructor. Default values: - ageLimit = now - deleteRoot = false - deleteRecursively = true - deleteEmptyFolders = true- Parameters:
rootPath- The root path for deletion
-
-
Method Detail
-
getRootPath
public Path getRootPath()
Get the root folder or file to delete- Returns:
- a Directory or a file, that will be deleted/emptied
-
setDeleteRoot
public void setDeleteRoot(boolean deleteRoot)
Set totrueto delete the root folder.- Parameters:
deleteRoot-trueto delete the root folde
-
deleteRoot
public boolean deleteRoot()
Do the root needs to be deleted or emptied ?- Returns:
trueto delete the root folder
-
setDeleteRecursively
public void setDeleteRecursively(boolean deleteRecursively)
Set totrueto delete files recursively.- Parameters:
deleteRecursively-trueto delete files recursively
-
deleteRecursively
public boolean deleteRecursively()
Do the folders needs to be deleted recursively ?- Returns:
trueto delete files recursively
-
setDeleteEmptyFolders
public void setDeleteEmptyFolders(boolean deleteEmptyFolders)
Set totrueto delete empty folders.- Parameters:
deleteEmptyFolders-trueto delete empty folders
-
deleteEmptyFolders
public boolean deleteEmptyFolders()
When a folder is empty, do it needs to be deleted ?- Returns:
trueto delete empty folders
-
setAgeLimit
public void setAgeLimit(Instant ageLimit)
Set the age limit of files to delete.- Parameters:
ageLimit- The age limit
-
getAgeLimit
public Instant getAgeLimit()
Only delete files older than this instant.- Returns:
- instant, only older files will be deleted
-
-