public class DestructionTimeController extends java.lang.Object implements InputParamController, java.io.Serializable
Let controlling the destruction time of all jobs managed by a UWS. Thus it is possible to set a default and a maximum value. Moreover you can indicate whether the destruction time of jobs can be modified by the user or not.
Notes:
The logic of the destruction time is set in this class. Here it is:
Modifier and Type | Class and Description |
---|---|
static class |
DestructionTimeController.DateField
Represents a date/time field.
|
Modifier and Type | Field and Description |
---|---|
protected boolean |
allowModification
Indicates whether the destruction time of jobs can be modified.
|
protected int |
defaultInterval
The default interval from the initialization to the destruction of the concerned job.
|
protected DestructionTimeController.DateField |
defaultIntervalField
The date-time field on which the default interval applies.
|
protected java.util.Date |
defaultTime
The default destruction time.
|
protected int |
maxInterval
The maximum interval from the initialization to the destruction of the concerned job.
|
protected DestructionTimeController.DateField |
maxIntervalField
The date-time field on which the maximum interval applies.
|
protected java.util.Date |
maxTime
The maximum destruction time.
|
static int |
NO_INTERVAL
Default value of an interval: a null interval.
|
Constructor and Description |
---|
DestructionTimeController() |
Modifier and Type | Method and Description |
---|---|
boolean |
allowModification()
Tells whether the destruction time of any managed job can be modified.
|
void |
allowModification(boolean allowModification)
Lets indicating whether the destruction time of any managed job can be modified.
|
java.lang.Object |
check(java.lang.Object value)
Checks the value of the controlled parameter and builds a new object from this value.
|
java.lang.Object |
getDefault()
Returns the default value of the controlled parameter.
|
int |
getDefaultDestructionInterval()
Gets the default interval value.
|
java.util.Date |
getDefaultDestructionTime()
Gets the default destruction time: either computed with an interval of time or obtained directly by a default destruction time.
|
DestructionTimeController.DateField |
getDefaultIntervalField()
Gets the date-time field of the default interval.
|
int |
getMaxDestructionInterval()
Gets the maximum interval value.
|
java.util.Date |
getMaxDestructionTime()
Gets the maximum destruction time: either computed with an interval of time or obtained directly by a maximum destruction time.
|
DestructionTimeController.DateField |
getMaxIntervalField()
Gets the date-time field of the maximum interval.
|
void |
setDefaultDestructionInterval(int defaultDestructionInterval)
Sets the default interval in minutes from the initialization to the destruction of the concerned job.
|
void |
setDefaultDestructionInterval(int defaultDestructionInterval,
DestructionTimeController.DateField timeField)
Sets the default interval (in the given unit) from the initialization to the destruction of the concerned job.
|
void |
setDefaultDestructionTime(java.util.Date defaultDestructionTime)
Sets the default destruction time.
|
void |
setMaxDestructionInterval(int maxDestructionInterval)
Sets the maximum interval in minutes from the initialization to the destruction of the concerned job.
|
void |
setMaxDestructionInterval(int maxDestructionInterval,
DestructionTimeController.DateField timeField)
Sets the maximum interval (in the given unit) from the initialization to the destruction of the concerned job.
|
void |
setMaxDestructionTime(java.util.Date maxDestructionTime)
Sets the maximum destruction time.
|
public static final int NO_INTERVAL
protected java.util.Date defaultTime
protected DestructionTimeController.DateField defaultIntervalField
protected int defaultInterval
protected java.util.Date maxTime
protected DestructionTimeController.DateField maxIntervalField
protected int maxInterval
protected boolean allowModification
public java.lang.Object check(java.lang.Object value) throws UWSException
InputParamController
Checks the value of the controlled parameter and builds a new object from this value.
check
in interface InputParamController
value
- Parameter value to check.UWSException
- If the given value is strongly incorrect.public java.lang.Object getDefault()
InputParamController
getDefault
in interface InputParamController
public final java.util.Date getDefaultDestructionTime()
public final void setDefaultDestructionTime(java.util.Date defaultDestructionTime)
Sets the default destruction time.
Note:
If there was a default interval, it is reset and so the given destruction time will be used by getDefaultDestructionTime()
.
defaultDestructionTime
- The default destruction time to set (null means jobs may stay forever).public final int getDefaultDestructionInterval()
Gets the default interval value.
Note: To get the corresponding unit, use getDefaultIntervalField()
and Enum.name()
.
public final DestructionTimeController.DateField getDefaultIntervalField()
public final void setDefaultDestructionInterval(int defaultDestructionInterval)
Sets the default interval in minutes from the initialization to the destruction of the concerned job.
Note:
If there was a default destruction time, it is reset and so the given interval will be used by getDefaultDestructionTime()
.
defaultDestructionInterval
- The default destruction interval (NO_INTERVAL
, 0 or a negative value mean the job may stay forever).setDefaultDestructionInterval(int, DateField)
public final void setDefaultDestructionInterval(int defaultDestructionInterval, DestructionTimeController.DateField timeField)
Sets the default interval (in the given unit) from the initialization to the destruction of the concerned job.
Note:
If there was a default destruction time, it is reset and so the given interval will be used by getDefaultDestructionTime()
.
defaultDestructionInterval
- The default destruction interval (NO_INTERVAL
, 0 or a negative value mean the job may stay forever).timeField
- The unit of the interval (null means the job may stay forever).public final java.util.Date getMaxDestructionTime()
public final void setMaxDestructionTime(java.util.Date maxDestructionTime)
Sets the maximum destruction time.
Note:
If there was a maximum interval, it is reset and so the given destruction time will be used by getMaxDestructionTime()
.
maxDestructionTime
- The maximum destruction time to set (null means jobs may stay forever).public final int getMaxDestructionInterval()
Gets the maximum interval value.
Note: To get the corresponding unit, use getMaxIntervalField()
and Enum.name()
.
public final DestructionTimeController.DateField getMaxIntervalField()
public final void setMaxDestructionInterval(int maxDestructionInterval)
Sets the maximum interval in minutes from the initialization to the destruction of the concerned job.
Note:
If there was a maximum destruction time, it is reset and so the given interval will be used by getMaxDestructionTime()
.
maxDestructionInterval
- The maximum destruction interval (NO_INTERVAL
, 0 or a negative value mean the job may stay forever).setMaxDestructionInterval(int, DateField)
public final void setMaxDestructionInterval(int maxDestructionInterval, DestructionTimeController.DateField timeField)
Sets the maximum interval (in the given unit) from the initialization to the destruction of the concerned job.
Note:
If there was a maximum destruction time, it is reset and so the given interval will be used by getMaxDestructionTime()
.
maxDestructionInterval
- The maximum destruction interval (NO_INTERVAL
, 0 or a negative value mean the job may stay forever).timeField
- The unit of the interval (null means the job may stay forever).public final boolean allowModification()
allowModification
in interface InputParamController
public final void allowModification(boolean allowModification)
allowModification
- true if the destruction time can be modified, false otherwise.