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.innogysmarthome.internal.client.entity.action;
15 import org.openhab.binding.innogysmarthome.internal.client.entity.link.Link;
18 * Implements the Action structure needed to send JSON actions to the innogy backend. They are used to e.g. switch the
21 * @author Oliver Kuhl - Initial contribution
25 public static final String ACTION_TYPE_SETSTATE = "SetState";
26 private static final String NAMESPACE_CORE_RWE = "core.RWE";
29 * Specifies the type of the action.
34 * Link to the entity supposed to execute the action.
36 private String target;
39 * The product (context) that should handle (execute) the action. Defaults to {@link Action#NAMESPACE_CORE_RWE}.
41 private String namespace = NAMESPACE_CORE_RWE;
44 * Dictionary of functions required for the intended execution of the action.
46 private ActionParams params;
49 * Default constructor, used by serialization.
52 // used by serialization
56 * Sets the type of the action. Usual action type is {@link Action#ACTION_TYPE_SETSTATE}.
60 public Action(String type) {
67 public String getType() {
72 * @param type the type to set
74 public void setType(String type) {
79 * @return the link to the target capability
81 public String getTarget() {
86 * @param target the link to the target capability to set
88 public void setTarget(String target) {
93 * @return the namespace
95 public String getNamespace() {
100 * @param namespace the namespace to set
102 public void setNamespace(String namespace) {
103 this.namespace = namespace;
107 * Sets the link target to the given capability id.
109 * @param capabilityId String with the 32 character long id
111 public void setTargetCapabilityById(String capabilityId) {
112 setTarget(Link.LINK_TYPE_CAPABILITY + capabilityId);
118 public ActionParams getParams() {
123 * @param params the params to set
125 public void setParams(ActionParams params) {
126 this.params = params;