]> git.basschouten.com Git - openhab-addons.git/blob
66c232acb5dfb9f64e68575f40b1662c99be740f
[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.livisismarthome.internal.client.api.entity.action;
14
15 import org.openhab.binding.livisismarthome.internal.client.api.entity.link.LinkDTO;
16
17 /**
18  * Implements the Action structure needed to send JSON actions to the LIVISI backend. They are used to e.g. switch the
19  * state of a device.
20  *
21  * @author Oliver Kuhl - Initial contribution
22  */
23 public class ActionDTO {
24
25     private static final String NAMESPACE_CORE_RWE = "core.RWE";
26
27     /**
28      * Specifies the type of the action.
29      */
30     private String type;
31
32     /**
33      * Link to the entity supposed to execute the action.
34      */
35     private String target;
36
37     /**
38      * The product (context) that should handle (execute) the action. Defaults to {@link ActionDTO#NAMESPACE_CORE_RWE}.
39      */
40     private String namespace = NAMESPACE_CORE_RWE;
41
42     /**
43      * Dictionary of functions required for the intended execution of the action.
44      */
45     private ActionParamsDTO params;
46
47     /**
48      * Default constructor, used by serialization.
49      */
50     public ActionDTO() {
51         // used by serialization
52     }
53
54     /**
55      * @return the type
56      */
57     public String getType() {
58         return type;
59     }
60
61     /**
62      * @param type the type to set
63      */
64     public void setType(String type) {
65         this.type = type;
66     }
67
68     /**
69      * @return the link to the target capability
70      */
71     public String getTarget() {
72         return target;
73     }
74
75     /**
76      * @param target the link to the target capability to set
77      */
78     public void setTarget(String target) {
79         this.target = target;
80     }
81
82     /**
83      * @return the namespace
84      */
85     public String getNamespace() {
86         return namespace;
87     }
88
89     /**
90      * @param namespace the namespace to set
91      */
92     public void setNamespace(String namespace) {
93         this.namespace = namespace;
94     }
95
96     /**
97      * Sets the link target to the given capability id.
98      *
99      * @param capabilityId String with the 32 character long id
100      */
101     public void setTargetCapabilityById(String capabilityId) {
102         setTarget(LinkDTO.LINK_TYPE_CAPABILITY + capabilityId);
103     }
104
105     /**
106      * @return the params
107      */
108     public ActionParamsDTO getParams() {
109         return params;
110     }
111
112     /**
113      * @param params the params to set
114      */
115     public void setParams(ActionParamsDTO params) {
116         this.params = params;
117     }
118 }