Package com.jalios.jcms.trash
Class TrashManager
java.lang.Object
com.jalios.jcms.trash.TrashManager
- All Implemented Interfaces:
JPropertiesListener
Manager of Trash related action and configuration.
- Since:
- jcms-10.0.5 / JCMS-8353
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of attribute indicating operation is related to final automatic trash deletion.static final StringName of property from which delay (in days) before automatic delete is read.static final StringName of property from which automatic delete after a specific duration is enabled or not.static final StringName of property from which automatic delete schedule is read (jdring cron syntax).static final StringName of property from which option to propose final delete (to end user) for trashable type is read (i.e.static final StringName of property from which trashable types is read (i.e.static final StringName of property from which untrashable types is read (i.e.static final Set<Class<? extends Publication>> Default configuration of trashable types (i.e.static final Set<Class<? extends Publication>> Default configuration of untrashable types (i.e. -
Method Summary
Modifier and TypeMethodDescriptionRetrieve the duration publications are kept in trash before being permanently deleted automatically (if auto delete is enabled).static TrashManagerRetrieve the TrashManager singleton intanceSet<Class<? extends Publication>> Retrieve publication class authorized to be put in trash.Set<Class<? extends Publication>> Retrieve publication class not authorized to be put in trash.booleanCheck if automatic delete is enabledbooleanCheck if final delete should be proposed to end user for enabledbooleanisTrashableClass(Class<? extends Publication> clazz) Check if an instance of the specified Publication class can be put in trashvoidpropertiesChange(JProperties properties) Invoked after properties have been modified in JCMS and save on disk.booleanproposeFinalDeleteAction(Publication pub, Member loggedMember) Check if final delete action should be proposed for the specified publication given current logged member.booleanCheck if Trash action should be proposed for the specified publication
-
Field Details
-
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:
-
PROP_AUTOMATIC_DELETE_ENABLED
Name of property from which automatic delete after a specific duration is enabled or not.- See Also:
-
PROP_AUTOMATIC_DELETE_DELAY
Name of property from which delay (in days) before automatic delete is read.- See Also:
-
PROP_AUTOMATIC_DELETE_SCHEDULE
Name of property from which automatic delete schedule is read (jdring cron syntax).- See Also:
-
PROP_TRASHABLE_TYPES
Name of property from which trashable types is read (i.e. types which can be put in trash).- See Also:
-
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:
-
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:
-
TRASHABLE_TYPES_DEFAULT
Default configuration of trashable types (i.e. types which can be put in trash). -
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 Details
-
getInstance
Retrieve the TrashManager singleton intance- Returns:
- the singleton instance
-
propertiesChange
Description copied from interface:JPropertiesListenerInvoked 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.getPropertiesorchannel.getProperty.- Specified by:
propertiesChangein 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
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
Retrieve publication class authorized to be put in trash.- Returns:
- a Set of Class, never return null.
-
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
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
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
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
-