flux
Interface BusinessInterval

All Superinterfaces:
AllowableBusinessInterval

public interface BusinessInterval
extends AllowableBusinessInterval

Defines intervals of time that indicate when business operations may take place. Typically, these business operations include business days and hours, excluding weekends and holidays. However, a business interval can include arbitrary stretches of time, spanning any amount of time.

By default, all time is excluded from the BusinessInterval. You must "include" spans of time into the BusinessInterval. For example, to allow jobs to run Monday through Friday, you must include Monday through Friday. By doing so, you will leave the weekends (Saturday and Sunday) excluded from your BusinessInterval.

Imagine a time line that stretches from left to right. Included in the time line are working days: Monday through Friday. Excluded from the time line are the weekends.

For example, a business interval may include the days Monday through Friday, except weekends and holidays. The holidays are defined through this interface. For example, in the United States, these holidays may include Thanksgiving and New Year's Day.

Author:
Copyright 2014 Flux Corporation. All rights reserved.

Method Summary
 void addNewInterval(AllowableBusinessInterval newInterval, AllowableBusinessInterval previousInterval, BusinessIntervalOperation operation)
          Adds a new business interval to this BusinessInterval after the "previous" location using the specified operation.
 void addNewInterval(AllowableBusinessInterval newInterval, BusinessIntervalOperation operation)
          Adds a new business interval to this BusinessInterval using operation.
 void changeOperation(AllowableBusinessInterval component, BusinessIntervalOperation newOperation)
          Changes the operator that this business interval uses to evaluate component.
 void exclude(java.lang.String name, java.util.Date start, java.util.Date stop, java.lang.String duration, java.lang.String repeatTimeExpression, int count)
          Excludes a span of time from execution.
 void exclude(java.lang.String name, java.util.Date start, java.lang.String duration, java.lang.String repeatTimeExpression)
          Excludes a span of time from execution.
 void exclude(java.lang.String name, java.lang.String startTimeExpression, java.lang.String stopTimeExpression, java.lang.String duration, java.lang.String repeatTimeExpression, int count)
          Excludes a span of time from execution.
 void excludeAll()
          Excludes all times for this business interval.
 void excludeDay(java.lang.String name, java.util.Date day)
          Excludes a calendar day from execution.
 void excludeDay(java.lang.String name, java.util.Date day, java.lang.String repeatTimeExpression)
          Excludes a calendar day from execution.
 java.util.List findPathToComponent(AllowableBusinessInterval component)
          Returns a list of BusinessIntervalElements that represents the path to the specified component.
 java.util.List<BusinessIntervalElement> getBusinessIntervalElements()
          Returns an ordered collection of BusinessIntervalElements that have been added to this business interval.
 void include(java.lang.String name, java.util.Date start, java.util.Date stop, java.lang.String duration, java.lang.String repeatTimeExpression, int count)
          Includes a span of time from execution.
 void include(java.lang.String name, java.util.Date start, java.lang.String duration, java.lang.String repeatTimeExpression)
          Includes a span of time from execution.
 void include(java.lang.String name, java.lang.String startTimeExpression, java.lang.String stopTimeExpression, java.lang.String duration, java.lang.String repeatTimeExpression, int count)
          Includes a span of time from execution.
 void includeAll()
          Includes all times for this business interval.
 void includeDay(java.lang.String name, java.util.Date day)
          Includes a calendar day from execution.
 void includeDay(java.lang.String name, java.util.Date day, java.lang.String repeatTimeExpression)
          Includes a calendar day for execution.
 boolean isFirstComponent(AllowableBusinessInterval component)
          Indicates whether the specified component is the first component to be evaluated for this business interval.
 boolean isLastComponent(AllowableBusinessInterval component)
          Indicates whether the specified component is the last component to be evaluated for this business interval.
 void moveBackward(AllowableBusinessInterval component)
          Moves the specified component one step later in the evaluation process.
 void moveForward(AllowableBusinessInterval component)
          Moves the specified component one step earlier in the evaluation process.
 void remove(AllowableBusinessInterval component)
          Removes the specified component from this BusinessInterval.
 void remove(java.lang.String name)
          Removes an interval that was previously included or excluded.
 void replace(AllowableBusinessInterval original, AllowableBusinessInterval newInterval, BusinessIntervalOperation newOperation)
          Replaces one business interval with another business interval.
 
