[digitalstrom] code refactoring (#14402)

Signed-off-by: lsiepel <leosiepel@gmail.com>
This commit is contained in:
lsiepel 2023-02-18 18:15:27 +01:00 committed by GitHub
parent 253b25631f
commit 9a2bfcf0b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 95 additions and 109 deletions

View File

@ -26,12 +26,10 @@ import org.openhab.binding.digitalstrom.internal.handler.BridgeHandler;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Circuit;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.GeneralDeviceInformation;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.OutputModeEnum;
import org.openhab.binding.digitalstrom.internal.providers.DsDeviceThingTypeProvider;
import org.openhab.core.config.discovery.AbstractDiscoveryService;
import org.openhab.core.config.discovery.DiscoveryResult;
import org.openhab.core.config.discovery.DiscoveryResultBuilder;
import org.openhab.core.thing.Thing;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.ThingUID;
import org.slf4j.Logger;

View File

@ -37,7 +37,6 @@ import org.openhab.binding.digitalstrom.internal.providers.DsDeviceThingTypeProv
import org.openhab.core.config.discovery.AbstractDiscoveryService;
import org.openhab.core.config.discovery.DiscoveryService;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.type.ThingType;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.slf4j.Logger;

View File

@ -24,7 +24,6 @@ import java.util.HashSet;
import java.util.Map;
import org.openhab.binding.digitalstrom.internal.handler.BridgeHandler;
import org.openhab.binding.digitalstrom.internal.handler.SceneHandler;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.ApplicationGroup;
import org.openhab.binding.digitalstrom.internal.lib.structure.scene.InternalScene;
import org.openhab.binding.digitalstrom.internal.lib.structure.scene.constants.SceneEnum;

View File

@ -22,7 +22,6 @@ import java.util.Map;
import org.openhab.binding.digitalstrom.internal.DigitalSTROMBindingConstants;
import org.openhab.binding.digitalstrom.internal.handler.BridgeHandler;
import org.openhab.binding.digitalstrom.internal.handler.ZoneTemperatureControlHandler;
import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.TemperatureControlStatus;
import org.openhab.core.config.discovery.AbstractDiscoveryService;
import org.openhab.core.config.discovery.DiscoveryResult;
@ -38,8 +37,8 @@ import org.slf4j.LoggerFactory;
* {@link #ZoneTemperatureControlDiscoveryService(BridgeHandler, ThingTypeUID)} as {@link ThingTypeUID}. The supported
* {@link ThingTypeUID} can be found at {@link ZoneTemperatureControlHandler#SUPPORTED_THING_TYPES}
*
* @author Michael Ochel
* @author Matthias Siegele
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class ZoneTemperatureControlDiscoveryService extends AbstractDiscoveryService {

View File

@ -28,7 +28,6 @@ import org.openhab.binding.digitalstrom.internal.lib.climate.constants.ControlSt
import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.TemperatureControlStatus;
import org.openhab.binding.digitalstrom.internal.lib.listener.TemperatureControlStatusListener;
import org.openhab.binding.digitalstrom.internal.lib.manager.StructureManager;
import org.openhab.binding.digitalstrom.internal.lib.manager.impl.TemperatureControlManager;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.ApplicationGroup;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.OutputChannelEnum;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.OutputModeEnum;

View File

@ -16,8 +16,8 @@ package org.openhab.binding.digitalstrom.internal.lib.climate;
* The {@link TemperatureControlSensorTransmitter} can be implement by subclasses to implement a
* transmitter which can be used to push the target temperature or control value to a digitalSTROM zone.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public interface TemperatureControlSensorTransmitter {

View File

@ -28,8 +28,8 @@ import org.openhab.binding.digitalstrom.internal.lib.event.types.EventItem;
* <br>
* To handle the {@link EventItem} the method {@link #handleEvent(EventItem)} has to be implemented.
*
* @author Michael Ochel
* @author Matthias Siegele
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public interface EventHandler {

View File

@ -15,8 +15,8 @@ package org.openhab.binding.digitalstrom.internal.lib.event.constants;
/**
* The {@link EventNames} contains all needed event names to subscribe at the digitalSTROM server.
*
* @author Michael Ochel
* @author Matthias Siegele
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class EventNames {

View File

@ -18,8 +18,8 @@ import java.util.Map;
/**
* The {@link EventResponseEnum} contains digitalSTROM-Event properties of the events at {@link EventNames}.
*
* @author Michael Ochel
* @author Mathias Siegele
* @author Michael Ochel - Initial contribution
* @author Mathias Siegele - Initial contribution
*/
public enum EventResponseEnum {

View File

@ -17,7 +17,7 @@ import java.util.List;
/**
* The {@link Event} represents a digitalSTROM-Event.
*
* @author Alexander Betker
* @author Alexander Betker - Initial contribution
*/
public interface Event {

View File

@ -19,7 +19,7 @@ import org.openhab.binding.digitalstrom.internal.lib.event.constants.EventRespon
/**
* The {@link EventItem} represents an event item of a digitalSTROM-Event.
*
* @author Alexander Betker
* @author Alexander Betker - Initial contribution
* @author Michael Ochel - add getSource()
* @author Matthias Siegele - add getSource()
*/

View File

@ -26,8 +26,8 @@ import com.google.gson.JsonObject;
/**
* The {@link EventItemImpl} is the implementation of the {@link EventItem}.
*
* @author Michael Ochel
* @author Mathias Siegele
* @author Michael Ochel - Initial contribution
* @author Mathias Siegele - Initial contribution
*/
public class EventItemImpl implements EventItem {

View File

@ -21,7 +21,7 @@ import com.google.gson.JsonObject;
/**
* The {@link JSONEventImpl} is the implementation of the {@link Event}.
*
* @author Alexander Betker
* @author Alexander Betker - Initial contribution
*/
public class JSONEventImpl implements Event {

View File

@ -16,8 +16,8 @@ package org.openhab.binding.digitalstrom.internal.lib.listener;
* The {@link SystemStateChangeListener} can be implemented to get informed by digitalSTROM system state changes. It
* has to be registered by supported classes, e.g. the {@link TemperatureControlManager} or self implemented classes.
*
* @author Michael Ochel
* @author Matthias Siegele
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public interface SystemStateChangeListener {

View File

@ -20,8 +20,8 @@ import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontain
* <br>
* It also can be implemented as discovery, than the id have to be {@link #DISCOVERY}.
*
* @author Michael Ochel
* @author Matthias Siegele
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*
*/
public interface TemperatureControlStatusListener {

View File

@ -39,7 +39,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
* Query to get all enabled application tokens. Can be executed with {@link DsAPI#query(String, String)} or
* {@link DsAPI#query2(String, String)}.
*/
public final String QUERY_GET_ENABLED_APPLICATION_TOKENS = "/system/security/applicationTokens/enabled/*(*)";
public static final String QUERY_GET_ENABLED_APPLICATION_TOKENS = "/system/security/applicationTokens/enabled/*(*)";
private final Logger logger = LoggerFactory.getLogger(ConnectionManagerImpl.class);
private Config config;

View File

@ -230,8 +230,8 @@ public class DeviceStatusManagerImpl implements DeviceStatusManager {
/**
* Check and updates the {@link Device} structure, configurations and status.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
private class PollingRunnable implements Runnable {
private boolean devicesLoaded = false;

View File

@ -21,7 +21,6 @@ import java.util.Set;
import org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager;
import org.openhab.binding.digitalstrom.internal.lib.manager.StructureManager;
import org.openhab.binding.digitalstrom.internal.lib.serverconnection.DsAPI;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.AbstractGeneralDeviceInformations;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Circuit;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device;

View File

@ -55,12 +55,12 @@ import org.slf4j.LoggerFactory;
* {@link #GET_HEATING_WATER_SYSTEM_STATE_PATH} to get the current heating water system state through
* {@link DsAPI#propertyTreeGetString(String, String)}.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class TemperatureControlManager implements EventHandler, TemperatureControlSensorTransmitter {
private final List<String> SUPPORTED_EVENTS = Arrays.asList(EventNames.HEATING_CONTROL_OPERATION_MODE);
private static final List<String> SUPPORTED_EVENTS = Arrays.asList(EventNames.HEATING_CONTROL_OPERATION_MODE);
private final Logger logger = LoggerFactory.getLogger(TemperatureControlManager.class);
@ -294,7 +294,6 @@ public class TemperatureControlManager implements EventHandler, TemperatureContr
Integer zoneID = Integer
.parseInt(eventItem.getSource().getOrDefault(EventResponseEnum.ZONEID, ""));
if (zoneTemperationControlListenerMap.get(zoneID) != null) {
Float newValue = Float.parseFloat(
eventItem.getProperties().getOrDefault(EventResponseEnum.SENSOR_VALUE_FLOAT, ""));
if (!isEcho(zoneID, SensorEnum.ROOM_TEMPERATURE_CONTROL_VARIABLE, newValue)) {

View File

@ -15,8 +15,6 @@ package org.openhab.binding.digitalstrom.internal.lib.serverconnection;
import java.util.List;
import java.util.Map;
import org.openhab.binding.digitalstrom.internal.lib.climate.constants.ControlModes;
import org.openhab.binding.digitalstrom.internal.lib.climate.constants.OperationModes;
import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.BaseSensorValues;
import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.AssignedSensors;
import org.openhab.binding.digitalstrom.internal.lib.climate.jsonresponsecontainer.impl.SensorValues;
@ -45,7 +43,7 @@ import com.google.gson.JsonObject;
* digitalSTROM-API based on dSS-Version higher then 1.14.5.
* digitalSTROM documentation can be found at http://developer.digitalstrom.org/Architecture/v1.1/dss-json.pdf
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
*
* @author Michael Ochel - add missing java-doc, update digitalSTROM-JSON-API as far as possible to the pdf version from
* June 19, 2014 and add checkConnection method and ALL_METERS constant

View File

@ -15,7 +15,7 @@ package org.openhab.binding.digitalstrom.internal.lib.serverconnection.constants
/**
* The {@link JSONApiResponseKeysEnum} contains digitalSTROM-JSON response keys.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @author Michael Ochel completely changed and updated only methods remained
* @author Matthias Siegele completely changed and updated only methods remained
*/

View File

@ -69,8 +69,8 @@ import com.google.gson.JsonObject;
/**
* The {@link DsAPIImpl} is the implementation of the {@link DsAPI}.
*
* @author Alexander Betker - initial contributer
* @author Alex Maier - initial contributer
* @author Alexander Betker - Initial contribution
* @author Alex Maier - Initial contribution
* @author Michael Ochel - implements new methods, API updates and change SimpleJSON to GSON, add helper methods and
* requests building with constants to {@link SimpleRequestBuilder}
* @author Matthias Siegele - implements new methods, API updates and change SimpleJSON to GSON, add helper methods and
@ -281,12 +281,12 @@ public class DsAPIImpl implements DsAPI {
@Override
public DeviceConfig getDeviceConfig(String token, DSID dSID, String dSUID, String name,
DeviceParameterClassEnum class_, Integer index) {
if (checkRequiredDevice(dSID, dSUID, name) && class_ != null
DeviceParameterClassEnum classEnum, Integer index) {
if (checkRequiredDevice(dSID, dSUID, name) && classEnum != null
&& SimpleRequestBuilder.objectToString(index) != null) {
String response = transport.execute(SimpleRequestBuilder.buildNewJsonRequest(ClassKeys.DEVICE)
.addFunction(FunctionKeys.GET_CONFIG).addDefaultDeviceParameter(token, dSID, dSUID, name)
.addParameter(ParameterKeys.CLASS, class_.getClassIndex().toString())
.addParameter(ParameterKeys.CLASS, classEnum.getClassIndex().toString())
.addParameter(ParameterKeys.INDEX, SimpleRequestBuilder.objectToString(index))
.buildRequestString());

View File

@ -43,7 +43,6 @@ import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.lang3.StringUtils;
import org.openhab.binding.digitalstrom.internal.lib.config.Config;
import org.openhab.binding.digitalstrom.internal.lib.manager.ConnectionManager;
import org.openhab.binding.digitalstrom.internal.lib.serverconnection.HttpTransport;
@ -334,7 +333,8 @@ public class HttpTransportImpl implements HttpTransport {
}
private boolean checkNeededSessionToken(String request) {
String functionName = StringUtils.substringAfterLast(StringUtils.substringBefore(request, "?"), "/");
String requestFirstPart = request.substring(0, request.indexOf("?"));
String functionName = requestFirstPart.substring(requestFirstPart.lastIndexOf("/") + 1);
return !DsAPIImpl.METHODS_MUST_NOT_BE_LOGGED_IN.contains(functionName);
}
@ -347,9 +347,10 @@ public class HttpTransportImpl implements HttpTransport {
correctedRequest = correctedRequest + "?" + ParameterKeys.TOKEN + "=" + sessionToken;
}
} else {
correctedRequest = StringUtils.replaceOnce(correctedRequest, StringUtils.substringBefore(
StringUtils.substringAfter(correctedRequest, ParameterKeys.TOKEN + "="), "&"), sessionToken);
String strippedRequest = correctedRequest
.substring(correctedRequest.indexOf(ParameterKeys.TOKEN + "=") + ParameterKeys.TOKEN.length() + 1);
strippedRequest = strippedRequest.substring(0, strippedRequest.lastIndexOf("&"));
correctedRequest = correctedRequest.replaceFirst(strippedRequest, sessionToken);
}
return correctedRequest;
}

View File

@ -36,8 +36,8 @@ import org.openhab.binding.digitalstrom.internal.lib.structure.devices.devicepar
* <span style="padding-left:14em">{@link #buildRequestString()};<br>
* </span></i>
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class SimpleRequestBuilder {

View File

@ -15,8 +15,8 @@ package org.openhab.binding.digitalstrom.internal.lib.serverconnection.simpledsr
/**
* The {@link ClassKeys} contains digitalSTROM-JSON class keys.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class ClassKeys {

View File

@ -15,8 +15,8 @@ package org.openhab.binding.digitalstrom.internal.lib.serverconnection.simpledsr
/**
* The {@link ExeptionConstants} contains the {@link SimpleRequestBuilder} exception strings.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class ExeptionConstants {
public static final String NO_CLASS_ADDED = "No class added! Please add a class first!";

View File

@ -15,8 +15,8 @@ package org.openhab.binding.digitalstrom.internal.lib.serverconnection.simpledsr
/**
* The {@link FunctionKeys} contains digitalSTROM-JSON function keys.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class FunctionKeys {

View File

@ -15,8 +15,8 @@ package org.openhab.binding.digitalstrom.internal.lib.serverconnection.simpledsr
/**
* The {@link InterfaceKeys} contains digitalSTROM-JSON interface keys.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class InterfaceKeys {
public static final String JSON = "json";

View File

@ -15,8 +15,8 @@ package org.openhab.binding.digitalstrom.internal.lib.serverconnection.simpledsr
/**
* The {@link ParameterKeys} contains digitalSTROM-JSON parameter keys.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class ParameterKeys {
public static final String TOKEN = "token";

View File

@ -17,7 +17,7 @@ import java.util.Map;
/**
* The {@link Apartment} represents a digitalSTROM-Apartment.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @author Michael Ochel - add java-doc
* @author Matthias Siegele - add java-doc
*/

View File

@ -18,7 +18,7 @@ import java.util.List;
* The {@link DetailedGroupInfo} represents a digitalSTROM-Group with a list of all dSUID's of the included
* digitalSTROM-Devices.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @author Michael Ochel - add java-doc
* @author Matthias Siegele - add java-doc
*/

View File

@ -15,7 +15,7 @@ package org.openhab.binding.digitalstrom.internal.lib.structure;
/**
* The {@link Group} represents a digitalSTROM-Group.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @author Michael Ochel - add java-doc
* @author Matthias Siegele - add java-doc
*/

View File

@ -19,7 +19,7 @@ import org.openhab.binding.digitalstrom.internal.lib.structure.devices.Device;
/**
* The {@link Zone} represents a digitalSTROM-Zone.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @author Michael Ochel - add java-doc
* @author Matthias Siegele - add java-doc
*/

View File

@ -24,8 +24,8 @@ import com.google.gson.JsonObject;
* can be implement by subclasses which contains the same device informations like dSID and/or mechanismen like the
* {@link DeviceStatusListener}.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public abstract class AbstractGeneralDeviceInformations implements GeneralDeviceInformation {

View File

@ -24,8 +24,8 @@ import org.openhab.binding.digitalstrom.internal.lib.structure.devices.devicepar
* {@link DeviceStatusListener} can be registered. For that and to get the general device informations like the dSID the
* {@link Circuit} implements the {@link GeneralDeviceInformations} interface.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public interface Circuit extends GeneralDeviceInformation {

View File

@ -16,9 +16,7 @@ import java.util.List;
import java.util.Map;
import org.openhab.binding.digitalstrom.internal.lib.config.Config;
import org.openhab.binding.digitalstrom.internal.lib.event.constants.EventNames;
import org.openhab.binding.digitalstrom.internal.lib.event.types.EventItem;
import org.openhab.binding.digitalstrom.internal.lib.sensorjobexecutor.sensorjob.impl.DeviceConsumptionSensorJob;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.DeviceSceneSpec;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.DeviceStateUpdate;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.ApplicationGroup;

View File

@ -20,8 +20,8 @@ import org.openhab.binding.digitalstrom.internal.lib.structure.devices.devicepar
* identical for all device types. It also contains the methods to implement the mechanism of the
* {@link DeviceStatusListener}.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public interface GeneralDeviceInformation {

View File

@ -15,7 +15,7 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.devices.devicepa
/**
* The {@link DeviceConfig} saves device configurations.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @author Michael Ochel - add missing java-doc
* @author Matthias Siegele - add missing java-doc
*/

View File

@ -17,7 +17,7 @@ import org.openhab.binding.digitalstrom.internal.lib.structure.scene.constants.S
/**
* The {@link DeviceSceneSpec} saves a digitalSTROM-Device scene mode.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @author Michael Ochel - add missing java-doc
* @author Matthias Siegele - add missing java-doc
*/

View File

@ -15,8 +15,8 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.devices.devicepa
/**
* This enum contains all binary inputs with they id. <br>
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public enum DeviceBinarayInputEnum {

View File

@ -15,7 +15,7 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.devices.devicepa
/**
* The {@link DeviceParameterClassEnum} lists all digitalSTROM-device parameter classes.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @version digitalSTROM-API 1.14.5
*/
public enum DeviceParameterClassEnum {

View File

@ -18,7 +18,7 @@ import java.util.List;
/**
* The {@link MeteringTypeEnum} lists all available digitalSTROM metering types.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @author Michael Ochel - add MeteringUnitEnum list
* @author Matthias Siegele - add MeteringUnitEnum list
*/

View File

@ -15,7 +15,7 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.devices.devicepa
/**
* The {@link MeteringUnitsEnum} lists all available digitalSTROM metering units.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @author Michael Ochel - remove W, because it does not exist any more
* @author Matthias Siegele - remove W, because it does not exist any more
*/

View File

@ -15,15 +15,15 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.devices.devicepa
/**
* The {@link DSID} represents the digitalSTROM-Device identifier.
*
* @author Alexander Betker - initial contributor
* @author Alexander Betker - Initial contribution
* @author Alexander Friese - simplified constructor
*/
public class DSID {
private final String dsid;
private final String DEFAULT_DSID = "3504175fe000000000000001";
private final String PRE = "3504175fe0000000";
private final String ALL = "ALL";
private static final String DEFAULT_DSID = "3504175fe000000000000001";
private static final String PRE = "3504175fe0000000";
private static final String ALL = "ALL";
/**
* Creates a new {@link DSID}.
@ -35,7 +35,7 @@ public class DSID {
if (trimmedDsid.length() == 24) {
this.dsid = trimmedDsid;
} else if (trimmedDsid.length() == 8) {
this.dsid = this.PRE + trimmedDsid;
this.dsid = PRE + trimmedDsid;
} else if (trimmedDsid.toUpperCase().equals(ALL)) {
this.dsid = ALL;
} else {

View File

@ -15,12 +15,12 @@ package org.openhab.binding.digitalstrom.internal.lib.structure.devices.devicepa
/**
* The {@link DSUID} represents the digitalSTROM-Device unique identifier.
*
* @author Alexander Friese - initial contributor
* @author Alexander Friese - Initial contribution
*/
public class DSUID {
private final String dsuid;
private final String DEFAULT_DSUID = "3504175fe0000000000000000000000001";
private static final String DEFAULT_DSUID = "3504175fe0000000000000000000000001";
/**
* Creates a new {@link DSUID}.

View File

@ -20,8 +20,8 @@ import com.google.gson.JsonObject;
* The {@link DeviceBinaryInput} contains all information of a device binary input, e.g. binary input type id (see
* {@link DeviceBinarayInputEnum}, state and so on.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*
*/
public class DeviceBinaryInput {

View File

@ -34,8 +34,8 @@ import com.google.gson.JsonObject;
* and
* timestamp of the last sensor update.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class DeviceSensorValue {

View File

@ -20,13 +20,13 @@ import com.google.gson.JsonObject;
/**
* The {@link JSONDeviceConfigImpl} is the implementation of the {@link DeviceConfig}.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @author Michael Ochel - change from SimpleJSON to GSON
* @author Matthias Siegele - change from SimpleJSON to GSON
*/
public class JSONDeviceConfigImpl implements DeviceConfig {
private int class_ = -1;
private int clazz = -1;
private int index = -1;
private int value = -1;
@ -37,7 +37,7 @@ public class JSONDeviceConfigImpl implements DeviceConfig {
*/
public JSONDeviceConfigImpl(JsonObject object) {
if (object.get(JSONApiResponseKeysEnum.CLASS.getKey()) != null) {
class_ = object.get(JSONApiResponseKeysEnum.CLASS.getKey()).getAsInt();
clazz = object.get(JSONApiResponseKeysEnum.CLASS.getKey()).getAsInt();
}
if (object.get(JSONApiResponseKeysEnum.INDEX.getKey()) != null) {
index = object.get(JSONApiResponseKeysEnum.INDEX.getKey()).getAsInt();
@ -49,7 +49,7 @@ public class JSONDeviceConfigImpl implements DeviceConfig {
@Override
public int getConfigurationClass() {
return class_;
return clazz;
}
@Override
@ -64,6 +64,6 @@ public class JSONDeviceConfigImpl implements DeviceConfig {
@Override
public String toString() {
return "class: " + this.class_ + ", " + "index: " + this.index + ", " + "value: " + this.value;
return "class: " + this.clazz + ", " + "index: " + this.index + ", " + "value: " + this.value;
}
}

View File

@ -29,8 +29,8 @@ import com.google.gson.JsonObject;
/**
* The {@link CircuitImpl} is the implementation of the {@link Circuit} and represent a digitalSTROM circuit.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public class CircuitImpl extends AbstractGeneralDeviceInformations implements Circuit {

View File

@ -263,7 +263,6 @@ public class SceneDiscovery {
groupIdInter = null;
}
if (groupID != null) {
if (ApplicationGroup.Color.YELLOW
.equals(ApplicationGroup.getGroup(groupID).getColor())) {
discoverScene(SceneEnum.AUTO_OFF.getSceneNumber(), groupID);

View File

@ -18,7 +18,7 @@ import java.util.Map;
/**
* The {@link SceneEnum} lists all available scenes of digitalSTROM.
*
* @author Alexander Betker - initial contributer
* @author Alexander Betker - Initial contribution
* @version digitalSTROM-API 1.14.5
*
* @author Michael Ochel - add new scenes and missing java-doc

View File

@ -19,7 +19,6 @@ import java.util.Map.Entry;
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.digitalstrom.internal.lib.serverconnection.constants.JSONApiResponseKeysEnum;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.OutputChannelEnum;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.impl.DeviceImpl;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;

View File

@ -26,8 +26,8 @@ import org.osgi.service.component.ComponentContext;
* digitalSTROM-Bindings. So this class can be implement e.g. by provider implementations like the
* {@link org.openhab.core.thing.type.ChannelTypeProvider}.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public abstract class BaseDsI18n {

View File

@ -33,7 +33,6 @@ import org.openhab.binding.digitalstrom.internal.lib.structure.devices.devicepar
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.OutputModeEnum;
import org.openhab.binding.digitalstrom.internal.lib.structure.devices.deviceparameters.constants.SensorEnum;
import org.openhab.core.i18n.TranslationProvider;
import org.openhab.core.thing.type.ChannelGroupTypeUID;
import org.openhab.core.thing.type.ChannelType;
import org.openhab.core.thing.type.ChannelTypeBuilder;
import org.openhab.core.thing.type.ChannelTypeProvider;
@ -336,7 +335,7 @@ public class DsChannelTypeProvider extends BaseDsI18n implements ChannelTypeProv
// sensor-events and cached values are
// shown in °C so we will use this unit for temperature sensors
String unitShortCut = sensorType.getUnitShortcut();
if (unitShortCut.equals("%")) {
if ("%".equals(unitShortCut)) {
unitShortCut = "%%";
}
if (sensorType.toString().contains("TEMPERATURE")) {

View File

@ -48,8 +48,8 @@ import org.slf4j.LoggerFactory;
* {@link SupportedThingTypes} enum has to be adjusted, if new device types of digitalSTROM should be supported.
* Provided the new digitalSTROM devices uses the same mechanism like now.
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
@Component(service = ThingTypeProvider.class)
public class DsDeviceThingTypeProvider extends BaseDsI18n implements ThingTypeProvider {
@ -59,8 +59,8 @@ public class DsDeviceThingTypeProvider extends BaseDsI18n implements ThingTypePr
* used as thing type id, the first field will set the responsible handler and the last enum field will set the
* supporting of the power sensor refresh configurations (config-description with refresh priority setting or not).
*
* @author Michael Ochel - initial contributer
* @author Matthias Siegele - initial contributer
* @author Michael Ochel - Initial contribution
* @author Matthias Siegele - Initial contribution
*/
public static enum SupportedThingTypes {
// ThingType, responsible ThingHanlder, Device config-description with power-sensors
@ -82,8 +82,8 @@ public class DsDeviceThingTypeProvider extends BaseDsI18n implements ThingTypePr
private final Logger logger = LoggerFactory.getLogger(DsDeviceThingTypeProvider.class);
private final String DEVICE_WITH_POWER_SENSORS = "thing-type:digitalstrom:deviceWithPowerSensors";
private final String DEVICE_WITHOUT_POWER_SENSORS = "thing-type:digitalstrom:deviceWithoutPowerSensors";
private static final String DEVICE_WITH_POWER_SENSORS = "thing-type:digitalstrom:deviceWithPowerSensors";
private static final String DEVICE_WITHOUT_POWER_SENSORS = "thing-type:digitalstrom:deviceWithoutPowerSensors";
@Activate
@Override