Package com.jalios.jcms.trash
Class TrashManager
- java.lang.Object
-
- com.jalios.jcms.trash.TrashManager
-
- All Implemented Interfaces:
JPropertiesListener
public class TrashManager extends java.lang.Object implements JPropertiesListener
Manager of Trash related action and configuration.- Since:
- jcms-10.0.5 / JCMS-8353
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
IS_AUTOMATIC_TRASH_DELETE
Name of attribute indicating operation is related to final automatic trash deletion.static java.lang.String
PROP_AUTOMATIC_DELETE_DELAY
Name of property from which delay (in days) before automatic delete is read.static java.lang.String
PROP_AUTOMATIC_DELETE_ENABLED
Name of property from which automatic delete after a specific duration is enabled or not.static java.lang.String
PROP_AUTOMATIC_DELETE_SCHEDULE
Name of property from which automatic delete schedule is read (jdring cron syntax).static java.lang.String
PROP_FINAL_DELETE_ENABLED
Name of property from which option to propose final delete (to end user) for trashable type is read (i.e.static java.lang.String
PROP_TRASHABLE_TYPES
Name of property from which trashable types is read (i.e.static java.lang.String
PROP_UNTRASHABLE_TYPES
Name of property from which untrashable types is read (i.e.static java.util.Set<java.lang.Class<? extends Publication>>
TRASHABLE_TYPES_DEFAULT
Default configuration of trashable types (i.e.static java.util.Set<java.lang.Class<? extends Publication>>
UNTRASHABLE_TYPES_DEFAULT
Default configuration of untrashable types (i.e.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.time.Duration
getAutoDeleteDelay()
Retrieve the duration publications are kept in trash before being permanently deleted automatically (if auto delete is enabled).static TrashManager
getInstance()
Retrieve the TrashManager singleton intancejava.util.Set<java.lang.Class<? extends Publication>>
getTrashableTypes()
Retrieve publication class authorized to be put in trash.java.util.Set<java.lang.Class<? extends Publication>>
getUntrashableTypes()
Retrieve publication class not authorized to be put in trash.boolean
isAutoDeleteEnabled()
Check if automatic delete is enabledboolean
isFinalDeleteEnabled()
Check if final delete should be proposed to end user for enabledboolean
isTrashableClass(java.lang.Class<? extends Publication> clazz)
Check if an instance of the specified Publication class can be put in trashvoid
propertiesChange(JProperties properties)
Invoked after properties have been modified in JCMS and save on disk.boolean
proposeFinalDeleteAction(Publication pub, Member loggedMember)
Check if final delete action should be proposed for the specified publication given current logged member.boolean
proposeTrashAction(Publication pub)
Check if Trash action should be proposed for the specified publication
-
-
-
Field Detail
-
IS_AUTOMATIC_TRASH_DELETE
public static final java.lang.String IS_AUTOMATIC_TRASH_DELETE
Name of attribute indicating operation is related to final automatic trash deletion. Added :- as QueryHandler attribute when retrieve all content to delete automatically (since JCMS-8988)
- in context map during
performDelete()
to indicate delete is being automatically after a specific period in the trash.
- See Also:
- Constant Field Values
-
PROP_AUTOMATIC_DELETE_ENABLED
public static final java.lang.String PROP_AUTOMATIC_DELETE_ENABLED
Name of property from which automatic delete after a specific duration is enabled or not.- See Also:
- Constant Field Values
-
PROP_AUTOMATIC_DELETE_DELAY
public static final java.lang.String PROP_AUTOMATIC_DELETE_DELAY
Name of property from which delay (in days) before automatic delete is read.- See Also:
- Constant Field Values
-
PROP_AUTOMATIC_DELETE_SCHEDULE
public static final java.lang.String PROP_AUTOMATIC_DELETE_SCHEDULE
Name of property from which automatic delete schedule is read (jdring cron syntax).- See Also:
- Constant Field Values
-
PROP_TRASHABLE_TYPES
public static final java.lang.String PROP_TRASHABLE_TYPES
Name of property from which trashable types is read (i.e. types which can be put in trash).- See Also:
- Constant Field Values
-
PROP_UNTRASHABLE_TYPES
public static final java.lang.String PROP_UNTRASHABLE_TYPES
Name of property from which untrashable types is read (i.e. types which cannot be put in trash).- Since:
- jcms-10.0.7 / JCMS-9314
- See Also:
- Constant Field Values
-
PROP_FINAL_DELETE_ENABLED
public static final java.lang.String PROP_FINAL_DELETE_ENABLED
Name of property from which option to propose final delete (to end user) for trashable type is read (i.e. types which can be put in trash).If true, final delete action will be displayed to all users. If false, final delete action will only be displayed to administrators.
- See Also:
- Constant Field Values
-
TRASHABLE_TYPES_DEFAULT
public static final java.util.Set<java.lang.Class<? extends Publication>> TRASHABLE_TYPES_DEFAULT
Default configuration of trashable types (i.e. types which can be put in trash).
-
UNTRASHABLE_TYPES_DEFAULT
public static final java.util.Set<java.lang.Class<? extends Publication>> UNTRASHABLE_TYPES_DEFAULT
Default configuration of untrashable types (i.e. types which cannot be put in trash).- Since:
- jcms-10.0.7 / JCMS-9314
-
-
Method Detail
-
getInstance
public static TrashManager getInstance()
Retrieve the TrashManager singleton intance- Returns:
- the singleton instance
-
propertiesChange
public void propertiesChange(JProperties properties)
Description copied from interface:JPropertiesListener
Invoked after properties have been modified in JCMS and save on disk.You cannot alter the value received in parameters.
Note that properties parameter may be null, a limited set of site properties, or all site properties.
To check that a property has been modified, reload the "current" property instead using
channel.getProperties
orchannel.getProperty
.- Specified by:
propertiesChange
in interfaceJPropertiesListener
- Parameters:
properties
- the properties which have been submitted to change
-
isAutoDeleteEnabled
public boolean isAutoDeleteEnabled()
Check if automatic delete is enabled- Returns:
- true if enabled, false otherwise
-
getAutoDeleteDelay
public java.time.Duration getAutoDeleteDelay()
Retrieve the duration publications are kept in trash before being permanently deleted automatically (if auto delete is enabled).- Returns:
- a duration, never return null
-
getTrashableTypes
public java.util.Set<java.lang.Class<? extends Publication>> getTrashableTypes()
Retrieve publication class authorized to be put in trash.- Returns:
- a Set of Class, never return null.
-
getUntrashableTypes
public java.util.Set<java.lang.Class<? extends Publication>> getUntrashableTypes()
Retrieve publication class not authorized to be put in trash.- Returns:
- a Set of Class, never return null.
- Since:
- jcms-10.0.7 / JCMS-9314
-
isTrashableClass
public boolean isTrashableClass(java.lang.Class<? extends Publication> clazz)
Check if an instance of the specified Publication class can be put in trash- Parameters:
clazz
- a publication subclass class- Returns:
- true if it can be put in trash, false if it cannot
-
isFinalDeleteEnabled
public boolean isFinalDeleteEnabled()
Check if final delete should be proposed to end user for enabled- Returns:
- true if to propose , false otherwise
-
proposeTrashAction
public boolean proposeTrashAction(Publication pub)
Check if Trash action should be proposed for the specified publication- Parameters:
pub
- the Publication for which trash action display is verified- Returns:
- true if Trash action will be displayed, false otherwsie
-
proposeFinalDeleteAction
public boolean proposeFinalDeleteAction(Publication pub, Member loggedMember)
Check if final delete action should be proposed for the specified publication given current logged member.- Parameters:
pub
- the Publication for which final delete action display is verifiedloggedMember
- the current- Returns:
- true if final delete action should be proposed, false otherwise
-
-