Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
7538913
Add access to various system registries, OSGi instances and the abili…
Apr 9, 2026
831ac4e
Set required startlevel in ScriptEngineOSGiTest
Apr 9, 2026
6839f30
Make RuleManager a dynamic reference
Apr 10, 2026
9921c74
Revert "Set required startlevel in ScriptEngineOSGiTest"
Apr 10, 2026
135e265
Add additional convenience methods
Apr 10, 2026
24f7e63
Add more overloads
Apr 10, 2026
252c1f2
Fix socket leak
Apr 11, 2026
321ef89
Reorganize classes and implement extensions
Apr 11, 2026
f926dbd
Complete reorganization
May 17, 2026
96886d6
Add missed JavaDocs
May 20, 2026
9372b3e
Fix missed JavaDocs
May 20, 2026
46eba83
Modify implicit imports:
May 22, 2026
06fc762
Call existing static methods from RuleExtensions, some further JavaDo…
May 22, 2026
bffd0a9
Revise implicit imports
May 28, 2026
c1dbebd
Add TimeZone and Locale to available providers and methods
May 30, 2026
09efd8c
Move "helper" classes to existing package with similar content
May 31, 2026
59cce44
Address some review comments
Jun 4, 2026
acefac3
Remove export of no longer existing package
Jun 4, 2026
e88832f
Add missing import
Jun 4, 2026
9b1bf11
Move common methods to new class Utils and try to get map nullness un…
Jun 4, 2026
1449a9c
Create tests for Rules.java
Jun 5, 2026
815f081
Create tests for Items.java
Jun 5, 2026
c890aa1
Create tests for Channels.java
Jun 6, 2026
d4536b8
Create tests for ItemExtensions.java and RuleExtensions.java
Jun 6, 2026
8542a9a
Reintroduce warnings and reduce logging flexibility
Jun 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void runNow(String uid) {
}

@Override
public void runNow(String uid, boolean considerConditions, @Nullable Map<String, Object> context) {
public void runNow(String uid, boolean considerConditions, @Nullable Map<String, @Nullable Object> context) {
callback.runNow(uid, considerConditions, context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ public Response regenerateRule(@PathParam("ruleUID") @Parameter(description = "r
@ApiResponse(responseCode = "200", description = "OK"),
@ApiResponse(responseCode = "404", description = "Rule corresponding to the given UID was not found.") })
public Response runNow(@PathParam("ruleUID") @Parameter(description = "ruleUID") String ruleUID,
@Nullable @Parameter(description = "the context for running this rule", allowEmptyValue = true) Map<String, Object> context)
@Nullable @Parameter(description = "the context for running this rule", allowEmptyValue = true) Map<String, @Nullable Object> context)
throws IOException {
Rule rule = ruleRegistry.get(ruleUID);
if (rule == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,5 @@ public interface ModuleHandlerCallback {
* @param considerConditions if {@code true} the conditions of the rule will be checked.
* @param context the context that is passed to the conditions and the actions of the rule.
*/
void runNow(String uid, boolean considerConditions, @Nullable Map<String, Object> context);
void runNow(String uid, boolean considerConditions, @Nullable Map<String, @Nullable Object> context);
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public interface RuleManager {
* @param uid id of the rule whose actions have to be executed.
* @return a copy of the rule context, including possible return values
*/
Map<String, Object> runNow(String uid);
Map<String, @Nullable Object> runNow(String uid);

/**
* Same as {@link #runNow(String)} with the additional option to enable/disable evaluation of
Expand All @@ -97,7 +97,8 @@ public interface RuleManager {
* @param context the context that is passed to the conditions and the actions of the rule.
* @return a copy of the rule context, including possible return values
*/
Map<String, Object> runNow(String uid, boolean considerConditions, @Nullable Map<String, Object> context);
Map<String, @Nullable Object> runNow(String uid, boolean considerConditions,
@Nullable Map<String, @Nullable Object> context);

/**
* Simulates the execution of all rules with tag 'Schedule' for the given time interval.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public void runNow(String uid) {
}

@Override
public void runNow(String uid, boolean considerConditions, @Nullable Map<String, Object> context) {
public void runNow(String uid, boolean considerConditions, @Nullable Map<String, @Nullable Object> context) {
RuleEngineImpl.this.runNow(uid, considerConditions, context);
}
};
Expand Down Expand Up @@ -1141,7 +1141,7 @@ protected void runRule(String ruleUID, TriggerHandlerCallbackImpl.TriggerData td

@Override
public Map<String, @Nullable Object> runNow(String ruleUID, boolean considerConditions,
@Nullable Map<String, Object> context) {
@Nullable Map<String, @Nullable Object> context) {
final WrappedRule rule = getManagedRule(ruleUID);
if (rule == null) {
logger.warn("Failed to execute rule '{}': Invalid Rule UID", ruleUID);
Expand Down Expand Up @@ -1706,7 +1706,7 @@ protected void modified(Map<String, Object> configuration) {
}
}

private void updateDisabledRulesCleanupDelay(Map<String, Object> configuration) {
private void updateDisabledRulesCleanupDelay(@Nullable Map<String, Object> configuration) {
Comment thread
Nadahar marked this conversation as resolved.
Outdated
if (configuration == null) {
disabledRulesCleanupDelayMinutes = 30L;
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void runNow(String uid) {
}

@Override
public void runNow(String uid, boolean considerConditions, @Nullable Map<String, Object> context) {
public void runNow(String uid, boolean considerConditions, @Nullable Map<String, @Nullable Object> context) {
re.runNow(uid, considerConditions, context);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public void runNow(String uid) {
}

@Override
public void runNow(String uid, boolean considerConditions, @Nullable Map<String, Object> context) {
public void runNow(String uid, boolean considerConditions, @Nullable Map<String, @Nullable Object> context) {
callback.runNow(uid, considerConditions, context);
}
}
1 change: 1 addition & 0 deletions bundles/org.openhab.core.model.rule/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Import-Package: \
org.openhab.core.model.items,\
org.openhab.core.model.script,\
org.openhab.core.model.script.engine.action,\
org.openhab.core.model.script.lib,\
org.openhab.core.persistence,\
Comment thread
Nadahar marked this conversation as resolved.
org.openhab.core.persistence.extensions,\
org.openhab.core.service,\
Expand Down
3 changes: 3 additions & 0 deletions bundles/org.openhab.core.model.script/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ Import-Package: \
org.openhab.core.automation.module.script.action,\
org.openhab.core.automation.module.script.rulesupport.shared,\
org.openhab.core.common.registry,\
org.openhab.core.config.core,\
org.openhab.core.ephemeris,\
org.openhab.core.events,\
org.openhab.core.i18n,\
org.openhab.core.io.console,\
Comment thread
Nadahar marked this conversation as resolved.
org.openhab.core.io.console.extensions,\
org.openhab.core.io.net.exec,\
Expand All @@ -42,6 +44,7 @@ Import-Package: \
org.openhab.core.thing,\
org.openhab.core.thing.binding,\
org.openhab.core.thing.events,\
org.openhab.core.thing.link,\
org.openhab.core.transform,\
org.openhab.core.transform.actions,\
org.openhab.core.types,\
Expand Down
5 changes: 5 additions & 0 deletions bundles/org.openhab.core.model.script/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
<artifactId>org.openhab.core.io.net</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.automation</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.core.bundles</groupId>
<artifactId>org.openhab.core.automation.module.script</artifactId>
Expand Down
Loading
Loading