diff options
Diffstat (limited to 'src/main/kotlin/dev/dnpm')
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/services/ConsentProcessor.kt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/services/ConsentProcessor.kt b/src/main/kotlin/dev/dnpm/etl/processor/services/ConsentProcessor.kt index 5a31b42..f7df389 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/services/ConsentProcessor.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/services/ConsentProcessor.kt @@ -325,7 +325,18 @@ class ConsentProcessor( } } + /** + * Checks if the given request date is within the range specified by the provided period. + * + * @param requestDate The date to check, can be null. + * @param provPeriod The period containing the start and end dates for the range, where both `start` and `end` must not be null. + * @return `true` if the request date is within the range (inclusive of start and end), otherwise `false`. + */ fun isRequestDateInRange(requestDate: Date?, provPeriod: Period): Boolean { + if (null == requestDate || null == provPeriod.start || null == provPeriod.end) { + return false + } + val isRequestDateAfterOrEqualStart = provPeriod.start.compareTo(requestDate) val isRequestDateBeforeOrEqualEnd = provPeriod.end.compareTo(requestDate) return isRequestDateAfterOrEqualStart <= 0 && isRequestDateBeforeOrEqualEnd >= 0 |
