This is an automated email from the ASF dual-hosted git repository.

mweiler pushed a commit to branch main
in repository 
https://gitbox.apache.org/repos/asf/incubator-kie-kogito-examples.git


The following commit(s) were added to refs/heads/main by this push:
     new 8b7214948 [Incubator-kie-issues#1790] Business Calendar Example(s) 
Readme Fix (#2080)
8b7214948 is described below

commit 8b72149486e3ecce00a8f2fa08c8d3780725adc7
Author: Abhiram Gundala <[email protected]>
AuthorDate: Thu Mar 6 16:44:28 2025 -0500

    [Incubator-kie-issues#1790] Business Calendar Example(s) Readme Fix (#2080)
    
    * readme_fix
    
    * formatting_update
    
    * properties_update
    
    * properties_update2
    
    * properties_update2
    
    * typo_fix2
---
 .../README.md                                      |  47 ++++++++++-----------
 .../docs/images/CustomCalendarClass.png            | Bin 127704 -> 100676 bytes
 .../src/main/resources/calendar.properties         |   2 -
 .../README.md                                      |  31 +++++++-------
 .../docs/images/CustomCalendarClassSpring.png      | Bin 90321 -> 90985 bytes
 5 files changed, 38 insertions(+), 42 deletions(-)

diff --git 
a/kogito-quarkus-examples/process-business-calendar-quarkus-example/README.md 
b/kogito-quarkus-examples/process-business-calendar-quarkus-example/README.md
index 5f0ab76b8..dad9926d3 100644
--- 
a/kogito-quarkus-examples/process-business-calendar-quarkus-example/README.md
+++ 
b/kogito-quarkus-examples/process-business-calendar-quarkus-example/README.md
@@ -131,11 +131,7 @@ curl -X GET 
http://localhost:8080/BusinessCalendarCreditBill/{id} \
 ## Understanding calendar.properties
 **Default Behavior**: If you do not input custom values in a 
calendar.properties file, the system will use the following default settings:
 
-* **business.days.per.week** defaults to 5, meaning only Monday to Friday are 
considered working days.
-
-* **business.hours.per.day** defaults to 8, representing an 8-hour workday.
-
-* **business.start.hour** defaults to 9, and business.end.hour defaults to 17 
(i.e.,9 AM to 5 PM workday).
+* **business.start.hour** defaults to 9, and **business.end.hour** defaults to 
17 (i.e.,9 AM to 5 PM workday).
 
 * **business.weekend.days** defaults to Saturday and Sunday (Sunday-1, 
Monday-2, Tuesday-3, Wednesday-4, Thursday-5, Friday-6, Saturday-7).
 
@@ -143,7 +139,13 @@ curl -X GET 
http://localhost:8080/BusinessCalendarCreditBill/{id} \
 
 * **business.holidays** by default will be considered empty, meaning no 
predefined holidays unless specified, if specified, it should be in the format 
defined by business.holiday.date.format, Holidays can be specified as 
individual dates (e.g., 2024-12-25,2024-12-31) or as a range of dates (e.g., 
2024-11-12:2024-11-14).
 
-* **business.cal.timezone** defaults to the system’s default timezone, if 
configured, valid time-zone as per Valid timezone as per 
https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html should be 
specfied.
+* **business.cal.timezone** defaults to the system’s default timezone, if 
configured, valid time-zone as per Valid timezone as per 
https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html should be 
specified.
+
+**Calculated Properties (Do not include in `calendar.properties` file)**:
+
+* **business.days.per.week**: calculated value, 7 - business.weekend.days.
+
+* **business.hours.per.day** : Calculated value, business.end.hour - 
business.start.hour.
 
 **Behavior**:
 * Considering the default properties as mentioned above, if a task is executed 
after working hours i.e., non-working hours (e.g., at 7 PM), the system will 
delay its execution until the start of the next working hour/working day (9 
AM). For example, if a task timer is set to trigger at 7 PM on a Friday, it 
will not execute until 9 AM on Monday (assuming a standard 5-day workweek).
@@ -155,25 +157,21 @@ curl -X GET 
http://localhost:8080/BusinessCalendarCreditBill/{id} \
 ### Note: Important Guidelines for Configuring `calendar.properties`
 To override default values, configure calendar.properties file based on 
requirements. In order to ensure more aligned functionality, please follow the 
rules outlined below. Adhering to these guidelines will help ensure that tasks 
are executed as expected. Incorrect configurations may result in unintended 
behavior, so it's recommended to input accurate values.
 
-| Property                     | Valid Range                                   
                                                                         | 
Description                                                                     
                                                                                
                               |
-|------------------------------|------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
-| `business.start.hour`       | 0-23                                           
                                                                        | Start 
hour of the workday                                                             
                                                                                
                         |
-| `business.end.hour`         | 0-23                                           
                                                                        | End 
hour of the workday                                                             
                                                                                
                           |
-| `business.hours.per.day`    | 1-24                                           
                                                                        | Total 
working hours in a day                                                          
                                                                                
                         |
-| `business.days.per.week`    | 1-7                                            
                                                                        | Total 
working days per week                                                           
                                                                                
                         |
-| `business.weekend.days`     | 0-7                                            
                                                                        | Days 
considered as weekends (e.g., 1 = Sunday, 7 = Saturday). In case you want to 
consider all the days as working days i.e., no weekend days, input 0 as value 
considering working days as 7. |
-| `business.holiday.date.format`       | (yyyy-MM-dd)                          
                                                                                
 | List of holidays                                                             
                                                                                
                                  |
-| `business.holidays`   | Dates aligned with business.holiday.date.format      
                                                                  | Date format 
for holidays                                                                    
                                                                                
                   |
-| `business.cal.timezone`     | Valid timezone as per [Java TimeZone 
Documentation](https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html)
 | Timezone for calculations                                                    
                                                                                
                                  |
+| Property                     | Valid Range                                   
                                                                         | 
Description                                                                     
                                                                                
                                 |
+|------------------------------|------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| `business.start.hour`       | 0-23                                           
                                                                        | Start 
hour of the workday                                                             
                                                                                
                           |
+| `business.end.hour`         | 0-23                                           
                                                                        | End 
hour of the workday                                                             
                                                                                
                             |
+| `business.weekend.days`     | 0-7                                            
                                                                        | Days 
considered as weekends (e.g., 1 = Sunday, 7 = Saturday). In case you want to 
consider all the days as working days i.e., no weekend days, input 0 as value 
considering working days as 7.   |
+| `business.holiday.date.format`       | (yyyy-MM-dd)                          
                                                                                
 | List of holidays                                                             
                                                                                
                                    |
+| `business.holidays`   | Dates aligned with business.holiday.date.format      
                                                                  | Date format 
for holidays                                                                    
                                                                                
                     |
+| `business.cal.timezone`     | Valid timezone as per [Java TimeZone 
Documentation](https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html)
 | Timezone for calculations                                                    
                                                                                
                                    |
 
 ### Example of custom calendar.properties
 ```Properties
 business.end.hour=23
-business.hours.per.day=24
 business.start.hour=0
 business.holiday.date.format=yyyy-MM-dd
 business.holidays=2024-10-30
-business.days.per.week=5
 business.weekend.days=6,7
 business.cal.timezone=America/Toronto
 ```
@@ -299,14 +297,14 @@ This guide explains how to implement a custom business 
calendar allowing full fl
 ### Creating a Custom Business Calendar 
 
 - By default, calendar.properties is used to configure default business 
calendar. 
-- If a custom business calendar has to be implemented, calendar.properties 
should NOT exist. Instead, add the following property to 
application.properties: 
```kogito.processes.businessCalendar=org.kie.kogito.calendar.CustomCalendar```
+- If a custom business calendar has to be implemented, calendar.properties 
should NOT exist. Instead, add the following property to 
application.properties: 
```kogito.processes.businessCalendar=org.kie.kogito.calendar.custom.CustomCalendar```
 
 **Steps**
-1. **Navigate to**: 
*kogito-quarkus-examples/process-business-calendar-quarkus-example/src/main/java/org/kie/kogito/calendar*
+1. **Navigate to**: 
*kogito-quarkus-examples/process-business-calendar-quarkus-example/src/main/java/org/kie/kogito/calendar/custom*
 (create the custom folder if it does not exist).
 2. **Create a new custom business calendar class** (e.g., CustomCalendar.java).
-3. Ensure it implements the BusinessCalendar interface.The implementation 
should be a concrete class(not an interface or abstract class).
-4. Set the property 
```kogito.processes.businessCalendar=org.kie.kogito.calendar.custom.CustomCalendar```
  in application.properties to the fully qualified class name of the custom 
business calendar.
-5. To test the created custom business calendar with property set in 
application.properties, calendar.properties should not exist.
+3. Ensure it implements the `BusinessCalendar` interface.The implementation 
should be a concrete class(not an interface or abstract class).
+4. Set the property 
```kogito.processes.businessCalendar=org.kie.kogito.calendar.custom.CustomCalendar```
  in `application.properties` to the fully qualified class name of the custom 
business calendar.
+5. Remove the `calendar.properties` file within `src/main/resources` to allow 
the `CustomCalendar` class to be registered instead of the default 
`BusinessCalendarImpl` provided out of the box.
 
 
 
@@ -328,7 +326,8 @@ public class CustomCalendar implements BusinessCalendar {
     @Override
     public long calculateBusinessTimeAsDuration(String timeExpression) {
         // Implement custom logic to calculate business time duration
-        return 0;
+      // Note:The returned long value is in milliseconds. Duration can be set 
at least 1000 ms or longer to prevent immediate execution.
+        return 1000;
     }
 
     @Override
diff --git 
a/kogito-quarkus-examples/process-business-calendar-quarkus-example/docs/images/CustomCalendarClass.png
 
b/kogito-quarkus-examples/process-business-calendar-quarkus-example/docs/images/CustomCalendarClass.png
index fe5ac3068..b202922cb 100644
Binary files 
a/kogito-quarkus-examples/process-business-calendar-quarkus-example/docs/images/CustomCalendarClass.png
 and 
b/kogito-quarkus-examples/process-business-calendar-quarkus-example/docs/images/CustomCalendarClass.png
 differ
diff --git 
a/kogito-quarkus-examples/process-business-calendar-quarkus-example/src/main/resources/calendar.properties
 
b/kogito-quarkus-examples/process-business-calendar-quarkus-example/src/main/resources/calendar.properties
index eddf031d2..286d8c590 100644
--- 
a/kogito-quarkus-examples/process-business-calendar-quarkus-example/src/main/resources/calendar.properties
+++ 
b/kogito-quarkus-examples/process-business-calendar-quarkus-example/src/main/resources/calendar.properties
@@ -16,10 +16,8 @@
 # under the License.
 
 business.end.hour=23
-business.hours.per.day=24
 business.start.hour=0
 business.holiday.date.format=yyyy-MM-dd
 business.holidays=2024-11-07
-business.days.per.week=6
 business.weekend.days=1
 
diff --git 
a/kogito-springboot-examples/process-business-calendar-springboot-example/README.md
 
b/kogito-springboot-examples/process-business-calendar-springboot-example/README.md
index 37bcc6f06..dae19e778 100644
--- 
a/kogito-springboot-examples/process-business-calendar-springboot-example/README.md
+++ 
b/kogito-springboot-examples/process-business-calendar-springboot-example/README.md
@@ -125,11 +125,7 @@ curl -X GET 
http://localhost:8080/BusinessCalendarCreditBill/{id} \
 ## Understanding calendar.properties
 **Default Behavior**: If you do not input custom values in a 
calendar.properties file, the system will use the following default settings:
 
-* **business.days.per.week** defaults to 5, meaning only Monday to Friday are 
considered working days.
-
-* **business.hours.per.day** defaults to 8, representing an 8-hour workday.
-
-* **business.start.hour** defaults to 9, and business.end.hour defaults to 17 
(i.e.,9 AM to 5 PM workday).
+* **business.start.hour** defaults to 9, and **business.end.hour** defaults to 
17 (i.e.,9 AM to 5 PM workday).
 
 * **business.weekend.days** defaults to Saturday and Sunday (Sunday-1, 
Monday-2, Tuesday-3, Wednesday-4, Thursday-5, Friday-6, Saturday-7).
 
@@ -137,7 +133,13 @@ curl -X GET 
http://localhost:8080/BusinessCalendarCreditBill/{id} \
 
 * **business.holidays** by default will be considered empty, meaning no 
predefined holidays unless specified, if specified, it should be in the format 
defined by business.holiday.date.format, Holidays can be specified as 
individual dates (e.g., 2024-12-25,2024-12-31) or as a range of dates (e.g., 
2024-11-12:2024-11-14).
 
-* **business.cal.timezone** defaults to the system’s default timezone, if 
configured, valid time-zone as per Valid timezone as per 
https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html should be 
specfied.
+* **business.cal.timezone** defaults to the system’s default timezone, if 
configured, valid time-zone as per Valid timezone as per 
https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html should be 
specified.
+
+**Calculated Properties** (Do not include in `calendar.properties` file):
+
+* **business.days.per.week**: calculated value, 7 - business.weekend.days.
+
+* **business.hours.per.day** : Calculated value, business.end.hour - 
business.start.hour.
 
 **Behavior**:
 * Considering the default properties as mentioned above, if a task is executed 
after working hours i.e., non-working hours (e.g., at 7 PM), the system will 
delay its execution until the start of the next working hour/working day (9 
AM). For example, if a task timer is set to trigger at 7 PM on a Friday, it 
will not execute until 9 AM on Monday (assuming a standard 5-day workweek).
@@ -153,8 +155,6 @@ To override default values, configure calendar.properties 
file based on requirem
 
|------------------------------|------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
 | `business.start.hour`       | 0-23                                           
                                                                        | Start 
hour of the workday                                                             
                                                                                
                         |
 | `business.end.hour`         | 0-23                                           
                                                                        | End 
hour of the workday                                                             
                                                                                
                           |
-| `business.hours.per.day`    | 1-24                                           
                                                                        | Total 
working hours in a day                                                          
                                                                                
                         |
-| `business.days.per.week`    | 1-7                                            
                                                                        | Total 
working days per week                                                           
                                                                                
                         |
 | `business.weekend.days`     | 0-7                                            
                                                                        | Days 
considered as weekends (e.g., 1 = Sunday, 7 = Saturday). In case you want to 
consider all the days as working days i.e., no weekend days, input 0 as value 
considering working days as 7. |
 | `business.holiday.date.format`       | (yyyy-MM-dd)                          
                                                                                
 | List of holidays                                                             
                                                                                
                                  |
 | `business.holidays`   | Dates aligned with business.holiday.date.format      
                                                                  | Date format 
for holidays                                                                    
                                                                                
                   |
@@ -163,11 +163,9 @@ To override default values, configure calendar.properties 
file based on requirem
 ### Example of custom calendar.properties
 ```Properties
 business.end.hour=23
-business.hours.per.day=24
 business.start.hour=0
 business.holiday.date.format=yyyy-MM-dd
 business.holidays=2024-10-30
-business.days.per.week=5
 business.weekend.days=6,7
 business.cal.timezone=America/Toronto
 ```
@@ -290,14 +288,14 @@ This guide explains how to implement a custom business 
calendar allowing full fl
 ### Creating a Custom Business Calendar
 
 - By default, calendar.properties is used to configure default business 
calendar.
-- If a custom business calendar has to be implemented, calendar.properties 
should NOT exist. Instead, add the following property to 
application.properties: 
```kogito.processes.businessCalendar=org.kie.kogito.calendar.CustomCalendar```
+- If a custom business calendar has to be implemented, calendar.properties 
should NOT exist. Instead, add the following property to 
application.properties: 
```kogito.processes.businessCalendar=org.kie.kogito.calendar.custom.CustomCalendar```
 
 **Steps**
-1. **Navigate to**: 
*kogito-quarkus-examples/process-business-calendar-quarkus-example/src/main/java/org/kie/kogito/calendar*
+1. **Navigate to**: 
*kogito-springboot-examples/process-business-calendar-quarkus-example/src/main/java/org/kie/kogito/calendar/custom*
 (create the custom folder if it does not exist).
 2. **Create a new custom business calendar class** (e.g., CustomCalendar.java).
-3. Ensure it implements the BusinessCalendar interface.The implementation 
should be a concrete class(not an interface or abstract class).
-4. Set the property 
```kogito.processes.businessCalendar=org.kie.kogito.calendar.custom.CustomCalendar```
  in application.properties to the fully qualified class name of the custom 
business calendar.
-5. To test the created custom business calendar with property set in 
application.properties, calendar.properties should not exist.
+3. Ensure it implements the `BusinessCalendar` interface.The implementation 
should be a concrete class(not an interface or abstract class).
+4. Set the property 
```kogito.processes.businessCalendar=org.kie.kogito.calendar.custom.CustomCalendar```
  in `application.properties` to the fully qualified class name of the custom 
business calendar.
+5. Remove the `calendar.properties` file within `src/main/resources` to allow 
the `CustomCalendar class` to be registered instead of the default 
`BusinessCalendarImpl` provided out of the box.
 
 
 
@@ -319,7 +317,8 @@ public class CustomCalendar implements BusinessCalendar {
     @Override
     public long calculateBusinessTimeAsDuration(String timeExpression) {
         // Implement custom logic to calculate business time duration
-        return 0;
+      // Note:The returned long value is in milliseconds. Duration can be set 
at least 1000 ms or longer to prevent immediate execution.
+        return 1000;
     }
 
     @Override
diff --git 
a/kogito-springboot-examples/process-business-calendar-springboot-example/docs/images/CustomCalendarClassSpring.png
 
b/kogito-springboot-examples/process-business-calendar-springboot-example/docs/images/CustomCalendarClassSpring.png
index c5b58af5e..71a5fddff 100644
Binary files 
a/kogito-springboot-examples/process-business-calendar-springboot-example/docs/images/CustomCalendarClassSpring.png
 and 
b/kogito-springboot-examples/process-business-calendar-springboot-example/docs/images/CustomCalendarClassSpring.png
 differ


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to