]> git.basschouten.com Git - openhab-addons.git/blob
cb469f52639fd7ced2b0e1f4aa6facb61f0a2c9a
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2022 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.binding.digitalstrom.internal.lib.manager;
14
15 import java.util.List;
16 import java.util.Map;
17 import java.util.Set;
18
19 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Circuit;
20 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device;
21 import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.impl.DSID;
22
23 /**
24  * The {@link StructureManager} builds the internal model of the digitalSTROM-System.
25  *
26  * @author Michael Ochel - Initial contribution
27  * @author Matthias Siegele - Initial contribution
28  */
29 public interface StructureManager {
30
31     /**
32      * Generates the zone- and group-names.
33      *
34      * @param connectionManager must not be null
35      * @return true, if it's generated, otherwise false
36      */
37     boolean generateZoneGroupNames(ConnectionManager connectionManager);
38
39     /**
40      * Returns the name of a zone or null, if the given zoneID dose not exists.<br>
41      * Note: Zone-names have to be generated over {@link #generateZoneGroupNames(ConnectionManager)}.
42      *
43      * @param zoneID of the zone
44      * @return zone-name
45      */
46     String getZoneName(int zoneID);
47
48     /**
49      * Returns the id of a given zone-name or -1, if the given zone-name dose not exists.<br>
50      * Note: Zone-names have to be generated over {@link #generateZoneGroupNames(ConnectionManager)}.
51      *
52      * @param zoneName of the zone
53      * @return zoneID
54      */
55     int getZoneId(String zoneName);
56
57     /**
58      * Returns the name of the given groupID from the given zoneID or null, if the zoneID or groupID dose not exists.
59      * <br>
60      * Note: Zone-group-names have to be generated over {@link #generateZoneGroupNames(ConnectionManager)}.
61      *
62      * @param zoneID of the group
63      * @param groupID of the group
64      * @return group-name
65      */
66     String getZoneGroupName(int zoneID, short groupID);
67
68     /**
69      * Returns the groupID of the given group-name from the given zone name or -1, if the zone-name or group name dose
70      * not exists.<br>
71      * Note: Zone-group-names have to be generated over {@link #generateZoneGroupNames(ConnectionManager)}.
72      *
73      * @param zoneName of the group
74      * @param groupName of the group
75      * @return group-id
76      */
77     short getZoneGroupId(String zoneName, String groupName);
78
79     /**
80      * Returns a new {@link Map} of all {@link Device}'s with the {@link DSID} as key and the {@link Device} as value.
81      * If no devices are found, an empty {@link Map} will be returned.
82      *
83      * @return device-map (cannot be null)
84      */
85     Map<DSID, Device> getDeviceMap();
86
87     /**
88      * Returns a reference to the {@link Map} of all {@link Device}'s with the {@link DSID} as key and the
89      * {@link Device} as value. If no devices are found, an empty {@link Map} will be returned.
90      *
91      * @return reference device-map
92      */
93     Map<DSID, Device> getDeviceHashMapReference();
94
95     /**
96      * Returns the reference of the structure as {@link Map}[zoneID, {@link Map}[groupID,
97      * {@link List}[{@link Device}]]].
98      *
99      * @return structure reference
100      */
101     Map<Integer, Map<Short, List<Device>>> getStructureReference();
102
103     /**
104      * Returns the Map of all groups as format HashMap[Short, List[Device]].
105      *
106      * @param zoneID of the zone
107      * @return groups
108      */
109     Map<Short, List<Device>> getGroupsFromZoneX(int zoneID);
110
111     /**
112      * Returns the reference {@link List} of the {@link Device}'s of an zone-group.
113      *
114      * @param zoneID of the zone
115      * @param groupID of the group
116      * @return reference device-list
117      */
118     List<Device> getReferenceDeviceListFromZoneXGroupX(int zoneID, short groupID);
119
120     /**
121      * Returns the {@link Device} of the given dSID as {@link String} or null if no {@link Device} exists.
122      *
123      * @param dSID of the device
124      * @return device
125      */
126     Device getDeviceByDSID(String dSID);
127
128     /**
129      * Returns the {@link Device} of the given dSID as {@link DSID} or null if no {@link Device} exists.
130      *
131      * @param dSID of the device
132      * @return device
133      */
134     Device getDeviceByDSID(DSID dSID);
135
136     /**
137      * Returns the {@link Device} of the given dSUID or null if no {@link Device} exists.
138      *
139      * @param dSUID of the device
140      * @return the {@link Device} with the given dSUID
141      */
142     Device getDeviceByDSUID(String dSUID);
143
144     /**
145      * Updates a {@link Device} of the structure.
146      *
147      * @param oldZone ID
148      * @param oldGroups ID's
149      * @param device new {@link Device}
150      */
151     void updateDevice(int oldZone, List<Short> oldGroups, Device device);
152
153     /**
154      * Updates a {@link Device} of the structure.
155      *
156      * @param device to update
157      */
158     void updateDevice(Device device);
159
160     /**
161      * Deletes a {@link Device} from the structure.
162      *
163      * @param device to delete
164      */
165     void deleteDevice(Device device);
166
167     /**
168      * Adds a {@link Device} to the structure.
169      *
170      * @param device to add
171      */
172     void addDeviceToStructure(Device device);
173
174     /**
175      * Returns a {@link Set} of all zoneID's
176      *
177      * @return zoneID's
178      */
179     Set<Integer> getZoneIDs();
180
181     /**
182      * Returns true, if a zone with the given zoneID exists, otherwise false.
183      *
184      * @param zoneID to check
185      * @return true = zoneID exists | false = zoneID not exists
186      */
187     boolean checkZoneID(int zoneID);
188
189     /**
190      * Returns true, if a zone-group with the given zoneID and groupID exists, otherwise false.
191      *
192      * @param zoneID to check
193      * @param groupID to check
194      * @return true = zoneID or groupID exists | false = zoneID or groupID not exists
195      */
196     boolean checkZoneGroupID(int zoneID, short groupID);
197
198     /**
199      * Adds the given {@link List} of {@link Circuit}'s to this {@link StructureManager}.
200      *
201      * @param referenceCircuitList to add
202      */
203     void addCircuitList(List<Circuit> referenceCircuitList);
204
205     /**
206      * Adds the given {@link Circuit} to this {@link StructureManager}.
207      *
208      * @param circuit to add
209      * @return the old {@link Circuit}, if the given {@link Circuit} was already added.
210      */
211     Circuit addCircuit(Circuit circuit);
212
213     /**
214      * Returns the {@link Circuit} with the given {@link DSID}.
215      *
216      * @param dSID of the {@link Circuit} to get
217      * @return the {@link Circuit} with the given {@link DSID}
218      */
219     Circuit getCircuitByDSID(DSID dSID);
220
221     /**
222      * Returns the {@link Circuit} with the given dSID as {@link String}.
223      *
224      * @param dSID of the {@link Circuit} to get
225      * @return the {@link Circuit} with the given dSID
226      */
227     Circuit getCircuitByDSID(String dSID);
228
229     /**
230      * Returns the {@link Circuit} with the given dSUID as {@link String}.
231      *
232      * @param dSUID of the {@link Circuit} to get
233      * @return the {@link Circuit} with the given dSUID
234      */
235     Circuit getCircuitByDSUID(String dSUID);
236
237     /**
238      * Updates the configuration of an added {@link Circuit} through a new {@link Circuit} object.
239      *
240      * @param newCircuit to update
241      * @return {@link Circuit} with the old configuration
242      */
243     Circuit updateCircuitConfig(Circuit newCircuit);
244
245     /**
246      * Deletes the {@link Circuit} with the given {@link DSID}.
247      *
248      * @param dSID of the {@link Circuit} to remove
249      * @return the removed {@link Circuit}
250      */
251     Circuit deleteCircuit(DSID dSID);
252
253     /**
254      * Deletes the {@link Circuit} with the given dSUID.
255      *
256      * @param dSUID of the {@link Circuit} to remove
257      * @return the removed {@link Circuit}
258      */
259     Circuit deleteCircuit(String dSUID);
260
261     /**
262      * Returns a {@link Map} of all {@link Circuit}'s which are added to this {@link StructureManager}.
263      *
264      * @return {@link Map} of all added {@link Circuit}'s
265      */
266     Map<DSID, Circuit> getCircuitMap();
267 }