diff --git a/NOTICE b/NOTICE index a1c5656ff47..1c13133b8f8 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Apache KIE -Copyright 2023 The Apache Software Foundation +Copyright 2023-2024 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). diff --git a/api/kogito-api/src/main/java/org/kie/kogito/calendar/BusinessCalendar.java b/api/kogito-api/src/main/java/org/kie/kogito/calendar/BusinessCalendar.java index 6e15a6cc0e6..45ecce21bd4 100644 --- a/api/kogito-api/src/main/java/org/kie/kogito/calendar/BusinessCalendar.java +++ b/api/kogito-api/src/main/java/org/kie/kogito/calendar/BusinessCalendar.java @@ -27,18 +27,21 @@ public interface BusinessCalendar { /** - * Calculates given time expression into duration in milliseconds based on calendar configuration. - * + * Returns the difference, in milliseconds, between the business date that matches the given + * timeExpression, and the current time. + * See {@link #calculateBusinessTimeAsDate} for business date calculation + * * @param timeExpression time expression that is supported by business calendar implementation. * @return duration expressed in milliseconds */ - public long calculateBusinessTimeAsDuration(String timeExpression); + long calculateBusinessTimeAsDuration(String timeExpression); /** - * Calculates given time expression into target date based on calendar configuration. + * Returns the first Date that matches the given timeExpression and falls + * into the business calendar working hours. * * @param timeExpression time expression that is supported by business calendar implementation. * @return date when given time expression will match in the future */ - public Date calculateBusinessTimeAsDate(String timeExpression); + Date calculateBusinessTimeAsDate(String timeExpression); } diff --git a/jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/timer/BusinessCalendarImpl.java b/jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/timer/BusinessCalendarImpl.java index fbb650e3c35..280cc3f6e3f 100755 --- a/jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/timer/BusinessCalendarImpl.java +++ b/jbpm/jbpm-flow/src/main/java/org/jbpm/process/core/timer/BusinessCalendarImpl.java @@ -18,48 +18,37 @@ */ package org.jbpm.process.core.timer; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.text.SimpleDateFormat; import java.time.Duration; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; -import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.List; import java.util.Objects; -import java.util.Properties; import java.util.TimeZone; import java.util.regex.Matcher; import org.jbpm.util.PatternConstants; import org.kie.kogito.calendar.BusinessCalendar; -import org.kie.kogito.timer.SessionClock; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.jbpm.process.core.constants.CalendarConstants.BUSINESS_CALENDAR_PATH; - /** * Default implementation of BusinessCalendar interface that is configured with properties. * Following are supported properties: * - * + * * Format
- * + * * Holidays can be given in two formats: *