2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
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
11 * SPDX-License-Identifier: EPL-2.0
13 package org.openhab.binding.plugwiseha.internal.api.model.dto;
18 * The {@link Locations} class is an object model class that mirrors the XML
19 * structure provided by the Plugwise Home Automation controller for the
20 * collection of Plugwise locations/zones. It extends the
21 * {@link PlugwiseHACollection} class.
23 * @author B. van Wetten - Initial contribution
25 public class Locations extends PlugwiseHACollection<Location> {
28 public void merge(Map<String, Location> locations) {
29 if (locations != null) {
30 for (Location location : locations.values()) {
31 String id = location.getId();
32 Location originalLocation = this.get(id);
34 Boolean originalLocationIsOlder = false;
35 if (originalLocation != null) {
36 originalLocationIsOlder = originalLocation.isOlderThan(location);
39 if (originalLocation != null && originalLocationIsOlder) {
40 Logs updatedPointLogs = location.getPointLogs();
41 if (updatedPointLogs != null) {
42 updatedPointLogs.merge(originalLocation.getPointLogs());
45 ActuatorFunctionalities updatedActuatorFunctionalities = location.getActuatorFunctionalities();
46 if (updatedActuatorFunctionalities != null) {
47 updatedActuatorFunctionalities.merge(originalLocation.getActuatorFunctionalities());
50 this.put(id, location);