Methods inherited from interface flux.AllowableBusinessInterval
getName, isAllowed, isAllowed, setName
 

Method Detail

addNewInterval

void addNewInterval(AllowableBusinessInterval newInterval,
                    AllowableBusinessInterval previousInterval,
                    BusinessIntervalOperation operation)
Adds a new business interval to this BusinessInterval after the "previous" location using the specified operation. As a result, the new BusinessIntervalNode is inserted after the "previous" location.

Parameters:
newInterval - The business interval to add.
previousInterval - The new business interval is added immediately after this business interval.
operation - The operation to use.

addNewInterval

void addNewInterval(AllowableBusinessInterval newInterval,
                    BusinessIntervalOperation operation)
Adds a new business interval to this BusinessInterval using operation. The method call "include(interval)" is equivalent to the method call "addNewInterval(newInterval, BusinessIntervalOperation.INCLUDE)".

Parameters:
newInterval - The business interval to add.
operation - The operation to use.

changeOperation

void changeOperation(AllowableBusinessInterval component,
                     BusinessIntervalOperation newOperation)
Changes the operator that this business interval uses to evaluate component.

For example, if component was excluded and newOperation is BusinessIntervalOperation.UNION, then after this method finishes, this business interval will behave as if component was included and not excluded.

Parameters:
component - The component whose operation will be changed.
newOperation - The newOperation to use.

exclude

void exclude(java.lang.String name,
             java.util.Date start,
             java.lang.String duration,
             java.lang.String repeatTimeExpression)
             throws EngineException
Excludes a span of time from execution.

For example, to exclude 06:00 through 08:00, Monday through Friday, make the following method call.

 exclude("my interval", null, "+2H", "0 0 0 6 * * mon-fri");
 

Parameters:
name - The name of the time span.
start - The start date of the time span. The start date includes the time of day. For example, the time of day may begin at 08:00. If null, the starting date is derived by applying the repeatTimeExpression to the current date. If null, repeatTimeExpression may not be null.
duration - Time expression indicating how long this duration should last.
repeatTimeExpression - Time expression indicating when this duration will start again. The repeateExpression is relative to the start date. If null, start may not be null.
Throws:
EngineException - If a Time Expression fails.

exclude

void exclude(java.lang.String name,
             java.util.Date start,
             java.util.Date stop,
             java.lang.String duration,
             java.lang.String repeatTimeExpression,
             int count)
             throws EngineException
Excludes a span of time from execution.

For example, to exclude 06:00 through 08:00, Monday through Friday, for a total of 25 excluded regions of time, make the following method call.

 exclude("my interval", null, null, "+2H", "0 0 0 6 * * mon-fri", 25);
 

Parameters:
name - The name of the time span.
start - The start date of the time span. The start date includes the time of day. For example, the time of day may begin at 08:00. If null, the starting date is derived by applying the repeatTimeExpression to the current date. If null, repeatTimeExpression may not be null.
stop - The stop date of the time span. The stop date is exclusive, that is, the excluded time span includes the millisecond before the stop date but not the stop date itself. If null, there is no stop date.
duration - Time expression indicating how long this duration should last.
repeatTimeExpression - Time expression indicating when this duration will start again. The repeatTimeExpression is relative to the start date. If null, start may not be null.
count - The maximum number of times that the repeat expression will be applied. If count is negative, it is ignored, and the repeat expression will be applied forever.
Throws:
EngineException - If a Time Expression fails.

exclude

void exclude(java.lang.String name,
             java.lang.String startTimeExpression,
             java.lang.String stopTimeExpression,
             java.lang.String duration,
             java.lang.String repeatTimeExpression,
             int count)
             throws EngineException
Excludes a span of time from execution.

For example, to exclude 06:00 through 08:00, Monday through Friday, starting 10 days from the current date and ending 25 days later, make the following method call.

 exclude("my interval", "+10d", "+25d", "+2H", "0 0 0 6 * * mon-fri", -1);
 

