org.opencms.scheduler.jobs
Class CmsDeleteExpiredResourcesJob

java.lang.Object
  extended by org.opencms.scheduler.jobs.CmsDeleteExpiredResourcesJob
All Implemented Interfaces:
I_CmsScheduledJob

public class CmsDeleteExpiredResourcesJob
extends java.lang.Object
implements I_CmsScheduledJob

A schedulable OpenCms job to delete expired resources.

The user to execute the process should have have access to the required "Workplace manager" role.

The "Offline" project has to be configured for this job because the operations cannot be performed in the "Online" project.

Job parameters:

expirationdays={Number/Integer}
Amount of days a resource has to be expired to be deleted.
resourcetypes={csv list}
Comma separated list of resource type names to specify the types of expired resources that may be deleted. If left out, expired resources of all types will be deleted. .
folder={csv list}
Allows to specify a comma separated list of folders in which all expired resources will be deleted. If omitted "/" will be taken as single folder for this operation.

The property "delete.expired" (CmsPropertyDefinition.PROPERTY_DELETE_EXPIRED) may be used to override the global setting of the parameter expirationdays. A value of "never", "false" or "none" will prevent resources from being deleted. Other values are "true" (default) or the amount of days a resource has to be expired for qualification of deletion.

Only published / unchanged files will be processed. Anything with unpublished changes will not be touched by the job.

Folders with expiration dates are ignored by default. Only if the scheduler parameter "resourcetypes" contains "folder" a folder that has been expired will be deleted (with all contained resources).

Since:
7.5.0
Version:
$Revision: 1.3 $
Author:
Achim Westermann

Field Summary
static java.lang.String PARAM_EXPIRATIONSDAYS
          Name of the parameter where to configure the amount of days a resource has to be expired before deletion.
static java.lang.String PARAM_FOLDER
          Name of the parameter where to configure the folder below which the operation will be done.
static java.lang.String PARAM_RESOURCETYPES
          Name of the parameter where to configure the resource types for resources to delete if expired.
static java.lang.String PROPERTY_VALUE_DELETE_EXPIRED_NEVER
          Setting for the CmsPropertyDefinition.PROPERTY_DELETE_EXPIRED to disallow deletion.
static java.lang.String PROPERTY_VALUE_DELETE_EXPIRED_NONE
          Setting for the CmsPropertyDefinition.PROPERTY_DELETE_EXPIRED to disallow deletion.
 
Constructor Summary
CmsDeleteExpiredResourcesJob()
           
 
Method Summary
 java.lang.String launch(CmsObject cms, java.util.Map parameters)
          This method will be called when this scheduled job is executed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_EXPIRATIONSDAYS

public static final java.lang.String PARAM_EXPIRATIONSDAYS
Name of the parameter where to configure the amount of days a resource has to be expired before deletion.

See Also:
Constant Field Values

PARAM_RESOURCETYPES

public static final java.lang.String PARAM_RESOURCETYPES
Name of the parameter where to configure the resource types for resources to delete if expired.

See Also:
Constant Field Values

PARAM_FOLDER

public static final java.lang.String PARAM_FOLDER
Name of the parameter where to configure the folder below which the operation will be done.

See Also:
Constant Field Values

PROPERTY_VALUE_DELETE_EXPIRED_NEVER

public static final java.lang.String PROPERTY_VALUE_DELETE_EXPIRED_NEVER
Setting for the CmsPropertyDefinition.PROPERTY_DELETE_EXPIRED to disallow deletion.

See Also:
Constant Field Values

PROPERTY_VALUE_DELETE_EXPIRED_NONE

public static final java.lang.String PROPERTY_VALUE_DELETE_EXPIRED_NONE
Setting for the CmsPropertyDefinition.PROPERTY_DELETE_EXPIRED to disallow deletion.

See Also:
Constant Field Values
Constructor Detail

CmsDeleteExpiredResourcesJob

public CmsDeleteExpiredResourcesJob()
Method Detail

launch

public java.lang.String launch(CmsObject cms,
                               java.util.Map parameters)
                        throws java.lang.Exception
Description copied from interface: I_CmsScheduledJob
This method will be called when this scheduled job is executed.

Depending on the configuration of this job, a new instance of the configured class will be instantiated every time the job is launched, or a new instance will be generated only the first time the job is launched, and re-used afterwards.

The result String will be written to the OpenCms logfile in the org.opencms.scheduler.CmsScheduleManager channel, on INFO log level.

Specified by:
launch in interface I_CmsScheduledJob
Parameters:
cms - will be initialized with the configured users cms context
parameters - the configured parameters
Returns:
a String that will be written to the OpenCms logfile
Throws:
java.lang.Exception - if something goes wrong
See Also:
I_CmsScheduledJob.launch(org.opencms.file.CmsObject, java.util.Map)