Class TimeTokenizer
- java.lang.Object
-
- com.identityworksllc.iiq.common.task.TimeTokenizer
-
public class TimeTokenizer extends Object
Substitutes time tokens in a particular string, typically for task scheduling.Time tokens can be any of:
-
$NOW The current timestamp
-
$MIDNIGHT The most recent midnight in the time zone given
-
$YESTERDAY The second most recent midnight in the time zone given
-
$LASTSTART The last time the task was started, or 0 if no data
-
$LASTSTOP The last time the task was stopped, or 0 if no data
-
$(anyVariable as format) Formats the input timestamp using the given format (for querying string dates)
-
$(today at 14:00)
-
$(yesterday at 10:00) The described timestamp
-
$(+/-N UNITS) An offset of N UNITS (e.g. “-3 hours”), where the unit is one of
ChronoUnit -
$(+/-N UNITS at midnight)
-
$(LASTSTOP -N UNITS)
-
-
-
Constructor Summary
Constructors Constructor Description TimeTokenizer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringparseTimeComponents(sailpoint.object.TaskSchedule taskSchedule, String inputString, String zoneIdString)Parses the input string, which may or may not contain time tokens, by replacing the token with a string suitable for a Sailpoint filter (i.e., the DATE$ format).static StringreplaceOffsetTokens(String inputString, Map<String,Long> tokenMap, Instant now, Instant midnight)Replaces any offset-type tokens, like $(-2 hours), within the string.static StringreplaceTimeTokens(String inputString, ZoneId timeZone)Replaces any time-type tokens $(today at 14:00) in the input string
-
-
-
Constructor Detail
-
TimeTokenizer
public TimeTokenizer()
-
-
Method Detail
-
parseTimeComponents
public static String parseTimeComponents(sailpoint.object.TaskSchedule taskSchedule, String inputString, String zoneIdString) throws sailpoint.tools.GeneralException
Parses the input string, which may or may not contain time tokens, by replacing the token with a string suitable for a Sailpoint filter (i.e., the DATE$ format).- Parameters:
taskSchedule- The task schedule, optionally. It will be used to populate the LASTSTART and LASTSTOP tokens if present.inputString- the input string to replace tokens withinzoneIdString- The timezone to use for time tokens (optional)- Returns:
- The parsed and reformatted input string
- Throws:
sailpoint.tools.GeneralException- if any failures occur during parsing
-
replaceOffsetTokens
public static String replaceOffsetTokens(String inputString, Map<String,Long> tokenMap, Instant now, Instant midnight)
Replaces any offset-type tokens, like $(-2 hours), within the string.The unit should be a ChronoUnit.
-
replaceTimeTokens
public static String replaceTimeTokens(String inputString, ZoneId timeZone)
Replaces any time-type tokens $(today at 14:00) in the input string
-
-