Parameters:
name - The name of the time span.
startTimeExpression - The start date of the time span, which is calculated by applying the startTimeExpression to the current date. The start date includes the time of day. For example, the time of day may begin at 08:00. If null, the starting date is derived by applying the repeatTimeExpression to the current date. If null, repeatTimeExpression may not be null.
stopTimeExpression - The stop date of the time span, which is calculated by applying the stopTimeExpression to the start date. The stop date is exclusive, that is, the excluded time span includes the millisecond before the stop date but not the stop date itself. If null, there is no stop date.
duration - Time expression indicating how long this duration should last.
repeatTimeExpression - Time expression indicating when this duration will start again. The repeatTimeExpression is relative to the start date. If null, startTimeExpression may not be null.
count - The maximum number of times that the repeat expression will be applied. If count is negative, it is ignored, and the repeat expression will be applied forever.
Throws:
EngineException - If a Time Expression fails.

excludeAll

void excludeAll()
Excludes all times for this business interval. By default, all times are excluded and allowable business times must be included.


excludeDay

void excludeDay(java.lang.String name,
                java.util.Date day)
                throws EngineException
Excludes a calendar day from execution. Convenience method for excluding a calendar day.

Parameters:
name - The name of the day.
day - The calendar day to exclude. The time component of the day, hour/minute/second/millisecond, is ignored.
Throws:
EngineException - If day is null.

excludeDay

void excludeDay(java.lang.String name,
                java.util.Date day,
                java.lang.String repeatTimeExpression)
                throws EngineException
Excludes a calendar day from execution. Convenience method for excluding a calendar day.

Parameters:
name - The name of the day.
day - The calendar day to exclude. The time component of the day, hour/minute/second/millisecond, is ignored. If null, the starting date is derived by applying the repeatTimeExpression to the current date. If null, repeatTimeExpression may not be null.
repeatTimeExpression - Time expression indicating when this duration will start again. The repeatTimeExpression is relative to the start date. If null, day may not be null.
Throws:
EngineException - If day is null or a Time Expression is illegal.

findPathToComponent

java.util.List findPathToComponent(AllowableBusinessInterval component)
Returns a list of BusinessIntervalElements that represents the path to the specified component. This BusinessInterval is not included in the list. Component is the last component in the returned list. All intermediate components are instances of BusinessIntervalNode.

If component has not been added to this BusinessInterval, an empty list is returned.

Parameters:
component - The component whose path to find.
Returns:
List of BusinessIntervalElement. Represents the path to the specified component.

getBusinessIntervalElements

java.util.List<BusinessIntervalElement> getBusinessIntervalElements()
Returns an ordered collection of BusinessIntervalElements that have been added to this business interval.

Returns:
An ordered collection of BusinessIntervalElements that have been added to this business interval.

include

void include(java.lang.String name,
             java.util.Date start,
             java.util.Date stop,
             java.lang.String duration,
             java.lang.String repeatTimeExpression,
             int count)
             throws EngineException
Includes a span of time from execution.

For example, to include 06:00 through 08:00, Monday through Friday, for a total of 25 excluded regions of time, make the following method call.

 include("my interval", null, null, "+2H", "0 0 0 6 * * mon-fri", 25);
 

Parameters:
name - The name of the time span.
start - The start date of the time span. The start date includes the time of day. For example, the time of day may begin at 08:00. If null, the starting date is derived by applying the repeatTimeExpression to the current date. If null, repeatTimeExpression may not be null.
stop - The stop date of the time span. The stop date is exclusive, that is, the excluded time span includes the millisecond before the stop date but not the stop date itself. If null, there is no stop date.
duration - Time expression indicating how long this duration should last.
repeatTimeExpression - Time expression indicating when this duration will start again. The repeatTimeExpression is relative to the start date. If null, start may not be null.
count - The maximum number of times that the repeat expression will be applied. If count is negative, it is ignored, and the repeat expression will be applied forever.
Throws:
EngineException - If a Time Expression fails.

include

void include(java.lang.String name,
             java.util.Date start,
             java.lang.String duration,
             java.lang.String repeatTimeExpression)
             throws EngineException
Includes a span of time from execution.

For example, to include 06:00 through 08:00, Monday through Friday, make the following method call.

 include("my interval", null, "+2H", "0 0 0 6 * * mon-fri");
 

Parameters:
name - The name of the time span.
start - The start date of the time span. The start date includes the time of day. For example, the time of day may begin at 08:00. If null, the starting date is derived by applying the repeatTimeExpression to the current date. If null, repeatTimeExpression may not be null.
duration - Time expression indicating how long this duration should last.
repeatTimeExpression - Time expression indicating when this duration will start again. The repeatTimeExpression is relative to the start date. If null, start may not be null.
Throws:
EngineException - If a Time Expression fails.

