Skip to content

Commit 77bd351

Browse files
committed
heath check no store strategy
Signed-off-by: Mark Herwege <[email protected]>
1 parent 6dbe03a commit 77bd351

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

bundles/org.openhab.core.io.rest.core/src/main/java/org/openhab/core/io/rest/core/internal/persistence/PersistenceResource.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
import org.openhab.core.persistence.registry.PersistenceServiceConfiguration;
7878
import org.openhab.core.persistence.registry.PersistenceServiceConfigurationDTOMapper;
7979
import org.openhab.core.persistence.registry.PersistenceServiceConfigurationRegistry;
80+
import org.openhab.core.persistence.strategy.PersistenceStrategy;
8081
import org.openhab.core.types.State;
8182
import org.openhab.core.types.TypeParser;
8283
import org.openhab.core.types.UnDefType;
@@ -392,11 +393,17 @@ public Response httpGetPersistenceHealth(@Context HttpHeaders headers) {
392393
PersistenceServiceProblem.PERSISTENCE_NO_ITEMS, serviceId, null, editable));
393394
} else {
394395
for (PersistenceItemConfiguration config : configs) {
395-
if (config.strategies().isEmpty()) {
396-
List<String> items = config.items().stream()
397-
.map(PersistenceServiceConfigurationDTOMapper::persistenceConfigToString).toList();
396+
List<PersistenceStrategy> strategies = config.strategies();
397+
List<String> items = config.items().stream()
398+
.map(PersistenceServiceConfigurationDTOMapper::persistenceConfigToString).toList();
399+
if (strategies.isEmpty()) {
398400
persistenceProblems.add(new PersistenceServiceProblem(
399401
PersistenceServiceProblem.PERSISTENCE_NO_STRATEGY, serviceId, items, editable));
402+
} else if (strategies.size() == 1
403+
&& PersistenceStrategy.Globals.RESTORE.equals(strategies.get(0))) {
404+
persistenceProblems.add(new PersistenceServiceProblem(
405+
PersistenceServiceProblem.PERSISTENCE_NO_STORE_STRATEGY, serviceId, items,
406+
editable));
400407
}
401408
}
402409
}

bundles/org.openhab.core.persistence/src/main/java/org/openhab/core/persistence/PersistenceServiceProblem.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ public record PersistenceServiceProblem(String reason, @Nullable String serviceI
3232
boolean editable) {
3333

3434
// Reasons for persistence configuration problems.
35-
// If one of these constants is used as reason, th UI can use these values to give a more descriptive message.
35+
// If one of these constants is used as reason, the UI can use these values to give a more descriptive message.
3636
public static final String PERSISTENCE_NO_DEFAULT = "PERSISTENCE_NO_DEFAULT";
3737
public static final String PERSISTENCE_NO_CONFIG = "PERSISTENCE_SERVICE_NO_CONFIG";
3838
public static final String PERSISTENCE_NO_ITEMS = "PERSISTENCE_SERVICE_NO_ITEMS";
3939
public static final String PERSISTENCE_NO_STRATEGY = "PERSISTENCE_SERVICE_ITEMS_NO_STRATEGY";
40+
public static final String PERSISTENCE_NO_STORE_STRATEGY = "PERSISTENCE_SERVICE_ITEMS_NO_STORE_STRATEGY";
4041
}

0 commit comments

Comments
 (0)