Skip navigation links

Oracle® Information Rights Management Server Java API Reference
11g Release 1 (11.1.1)

E12907-03


oracle.irm.engine.core.time
Class TimeOperationsInstance

java.lang.Object
  extended by oracle.irm.engine.core.time.TimeOperationsInstance


public final class TimeOperationsInstance
extends Object

Operations for manipulating and creating time based objects.

This class provides static methods for a set of procedural style methods. The methods can be made to appear as global methods by using import static. e.g.

import static oracle.irm.engine.core.time.TimeOperationsInstance.*;

Method Summary
static Date getCurrentTime()
          The current time.
static TimeRange getTimeRangeByInterval(Date date, TimeRange.Direction direction, TimeRange.Interval interval, int size)
          Create a time range using a time interval.
static boolean isTimeWindowOverlapping(TimeWindow window, Collection<TimeWindow> windows)
          Check whether a time window overlaps other time windows.
static Collection<TimePeriod> sortTimePeriods(Collection<TimePeriod> periods)
          Sort a set of time periods in ascending order.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Method Detail

getCurrentTime

public static Date getCurrentTime()
The current time. The current time can be used when checking time based license criteria. As license time constraints have a maximum precision of a second the time returned by this method will round down the time to the nearest second.

State

The date returned by this method can be safely altered without affecting the internal state of the object.
Returns:
the value of the property. This method will never return null.

isTimeWindowOverlapping

public static boolean isTimeWindowOverlapping(TimeWindow window,
                                              Collection<TimeWindow> windows)
Check whether a time window overlaps other time windows.
Parameters:
window - the time window to check.
windows - the time windows to compare against. This parameter is optional, it is valid to pass null or an empty collection.
Returns:
whether the first time window overlaps any of the other time windows.

getTimeRangeByInterval

public static TimeRange getTimeRangeByInterval(Date date,
                                               TimeRange.Direction direction,
                                               TimeRange.Interval interval,
                                               int size)
Create a time range using a time interval. The time range is calculate from the reference date using the interval provided. The direction specifies whether the interval is forwards or backwards in time. e.g. create a time range from the reference date 15 August 2008 20:00, forward in time two hours. This would result in a time range with a begin time of 15 August 2008 20:00 and an end time of 15 August 2008 22:00.
Parameters:
date - reference date.
direction - time direction.
interval - interval.
size - interval size.
Returns:
the time range. This method will never return null.

sortTimePeriods

public static Collection<TimePeriod> sortTimePeriods(Collection<TimePeriod> periods)
Sort a set of time periods in ascending order. Sorts a set of time periods in time ascending order. The time periods are sorted using the toSeconds method.
Parameters:
periods - time periods to sort. This parameter is optional, it is valid to pass null or an empty collection.
Returns:
the sorted time periods. If applicable, this method will return an empty collection rather than null to indicate no results.

Skip navigation links

Oracle® Information Rights Management Server Java API Reference
11g Release 1 (11.1.1)

E12907-03


Copyright © 2011, Oracle. All rights reserved.