This is an automated email from the ASF dual-hosted git repository.
tkobayas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-kie-drools.git
The following commit(s) were added to refs/heads/main by this push:
new 95ec3bb684 [incubator-kie-drools-6199] Clean up quartz related docs
(#6202)
95ec3bb684 is described below
commit 95ec3bb684de853de179a991a3d0a79723a64a1c
Author: Toshiya Kobayashi <[email protected]>
AuthorDate: Thu Dec 19 18:01:04 2024 +0900
[incubator-kie-drools-6199] Clean up quartz related docs (#6202)
---
.../_drl-timers-calendars-con.adoc | 16 +++++++++++-----
.../_decision-tables-attributes-ref.adoc | 2 +-
.../ROOT/pages/language-reference/_drl-rules.adoc | 18 ++++++++++++------
3 files changed, 24 insertions(+), 12 deletions(-)
diff --git
a/drools-docs/src/modules/ROOT/pages/language-reference-traditional/_drl-timers-calendars-con.adoc
b/drools-docs/src/modules/ROOT/pages/language-reference-traditional/_drl-timers-calendars-con.adoc
index efa902d226..3a3b886d24 100644
---
a/drools-docs/src/modules/ROOT/pages/language-reference-traditional/_drl-timers-calendars-con.adoc
+++
b/drools-docs/src/modules/ROOT/pages/language-reference-traditional/_drl-timers-calendars-con.adoc
@@ -133,7 +133,7 @@ In this example, the rule is scheduled for every hour,
after a delay of 30 secon
If the system is paused (for example, the session is serialized and then later
deserialized), the rule is scheduled only one time to recover from missing
activations regardless of how many activations were missed during the pause,
and then the rule is subsequently scheduled again to continue in sync with the
timer setting.
-The `calendar` attribute in DRL rules is a
http://www.quartz-scheduler.org/[Quartz] calendar definition for scheduling a
rule and supports the following format:
+The `calendar` attribute in DRL rules is a
http://www.quartz-scheduler.org/[Quartz] style cron expression for scheduling a
rule and supports the following format:
.Calendar attribute format
[source]
@@ -151,18 +151,24 @@ calendars "* * 0-7,18-23 ? * *"
calendars "weekday"
----
-You can adapt a Quartz calendar based on the Quartz calendar API and then
register the calendar in the KIE session, as shown in the following example:
+You can define a custom calendar and then register it in the KIE session, as
shown in the following example:
-.Adapting a Quartz Calendar
+.Defining a Calendar
[source,java]
----
-Calendar weekDayCal = QuartzHelper.quartzCalendarAdapter(org.quartz.Calendar
quartzCal)
+private static final org.kie.api.time.Calendar WEEKDAY = timestamp -> {
+ final Calendar c = Calendar.getInstance();
+ c.setTimeInMillis(timestamp);
+
+ final int day = c.get(Calendar.DAY_OF_WEEK);
+ return day != Calendar.SATURDAY && day != Calendar.SUNDAY;
+};
----
.Registering the calendar in the KIE session
[source,java]
----
-ksession.getCalendars().set( "weekday", weekDayCal );
+ksession.getCalendars().set( "weekday", WEEKDAY );
----
You can use calendars with standard rules and with rules that use timers. The
calendar attribute can contain one or more comma-separated calendar names
written as `String` literals.
diff --git
a/drools-docs/src/modules/ROOT/pages/language-reference/_decision-tables-attributes-ref.adoc
b/drools-docs/src/modules/ROOT/pages/language-reference/_decision-tables-attributes-ref.adoc
index 1f63467535..c893221c5d 100644
---
a/drools-docs/src/modules/ROOT/pages/language-reference/_decision-tables-attributes-ref.adoc
+++
b/drools-docs/src/modules/ROOT/pages/language-reference/_decision-tables-attributes-ref.adoc
@@ -81,7 +81,7 @@ Example: `TIMER "*/5 * * * *"` (every 5 minutes)
|`CALENDAR`
|E
-|A Quartz calendar definition for scheduling the rule.
+|A calendar definition for scheduling the rule.
Example: `CALENDAR "* * 0-7,18-23 ? * *"` (exclude non-business hours)
diff --git
a/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc
b/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc
index 7aa0957a94..f2a8288f73 100644
--- a/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc
+++ b/drools-docs/src/modules/ROOT/pages/language-reference/_drl-rules.adoc
@@ -953,7 +953,7 @@ Example: `timer ( int: 30s 5m )` (every 5 minutes after a
30-second delay)
`timer ( cron:* 0/15 * * * ? )` (every 15 minutes)
|`calendar`
-|A http://www.quartz-scheduler.org/[Quartz] calendar definition for scheduling
the rule.
+|A calendar definition for scheduling the rule.
Example: `calendars "* * 0-7,18-23 ? * *"` (exclude non-business hours)
@@ -1090,7 +1090,7 @@ In this example, the rule is scheduled for every hour,
after a delay of 30 secon
If the system is paused (for example, the session is serialized and then later
deserialized), the rule is scheduled only one time to recover from missing
internalMatches regardless of how many internalMatches were missed during the
pause, and then the rule is subsequently scheduled again to continue in sync
with the timer setting.
-The `calendar` attribute in DRL rules is a
http://www.quartz-scheduler.org/[Quartz] calendar definition for scheduling a
rule and supports the following format:
+The `calendar` attribute in DRL rules is a
http://www.quartz-scheduler.org/[Quartz] style cron expression for scheduling a
rule and supports the following format:
.Calendar attribute format
[source,subs="+quotes"]
@@ -1108,18 +1108,24 @@ calendars "* * 0-7,18-23 ? * *"
calendars "weekday"
----
-You can adapt a Quartz calendar based on the Quartz calendar API and then
register the calendar in the KIE session, as shown in the following example:
+You can define a custom calendar and then register it in the KIE session, as
shown in the following example:
-.Adapting a Quartz Calendar
+.Defining a Calendar
[source,java]
----
-Calendar weekDayCal = QuartzHelper.quartzCalendarAdapter(org.quartz.Calendar
quartzCal)
+private static final org.kie.api.time.Calendar WEEKDAY = timestamp -> {
+ final Calendar c = Calendar.getInstance();
+ c.setTimeInMillis(timestamp);
+
+ final int day = c.get(Calendar.DAY_OF_WEEK);
+ return day != Calendar.SATURDAY && day != Calendar.SUNDAY;
+};
----
.Registering the calendar in the KIE session
[source,java]
----
-ksession.getCalendars().set( "weekday", weekDayCal );
+ksession.getCalendars().set( "weekday", WEEKDAY );
----
You can use calendars with standard rules and with rules that use timers. The
calendar attribute can contain one or more comma-separated calendar names
written as `String` literals.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]