]> git.basschouten.com Git - openhab-addons.git/blob
1dbffd538072c27203800bf6c428fe942da8b628
[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.binding.avmfritz.internal.dto.templates;
14
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlAttribute;
18 import javax.xml.bind.annotation.XmlElement;
19 import javax.xml.bind.annotation.XmlType;
20
21 import org.openhab.core.types.CommandOption;
22
23 /**
24  * See {@link TemplateListModel}.
25  *
26  * @author Christoph Weitkamp - Initial contribution
27  */
28 @XmlAccessorType(XmlAccessType.FIELD)
29 @XmlType(name = "template")
30 public class TemplateModel {
31
32     @XmlAttribute(name = "identifier")
33     private String identifier;
34
35     @XmlAttribute(name = "id")
36     private String templateId;
37
38     @XmlAttribute(name = "functionbitmask")
39     private int functionbitmask;
40
41     @XmlAttribute(name = "applymask")
42     private int applymask;
43
44     @XmlElement(name = "name")
45     private String name;
46
47     @XmlElement(name = "devices")
48     private DeviceListModel deviceList;
49
50     @XmlElement(name = "applymask")
51     private ApplyMaskListModel applyMaskList;
52
53     public String getIdentifier() {
54         return identifier != null ? identifier.replace(" ", "") : null;
55     }
56
57     public String getTemplateId() {
58         return templateId;
59     }
60
61     public String getName() {
62         return name;
63     }
64
65     public DeviceListModel getDeviceList() {
66         return deviceList;
67     }
68
69     public ApplyMaskListModel getApplyMaskList() {
70         return applyMaskList;
71     }
72
73     public CommandOption toCommandOption() {
74         return new CommandOption(getIdentifier(), getName());
75     }
76
77     @Override
78     public String toString() {
79         return new StringBuilder().append("[identifier=").append(identifier).append(",id=").append(templateId)
80                 .append(",functionbitmask=").append(functionbitmask).append(",applymask=").append(applymask)
81                 .append(",name=").append(name).append(",devices=").append(deviceList).append(",applymasks=")
82                 .append(applyMaskList).append("]").toString();
83     }
84 }