include

void include(java.lang.String name,
             java.lang.String startTimeExpression,
             java.lang.String stopTimeExpression,
             java.lang.String duration,
             java.lang.String repeatTimeExpression,
             int count)
             throws EngineException
Includes a span of time from execution.

For example, to include 06:00 through 08:00, Monday through Friday, starting 10 days from the current date and ending 25 days later, make the following method call.

 include("my interval", "+10d", "+25d", "+2H", "0 0 0 6 * * mon-fri", -1);
 

Parameters:
name - The name of the time span.
startTimeExpression - The start date of the time span, which is calculated by applying the startTimeExpression to the current date. The start date includes the time of day. For example, the time of day may begin at 08:00. If null, the starting date is derived by applying the repeatTimeExpression to the current date. If null, repeatTimeExpression may not be null.
stopTimeExpression - The stop date of the time span, which is calculated by applying the stopTimeExpression to the start date. The stop date is exclusive, that is, the excluded time span includes the millisecond before the stop date but not the stop date itself. If null, there is no stop date.
duration - Time expression indicating how long this duration should last.
repeatTimeExpression - Time expression indicating when this duration will start again. The repeatTimeExpression is relative to the start date. If null, startTimeExpression may not be null.
count - The maximum number of times that the repeat expression will be applied. If count is negative, it is ignored, and the repeat expression will be applied forever.
Throws:
EngineException - If a Time Expression fails.

includeAll

void includeAll()
Includes all times for this business interval. By default, all times are excluded and allowable business times must be included.


includeDay

void includeDay(java.lang.String name,
                java.util.Date day)
                throws EngineException
Includes a calendar day from execution. Convenience method for including a calendar day.

Parameters:
name - The name of the day.
day - The calendar day to include. The time component of the day, hour/minute/second/millisecond, is ignored.
Throws:
EngineException - If day is null.

includeDay

void includeDay(java.lang.String name,
                java.util.Date day,
                java.lang.String repeatTimeExpression)
                throws EngineException
Includes a calendar day for execution. Convenience method for including a calendar day.

Parameters:
name - The name of the day.
day - The calendar day to include. The time component of the day, hour/minute/second/millisecond, is ignored. If null, the starting date is derived by applying the repeatTimeExpression to the current date. If null, repeatTimeExpression may not be null.
repeatTimeExpression - Time expression indicating when this duration will start again. The repeatTimeExpression is relative to the start date. If null, day may not be null.
Throws:
EngineException - If day is null or a Time Expression is illegal.

isFirstComponent

boolean isFirstComponent(AllowableBusinessInterval component)
Indicates whether the specified component is the first component to be evaluated for this business interval.

Parameters:
component - The component that is evaluated.
Returns:
Whether the specified component is the first component to be evaluated for this business interval.

isLastComponent

boolean isLastComponent(AllowableBusinessInterval component)
Indicates whether the specified component is the last component to be evaluated for this business interval.

Parameters:
component - The component that is evaluated.
Returns:
Whether the specified component is the last component to be evaluated for this business interval.

moveForward

void moveForward(AllowableBusinessInterval component)
Moves the specified component one step earlier in the evaluation process.

Parameters:
component - Moves the specified component one step earlier in the evaluation process.

moveBackward

void moveBackward(AllowableBusinessInterval component)
Moves the specified component one step later in the evaluation process.

Parameters:
component - Moves specified component one step later in the evaluation process.

remove

void remove(AllowableBusinessInterval component)
Removes the specified component from this BusinessInterval. Component will no longer be used to calculate business intervals. If component is a BusinessIntervalNode, all of component's child intervals are removed as well.

Parameters:
component - The component to remove.

remove

void remove(java.lang.String name)
Removes an interval that was previously included or excluded. The name is case sensitive.

Parameters:
name - The name of the interval to remove.

replace

void replace(AllowableBusinessInterval original,
             AllowableBusinessInterval newInterval,
             BusinessIntervalOperation newOperation)
Replaces one business interval with another business interval. Specifically, the "original" business interval is replaced with the "newInterval" business interval.

Parameters:
original - The original interval that was added to this BusinessInterval.
newInterval - The interval that will replace the original interval.
newOperation - The new operation to use with newInterval.


© 2014 Flux Corporation. All rights reserved.