SiteMinder
Java SDK r12.51


com.netegrity.sdk.policyapi
Class SmTime

java.lang.Object
  extended by com.netegrity.sdk.policyapi.SmTime
All Implemented Interfaces:
java.io.Serializable

public final class SmTime
extends java.lang.Object
implements java.io.Serializable

Represents time restrictions on rules and policies.

The time grid array holds the time restriction for an entire week. The array contains a one-byte element for every hour of the day, starting with 12 AM. In every byte, the seven days of the week are represented, beginning with Sunday as the lowest-order bit.
                  Time Grid Array

              AM            NOON             PM
 -------------------------------------------------------
 |12|1|2|3|4|5|6|7|8|9|10|11|12|1|2|3|4|5|6|7|8|9|10|11|
 -------------------------------------------------------
     |
     |
     v            Time Grid Element
 -----------------------------------------------------------
 |    7    |  6   |  5   |   4   |  3   |  2   |  1   |  0  |
 -----------------------------------------------------------
 | Unused  | Sat  | Fri  | Thur  | Wed  | Tue  | Mon  | Sun |
 -----------------------------------------------------------

 
To set a restriction for a particular hour of the day, set the appropriate bit in the time grid arrays. By default, every object is initialized to fire on every hour, on all 7 days. The value is set to 0x7F.

Since:
SDK 2.0
See Also:
Serialized Form

Constructor Summary
SmTime()
          Constructs a default time grid object (fires every hour of every day) with default start and end dates (start date is the current date, no expiration date).
SmTime(java.util.Calendar startCalendar, java.util.Calendar endCalendar)
          Constructs a default time grid object (fires every hour of every day) with the specified start and end dates.
SmTime(java.lang.String szTimeRestriction)
          Constructs the time restriction from the specified String representation.
 
Method Summary
 java.util.Calendar getEndDate()
          Gets the end date for the time restriction.
 java.util.Calendar getStartDate()
          Gets the start date for the time restriction.
 byte[] getTimeGrid()
          Gets the time restriction.
 void setEndDate(java.util.Calendar endCalendar)
          Sets the end date for the time restriction.
 void setStartDate(java.util.Calendar startCalendar)
          Sets the start date for the time restriction.
 void setTimeGrid(byte[] timeGrid)
          Sets the time restriction.
 void setTimeRestriction(java.lang.String szTimeRestriction)
          Sets the time restriction from the specified String representation.
 java.lang.String toString()
          Returns the time restriction in String format.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SmTime

public SmTime()
Constructs a default time grid object (fires every hour of every day) with default start and end dates (start date is the current date, no expiration date).


SmTime

public SmTime(java.util.Calendar startCalendar,
              java.util.Calendar endCalendar)
Constructs a default time grid object (fires every hour of every day) with the specified start and end dates.

Parameters:
startCalendar - Start date for the time restriction.
endCalendar - End date for the time restriction.

SmTime

public SmTime(java.lang.String szTimeRestriction)
Constructs the time restriction from the specified String representation.

Parameters:
timeRestriction - The time restriction in String representation.

For example, to restrict a policy from being fired all day Thursday, turn off the Thursday bit in all the hour elements:

 start date end date              time grid
    |         |                       |
    v         v                       v
 00000000-00000000-6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F
 
Start date and end date are long values.
Method Detail

setStartDate

public void setStartDate(java.util.Calendar startCalendar)
Sets the start date for the time restriction.

Parameters:
startCalendar - The start date for the time restriction.

getStartDate

public java.util.Calendar getStartDate()
Gets the start date for the time restriction.

Returns:
The start date for the time restriction.

setEndDate

public void setEndDate(java.util.Calendar endCalendar)
Sets the end date for the time restriction.

Parameters:
endCalendar - The end date for the time restriction.

getEndDate

public java.util.Calendar getEndDate()
Gets the end date for the time restriction.

Returns:
The end date for the time restriction.

setTimeGrid

public void setTimeGrid(byte[] timeGrid)
Sets the time restriction.

Parameters:
timeGrid - The time restriction.

getTimeGrid

public byte[] getTimeGrid()
Gets the time restriction.

Returns:
The time restriction.

setTimeRestriction

public void setTimeRestriction(java.lang.String szTimeRestriction)
Sets the time restriction from the specified String representation.

Parameters:
timeRestriction - The time restriction in String representation.

For example, to restrict the policy from being fired all day Thursday, turn off the Thursday bit in all the hour elements:

 start date end date              time grid
    |         |                       |
    v         v                       v
 00000000-00000000-6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F6F
 
Start date and end date are long values.

toString

public java.lang.String toString()
Returns the time restriction in String format.

Overrides:
toString in class java.lang.Object
Returns:
The time restriction in String format.

SiteMinder
Java SDK r12.51

Mon 04/08/2013

http://ca.com
Copyright (c) 2013 CA.