Class TrashManager

java.lang.Object
com.jalios.jcms.trash.TrashManager
All Implemented Interfaces:
JPropertiesListener

public class TrashManager extends Object implements JPropertiesListener
Manager of Trash related action and configuration.
Since:
jcms-10.0.5 / JCMS-8353
  • Field Details

    • IS_AUTOMATIC_TRASH_DELETE

      public static final 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:
    • PROP_AUTOMATIC_DELETE_ENABLED

      public static final String 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

      public static final String PROP_AUTOMATIC_DELETE_DELAY
      Name of property from which delay (in days) before automatic delete is read.
      See Also:
    • PROP_AUTOMATIC_DELETE_SCHEDULE

      public static final String PROP_AUTOMATIC_DELETE_SCHEDULE
      Name of property from which automatic delete schedule is read (jdring cron syntax).
      See Also:
    • PROP_TRASHABLE_TYPES

      public static final String 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

      public static final 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:
    • PROP_FINAL_DELETE_ENABLED

      public static final 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:
    • TRASHABLE_TYPES_DEFAULT

      public static final Set<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 Set<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 Details

    • 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 or channel.getProperty.

      Specified by:
      propertiesChange in interface JPropertiesListener
      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 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 Set<Class<? extends Publication>> getTrashableTypes()
      Retrieve publication class authorized to be put in trash.
      Returns:
      a Set of Class, never return null.
    • getUntrashableTypes

      public Set<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(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 verified
      loggedMember - the current
      Returns:
      true if final delete action should be proposed, false otherwise