-
-
Notifications
You must be signed in to change notification settings - Fork 429
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[persistence] Don't require relative
, inverted
and unit
fields for filter configuration over REST
#3681
Conversation
…tive, inverted if those are null This allows MainUI to send requests without ensuring that these fields are set. Signed-off-by: Florian Hotze <[email protected]>
Depends on openhab/openhab-core#3681. Signed-off-by: Florian Hotze <[email protected]>
relative
, inverted
and unit
fields in REST requestrelative
, inverted
and unit
fields for filter configuration over REST
I'm not sure this is the best way. IMO it would better to make the constructors accept a null value and set the default in the filter class. That makes it much clearer what the default is and also works in other places. WDYT? |
Isn't it better to make this particular DTO mapper non-static? It seems to be that |
I will try that. |
I am currently on holiday in France, so I won’t be able to work on this soon. Let’s postpone it for openHAB 4.1, since the feature freeze will start on Sunday. |
Depends on openhab/openhab-core#3681. Signed-off-by: Florian Hotze <[email protected]>
Depends on openhab/openhab-core#3681. Signed-off-by: Florian Hotze <[email protected]>
Setting up a treshold filter with the UI, it did not work because the unit field was blank. I got an NPE from PersistenceTresholdFilter, and the PersistenceIncludeFilter would also throw a NPE in that case. For PersistenceTimeFilter, defaulting to "s" is just cosmetic. Picks-up PR #3681 and should be merged for the 4.0 release, because the UI does not prevent the unit field from being null. Signed-off-by: Florian Hotze <[email protected]>
While creating the persistence edit page, I noticed that PUT
/rest/persistence/{serviceId}
requests fail when the boolean propertiesinverted
andrelative
of some persistence filters are not set. First, I ensured that they are set when the UI saves the persistence configuration, however IMO this should be in core.Setting up a treshold filter with the UI, it did not work because the
unit
field was blank (I got an NPE fromPersistenceTresholdFilter
, and thePersistenceIncludeFilter
would also throw a NPE.This PR sets reasonable defaults for those fields that are required by core, but not neccassarily set by the user.
/cc @J-N-K