]> git.basschouten.com Git - openhab-addons.git/blob
d95d160e78e764831705905790311d815535d7c0
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.io.hueemulation.internal.rest.mocks;
14
15 import java.util.concurrent.ScheduledExecutorService;
16
17 import org.eclipse.jdt.annotation.NonNullByDefault;
18 import org.eclipse.jdt.annotation.Nullable;
19 import org.openhab.core.items.Item;
20 import org.openhab.core.net.NetworkAddressService;
21 import org.openhab.io.hueemulation.internal.ConfigStore;
22 import org.osgi.service.cm.ConfigurationAdmin;
23
24 /**
25  * Usually the metadata registry is used to map item UIDs to integer hue IDs.
26  * For tests we do not need this extra complexity and just map the item UID to the hue ID.
27  *
28  * @author David Graeff - Initial contribution
29  */
30 @NonNullByDefault
31 public class ConfigStoreWithoutMetadata extends ConfigStore {
32
33     public ConfigStoreWithoutMetadata(NetworkAddressService networkAddressService, ConfigurationAdmin configAdmin,
34             ScheduledExecutorService scheduler) {
35         super(networkAddressService, configAdmin, null, scheduler);
36     }
37
38     @Override
39     protected void determineHighestAssignedHueID() {
40     }
41
42     @Override
43     public String mapItemUIDtoHueID(@Nullable Item item) {
44         if (item == null) {
45             throw new IllegalArgumentException();
46         }
47         return item.getUID();
48     }
49 }