]> git.basschouten.com Git - openhab-addons.git/blob
e7d877cb4a31853834e36c418c77b622178a7450
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2020 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.NonNull;
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 public class ConfigStoreWithoutMetadata extends ConfigStore {
31
32     public ConfigStoreWithoutMetadata(NetworkAddressService networkAddressService, ConfigurationAdmin configAdmin,
33             ScheduledExecutorService scheduler) {
34         super(networkAddressService, configAdmin, null, scheduler);
35     }
36
37     @Override
38     protected void determineHighestAssignedHueID() {
39     }
40
41     @Override
42     public @NonNull String mapItemUIDtoHueID(@Nullable Item item) {
43         if (item == null) {
44             throw new IllegalArgumentException();
45         }
46         return item.getUID();
47     }
48 }