com.emarsys.ecommon.time.schedule
Class QueueSchedulings

java.lang.Object
  extended by com.emarsys.ecommon.time.schedule.QueueSchedulings

public class QueueSchedulings
extends java.lang.Object

Varios utility functions in the context of queue schedulings.

Author:
Michael "kULO" Kulovits


Constructor Summary
QueueSchedulings()
           
 
Method Summary
static org.apache.commons.collections.Predicate getMaxScheduleDatePredicate(java.util.Calendar max)
          Creates a new Predicate instance for ChainElements that returns true if its result (see ChainElement.getResult()) is not null the passed max scheduled date is after it, false otherwise.
static
<T> QueueSchedulingStrategyChain<T>
getMaxScheduleDateTresholdDecorator(QueueSchedulingStrategy<T> strategy, java.util.Calendar maxDate)
          Creates a new QueueSchedulingStrategyChain out of the passed strategy instance that appends another ChainElement which checks if the passed strategy calculated a next processing date that exceeds the passed maxDate and if so replaces it with said maximum value, but if the max.
static
<T> QueueSchedulingStrategyChain<T>
getMaxScheduleDateTresholdDecorator(QueueSchedulingStrategy<T> strategy, SchedulableQueueElement<T> schedulable)
          Creates a new QueueSchedulingStrategyChain out of the passed strategy instance that appends another ChainElement which checks if the passed strategy calculated a next processing date that exceeds the SchedulableQueueElement.getMaxScheduleDate() and if so replaces it with said maximum value, but if the max.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueueSchedulings

public QueueSchedulings()
Method Detail

getMaxScheduleDateTresholdDecorator

public static <T> QueueSchedulingStrategyChain<T> getMaxScheduleDateTresholdDecorator(QueueSchedulingStrategy<T> strategy,
                                                                                      SchedulableQueueElement<T> schedulable)
Creates a new QueueSchedulingStrategyChain out of the passed strategy instance that appends another ChainElement which checks if the passed strategy calculated a next processing date that exceeds the SchedulableQueueElement.getMaxScheduleDate() and if so replaces it with said maximum value, but if the max. scheduling date is in the past then NOW + SchedulableQueueElement.getMinSchedulingInterval() will be returned.

Type Parameters:
T -
Parameters:
strategy -
schedulable -
Returns:
returns a new QueueSchedulingStrategyChain instance that has the same behavior as the passed strategy with the only exception that it won't calculate next processing dates that exceed that passed schedulables max schedule date except the max. schedule date already lies in the past.

getMaxScheduleDateTresholdDecorator

public static <T> QueueSchedulingStrategyChain<T> getMaxScheduleDateTresholdDecorator(QueueSchedulingStrategy<T> strategy,
                                                                                      java.util.Calendar maxDate)
Creates a new QueueSchedulingStrategyChain out of the passed strategy instance that appends another ChainElement which checks if the passed strategy calculated a next processing date that exceeds the passed maxDate and if so replaces it with said maximum value, but if the max. scheduling date is in the past then NOW + SchedulableQueueElement.getMinSchedulingInterval() will be returned. If the passed max schedule date is null no threshold filtering willb done.

Type Parameters:
T -
Parameters:
strategy -
maxDate - - the maximum schedule date
Returns:
returns a new QueueSchedulingStrategyChain instance that has the same behavior as the passed strategy with the only exception that it won't calculate next processing dates that exceed the passed schedulables max schedule date except the max. schedule date already lies in the past.

getMaxScheduleDatePredicate

public static org.apache.commons.collections.Predicate getMaxScheduleDatePredicate(java.util.Calendar max)
Creates a new Predicate instance for ChainElements that returns true if its result (see ChainElement.getResult()) is not null the passed max scheduled date is after it, false otherwise. The predictate will also return false and print a log warning if the Object to evaluate is not a ChainElement instance.

Parameters:
max -
Returns:
a new Predicate instance that checks whether the ChainElement its applied to has a result that is after the passed date.


Copyright © 2010 emarsys AG. All Rights Reserved.