Commit Graph

74 Commits

Author SHA1 Message Date
Kai Kreuzer
21e605d212
Apply spotless after release, resolve bundles (#4301)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2024-07-07 23:22:27 +02:00
openhab-bot
07e23eac3c [unleash-maven-plugin] Preparation for next development cycle. 2024-07-07 16:05:56 +00:00
Florian Hotze
7f47d825a0
[rest] Add caching for add-on resource (#4107)
* [rest] Introduce a CACHE_CONTROL constant
* [rest] Add caching for add-ons endpoint

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2024-03-27 19:37:36 +01:00
Wouter Born
2babea4c9a
Update license headers to 2024 (#4011)
Signed-off-by: Wouter Born <github@maindrain.net>
2024-01-03 21:20:34 +01:00
Florian Hotze
f5bd7f94f3
[rest] Add no-cache directive to cached REST responses (#3970)
Fixes https://github.com/openhab/openhab-webui/issues/2102.

This forces the browser to revalidate the cache every time it is accessed to ensure the data is always fresh.
See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#directives.

This is approach is also suggested in the mdn web docs, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#up-to-date_contents_always.

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2023-12-27 17:52:49 +01:00
Holger Friedrich
839ba1ab4c
Apply spotless after release, resolve bundles (#3953)
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
2023-12-22 23:14:28 +01:00
openhab-bot
3b279587b1 [unleash-maven-plugin] Preparation for next development cycle. 2023-12-22 11:48:43 +00:00
Wouter Born
09b3160a55
Simplify code using Stream.toList (#3831)
Stream.toList was introduced in Java 16 and creates an unmodifiable List so it can be used to simplify code whenever the List is not expected to be modified.

Signed-off-by: Wouter Born <github@maindrain.net>
2023-10-09 09:20:08 +02:00
Wouter Born
5daf4ff076
Fix SAT and null analysis issues (#3781)
Signed-off-by: Wouter Born <github@maindrain.net>
2023-08-27 11:15:15 +02:00
Florian Hotze
e1741cf61d
[rest] Add caching for TagResource & De-duplicate code for caching (#3729)
* [rest] Add caching for TagResource
* [core] Add & use RegistryChangedRunnableListener class

Signed-off-by: Florian Hotze <florianh_dev@icloud.com>
2023-07-25 20:59:39 +02:00
Kai Kreuzer
5692232e2b Apply spotless
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2023-07-24 01:11:37 +02:00
openhab-bot
fd93f0a766 [unleash-maven-plugin] Preparation for next development cycle. 2023-07-23 17:14:35 +00:00
Yannick Schaus
6e83d3f8de
"Cacheability" option for critical REST resources (#3335)
* Closes #3329.

This implements a new optional `cacheable` parameter for these REST endpoints:
- `/rest/items`
- `/rest/things`
- `/rest/rules`

When this parameter is set, a flat list of all elements excluding
non-cacheable fields (e.g. "state", "transformedState", "stateDescription",
"commandDescription" for items, "statusInfo", "firmwareStatus",
"properties" for things, "status" for rules) will be retrieved along with
a `Last-Modified` HTTP response header. When unknown, the Last-Modified
header will be set to the date of the request.

Also only when this parameter is set, and a `If-Modified-Since` header is
found in the request, that header will be compared to the last known
modified date for the corresponding cacheable list. The last modified date
will be reset when any change is made on the elements of the underlying
registry. If the `If-Modified-Since` date is equal or more recent than the
last modified date, then a 304 Not Modified response with no content will
be served instead of the usual 200 OK, informing the client that its
cache is still valid at the provided date.

All other request parameters will be ignored except for "metadata" in the
`/rest/items` endpoint. When a metadata selector is set, the resulting
item list will be considered like a completely different resource, i.e.
it will have its own last modified date. Regarding metadata, the approach
to invalidating last modified dates is very conservative: when any metadata
is changed, all cacheable lists of items will have their last modified date
reset even if the change was in a metadata namespace that wasn't requested.

This also implements the abovedescribed behavior for the
`/rest/ui/components/{namespace}` endpoint, but no `cacheable` parameter
is necessary. The last modified date is tracked by namespace.

Signed-off-by: Yannick Schaus <github@schaus.net>
2023-06-15 20:16:14 +02:00
J-N-K
88bb76c21c
Add event information in rules for time, manual and RunRuleAction trigger (#2965)
* Add event information for time triggers

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-05-28 10:15:16 +02:00
Holger Friedrich
769aa562a1
Code cleanup: Use Java 17 features (#3522)
Signed-off-by: Holger Friedrich <mail@holger-friedrich.de>
2023-04-16 21:43:59 +02:00
Wouter Born
4851bfbcae
Fix recently introduced SAT issues (#3516)
* Fix recently introduced SAT issues

Signed-off-by: Wouter Born <github@maindrain.net>
2023-04-01 17:18:22 +02:00
J-N-K
f48200caa6
Allow access to rule summary for Role.USERS (#3392)
Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-02-21 19:31:55 +01:00
J-N-K
c349c0114e
Fix CME in ThingActionsResource (#3365)
Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-02-12 13:21:26 +01:00
lolodomo
c079f2cfaf
[REST] Consider language when requesting thing actions (#3337)
Fix #3303

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
2023-01-26 11:06:38 +01:00
J-N-K
8d64ecfd8d
Update license header to 2023 (#3294)
* Update license header to 2023

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-01-03 09:45:42 +01:00
J-N-K
062e4a1758
[rest] Allow invoking ThingActions via API (#2810)
* [rest] Allow invoking ThingActions via API

Signed-off-by: Jan N. Klug <github@klug.nrw>
2023-01-01 21:13:39 +01:00
Wouter Born
687688db7e
Update Eclipse .classpath files (#3250)
Also adds some missing files for recently added projects.

Signed-off-by: Wouter Born <github@maindrain.net>
2022-12-22 14:14:35 +01:00
J-N-K
3fc4d23734
Fix spotless and resolve itests (#3239)
Signed-off-by: Jan N. Klug <github@klug.nrw>
2022-12-19 11:09:31 +01:00
openhab-bot
35254b3a0a [unleash-maven-plugin] Preparation for next development cycle. 2022-12-18 23:08:22 +00:00
J-N-K
b39f735b9d
[rest] Fix missing backward compatibility in rules/runNow (#3225)
Signed-off-by: Jan N. Klug <github@klug.nrw>
2022-12-12 20:48:45 +01:00
J-N-K
6479e4f818
[REST] allow running rules with context (#3160)
Signed-off-by: Jan N. Klug <github@klug.nrw>
2022-12-11 00:01:46 +01:00
Kai Kreuzer
61fd47c853
Apply spotless and resolver (#3018)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2022-06-27 13:41:28 +02:00
openhab-bot
8944bdbbe4 [unleash-maven-plugin] Preparation for next development cycle. 2022-06-26 16:37:00 +00:00
Wouter Born
9ff7ad43b9
Add more null annotations to automation bundles (#2763)
* Add more null annotations to automation bundles. This adds null annotations to many classes in the automation bundles and a few dimension classes.
* Further cleanup AutomationCommandExport
* Remove null from RuleStatusInfo JavaDocs. This should be clear from how the class is now annotated.
* Validate deserialized RuleStatusInfo
* Allow TriggerHandlerCallback to be triggered without providing a context

Signed-off-by: Wouter Born <github@maindrain.net>
2022-02-25 16:40:02 +01:00
Christoph Weitkamp
cabb3f7315
Update license headers to 2022 (#2671)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
2022-01-07 13:16:42 +01:00
Kai Kreuzer
e3b07782b4
pom reference update from http to https (#2644)
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2021-12-23 22:55:20 +01:00
Kai Kreuzer
1ebf7395d9 Apply spotless
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2021-12-20 06:59:22 +01:00
openhab-bot
5ac05c4968 [unleash-maven-plugin] Preparation for next development cycle. 2021-12-19 21:49:34 +00:00
Paul Vogel
7e5bf34d9e
RuleResource: Add schema specification for "Location" header (#2421)
Signed-off-by: Paul Vogel <github@paulvogel.me>
2021-07-05 23:09:17 +02:00
Kai Kreuzer
5a667cc868 applied spotless
Signed-off-by: Kai Kreuzer <kai@openhab.org>
2021-06-27 23:22:02 +02:00
jenkins
b8d2077805 [unleash-maven-plugin] Preparation for next development cycle. 2021-06-27 15:50:02 +00:00
Sönke Küper
cb36eb57e7
[rest] Added default values for rule simulation start and end dates and restricted the max. duration to < 180 days to prevent an denial-of-service. (#2296)
Fixes #2285 

Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
2021-04-27 21:21:00 +02:00
Sönke Küper
db488d861e
[automation] Added rule rest endpoint and backend operation for rule execution simulation (#2125)
* Added marker interface for TriggerHandler to indicate if they are time based and thus can be used to simulate execution times.
* Added marker interface for ConditionHandler to indicate, if they are time based and thus can be checked during rule execution for a certain time.
* Moved CronAdjuster to common, so it can be used for the rule simulation
* Created RuleExecutionSimulator that allows simulation of rules
* Added method in RuleManger to create simulation
* Added rest endpoint for rule simulation.
* Changed marker interface to return TemporalAdjuster instead of cron expression. This better hides the internals of the TriggerHandler (i.e. the cron expression) and is more clear and flexible for other handlers to implement

Fixes #2044
Fixes #2266

Signed-off-by: Sönke Küper <soenkekueper@gmx.de>
2021-04-11 09:31:48 +02:00
Wouter Born
b64c84e8b9
Fix wrong/missing OpenAPI ApiResponse content (#2258)
This fixes some issues where the response content is missing or wrong in the generated OpenAPI spec.

Signed-off-by: Wouter Born <github@maindrain.net>
2021-03-27 13:28:47 +01:00
Wouter Born
07b95ca668
Fix SAT findings (#2256)
Fixes 65 SAT findings.

Signed-off-by: Wouter Born <github@maindrain.net>
2021-03-25 20:18:08 +01:00
Paul van den Berg
eee30b0c57
Improved error logging when adding rules (#2053)
Improved error logging for adding rules

Signed-off-by: Paul van den Berg <prj.vandenberg@gmail.com>
2021-01-06 23:23:17 +01:00
Wouter Born
774b9d607b
Update license headers to 2021 (#2041)
Signed-off-by: Wouter Born <github@maindrain.net>
2021-01-01 16:43:46 +01:00
Wouter Born
bf14e1077f
Apply Spotless, resolve itest runbundles for 3.1.0 (#1982)
Signed-off-by: Wouter Born <github@maindrain.net>
2020-12-22 10:01:42 +01:00
jenkins
965531696b [unleash-maven-plugin] Preparation for next development cycle. 2020-12-20 22:24:39 +00:00
Christoph Hofmann
bbede78dc9
Added operationIds for OpenAPI specification (#1861)
Signed-off-by: Christoph Hofmann <christoph@hofmann.pm>
2020-12-10 23:12:11 +01:00
Yannick Schaus
065177b730
[rest] Add summary option to rules, things, UI components resources (#1827)
The /things, /rules, /ui/components endpoints retrieve all objects
in their entirety, which can become very big, i.e. channels, config
parameters, script rule modules or trees of UI components can
quickly add up to the size.

When the UI simply displays a list of those objects it retrieves all
this extra information but does nothing with it.

This introduces an optional ?summary=true query parameter for the
above resources to limit the output to pre-defined fields which are
deemed most relevant for displaying these lists, omitting the rest.

When the option is not set, the behavior remains unchanged so this
change is not API breaking. The API version has therefore not been
incremented. The client is responsible for adding the option to
retrieve summarized collections instead of the entire objects.

Signed-off-by: Yannick Schaus <github@schaus.net>
2020-11-21 18:40:48 +01:00
Wouter Born
0281c10036
[infrastructure] add external null-annotations (#1775)
Add EEAs and fix null analysis errors.

Related to:

* #888
* openhab/openhab-addons#8848

Signed-off-by: Wouter Born <github@maindrain.net>
2020-11-03 21:33:48 +01:00
Wouter Born
f5f1e32b9f
Add null annotations to ConfigDescriptionRegistry and ConfigUtil (#1641)
Also added "org.eclipse.jdt.annotation" to the test BOM so we can use "org.eclipse.jdt.annotation.Checks" in itests.
That class has many useful methods that help with writing more readable test code when using the Eclipse JDT null analysis annotations.

After running the resolver on the itests  a lot of bundles were removed from the itest.bndrun files.

Signed-off-by: Wouter Born <github@maindrain.net>
2020-09-15 17:00:15 +02:00
Wouter Born
29dfb967c4
Migrate to OpenAPI 3 annotations (#1576)
* Upgrade to Swagger 2.1.0
* Add missing root and events resources
* Fix wrong and add missing response implementations

Signed-off-by: Wouter Born <github@maindrain.net>
2020-08-02 13:21:57 +02:00
Yannick Schaus
aac4ca2f79
Swagger: support injection of ReaderListener, add OAuth2 annotations (#1496)
Signed-off-by: Yannick Schaus <github@schaus.net>
2020-07-24 22:30:06 +02:00