Cleanup json->pojo mapping

This commit is contained in:
Monica Goward
2017-03-16 13:13:53 +00:00
parent c8b1827150
commit c9c6d6e66d
17 changed files with 8 additions and 1139 deletions

View File

@@ -99,7 +99,7 @@ public class SomfyHome implements Home {
@Override @Override
public Home createHome(BridgeSettingsDescriptor bridgeSettings) { public Home createHome(BridgeSettingsDescriptor bridgeSettings) {
validSomfy = bridgeSettings.isValidSomfy(); validSomfy = bridgeSettings.isValidSomfy();
log.info("Vera Home created." + (validSomfy ? "" : " No Veras configured.")); log.info("Somfy Home created." + (validSomfy ? "" : " No Somfys configured."));
if(validSomfy) { if(validSomfy) {
somfys = new HashMap<>(); somfys = new HashMap<>();
Iterator<NamedIP> theList = bridgeSettings.getSomfyAddress().getDevices().iterator(); Iterator<NamedIP> theList = bridgeSettings.getSomfyAddress().getDevices().iterator();

View File

@@ -1,32 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Command {
@SerializedName("commandName")
@Expose
private String commandName;
@SerializedName("nparams")
@Expose
private Long nparams;
public String getCommandName() {
return commandName;
}
public void setCommandName(String commandName) {
this.commandName = commandName;
}
public Long getNparams() {
return nparams;
}
public void setNparams(Long nparams) {
this.nparams = nparams;
}
}

View File

@@ -1,32 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Connectivity {
@SerializedName("status")
@Expose
private String status;
@SerializedName("protocolVersion")
@Expose
private String protocolVersion;
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getProtocolVersion() {
return protocolVersion;
}
public void setProtocolVersion(String protocolVersion) {
this.protocolVersion = protocolVersion;
}
}

View File

@@ -1,32 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class DataProperty {
@SerializedName("value")
@Expose
private String value;
@SerializedName("qualifiedName")
@Expose
private String qualifiedName;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getQualifiedName() {
return qualifiedName;
}
public void setQualifiedName(String qualifiedName) {
this.qualifiedName = qualifiedName;
}
}

View File

@@ -1,99 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Definition {
@SerializedName("commands")
@Expose
private List<Command> commands = null;
@SerializedName("events")
@Expose
private List<Object> events = null;
@SerializedName("states")
@Expose
private List<State> states = null;
@SerializedName("dataProperties")
@Expose
private List<DataProperty> dataProperties = null;
@SerializedName("widgetName")
@Expose
private String widgetName;
@SerializedName("uiClass")
@Expose
private String uiClass;
@SerializedName("qualifiedName")
@Expose
private String qualifiedName;
@SerializedName("type")
@Expose
private String type;
public List<Command> getCommands() {
return commands;
}
public void setCommands(List<Command> commands) {
this.commands = commands;
}
public List<Object> getEvents() {
return events;
}
public void setEvents(List<Object> events) {
this.events = events;
}
public List<State> getStates() {
return states;
}
public void setStates(List<State> states) {
this.states = states;
}
public List<DataProperty> getDataProperties() {
return dataProperties;
}
public void setDataProperties(List<DataProperty> dataProperties) {
this.dataProperties = dataProperties;
}
public String getWidgetName() {
return widgetName;
}
public void setWidgetName(String widgetName) {
this.widgetName = widgetName;
}
public String getUiClass() {
return uiClass;
}
public void setUiClass(String uiClass) {
this.uiClass = uiClass;
}
public String getQualifiedName() {
return qualifiedName;
}
public void setQualifiedName(String qualifiedName) {
this.qualifiedName = qualifiedName;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

View File

@@ -6,52 +6,16 @@ import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
public class Device { public class Device {
@SerializedName("creationTime")
@Expose
private Long creationTime;
@SerializedName("lastUpdateTime")
@Expose
private Long lastUpdateTime;
@SerializedName("label") @SerializedName("label")
@Expose @Expose
private String label; private String label;
@SerializedName("deviceURL") @SerializedName("deviceURL")
@Expose @Expose
private String deviceURL; private String deviceURL;
@SerializedName("shortcut")
@Expose
private Boolean shortcut;
@SerializedName("controllableName")
@Expose
private String controllableName;
@SerializedName("metadata")
@Expose
private String metadata;
@SerializedName("definition")
@Expose
private Definition definition;
@SerializedName("states")
@Expose
private List<State_> states = null;
@SerializedName("attributes")
@Expose
private List<Object> attributes = null;
@SerializedName("available")
@Expose
private Boolean available;
@SerializedName("enabled")
@Expose
private Boolean enabled;
@SerializedName("placeOID")
@Expose
private String placeOID;
@SerializedName("widget") @SerializedName("widget")
@Expose @Expose
private String widget; private String widget;
@SerializedName("type")
@Expose
private Long type;
@SerializedName("oid") @SerializedName("oid")
@Expose @Expose
private String oid; private String oid;
@@ -59,21 +23,6 @@ public class Device {
@Expose @Expose
private String uiClass; private String uiClass;
public Long getCreationTime() {
return creationTime;
}
public void setCreationTime(Long creationTime) {
this.creationTime = creationTime;
}
public Long getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Long lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getLabel() { public String getLabel() {
return label; return label;
@@ -90,79 +39,8 @@ public class Device {
public void setDeviceURL(String deviceURL) { public void setDeviceURL(String deviceURL) {
this.deviceURL = deviceURL; this.deviceURL = deviceURL;
} }
public Boolean getShortcut() {
return shortcut;
}
public void setShortcut(Boolean shortcut) {
this.shortcut = shortcut;
}
public String getControllableName() {
return controllableName;
}
public void setControllableName(String controllableName) {
this.controllableName = controllableName;
}
public String getMetadata() {
return metadata;
}
public void setMetadata(String metadata) {
this.metadata = metadata;
}
public Definition getDefinition() {
return definition;
}
public void setDefinition(Definition definition) {
this.definition = definition;
}
public List<State_> getStates() {
return states;
}
public void setStates(List<State_> states) {
this.states = states;
}
public List<Object> getAttributes() {
return attributes;
}
public void setAttributes(List<Object> attributes) {
this.attributes = attributes;
}
public Boolean getAvailable() {
return available;
}
public void setAvailable(Boolean available) {
this.available = available;
}
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public String getPlaceOID() {
return placeOID;
}
public void setPlaceOID(String placeOID) {
this.placeOID = placeOID;
}
public String getWidget() { public String getWidget() {
return widget; return widget;
} }
@@ -171,13 +49,6 @@ public class Device {
this.widget = widget; this.widget = widget;
} }
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public String getOid() { public String getOid() {
return oid; return oid;

View File

@@ -1,32 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Feature {
@SerializedName("name")
@Expose
private String name;
@SerializedName("source")
@Expose
private String source;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
}

View File

@@ -1,120 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Gateway {
@SerializedName("gatewayId")
@Expose
private String gatewayId;
@SerializedName("type")
@Expose
private Long type;
@SerializedName("subType")
@Expose
private Long subType;
@SerializedName("placeOID")
@Expose
private String placeOID;
@SerializedName("alive")
@Expose
private Boolean alive;
@SerializedName("timeReliable")
@Expose
private Boolean timeReliable;
@SerializedName("connectivity")
@Expose
private Connectivity connectivity;
@SerializedName("upToDate")
@Expose
private Boolean upToDate;
@SerializedName("mode")
@Expose
private String mode;
@SerializedName("functions")
@Expose
private String functions;
public String getGatewayId() {
return gatewayId;
}
public void setGatewayId(String gatewayId) {
this.gatewayId = gatewayId;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public Long getSubType() {
return subType;
}
public void setSubType(Long subType) {
this.subType = subType;
}
public String getPlaceOID() {
return placeOID;
}
public void setPlaceOID(String placeOID) {
this.placeOID = placeOID;
}
public Boolean getAlive() {
return alive;
}
public void setAlive(Boolean alive) {
this.alive = alive;
}
public Boolean getTimeReliable() {
return timeReliable;
}
public void setTimeReliable(Boolean timeReliable) {
this.timeReliable = timeReliable;
}
public Connectivity getConnectivity() {
return connectivity;
}
public void setConnectivity(Connectivity connectivity) {
this.connectivity = connectivity;
}
public Boolean getUpToDate() {
return upToDate;
}
public void setUpToDate(Boolean upToDate) {
this.upToDate = upToDate;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getFunctions() {
return functions;
}
public void setFunctions(String functions) {
this.functions = functions;
}
}

View File

@@ -10,9 +10,6 @@ public class GetSetup {
@SerializedName("setup") @SerializedName("setup")
@Expose @Expose
private Setup setup; private Setup setup;
@SerializedName("events")
@Expose
private List<Object> events = null;
public Setup getSetup() { public Setup getSetup() {
return setup; return setup;
@@ -21,13 +18,4 @@ public class GetSetup {
public void setSetup(Setup setup) { public void setSetup(Setup setup) {
this.setup = setup; this.setup = setup;
} }
public List<Object> getEvents() {
return events;
}
public void setEvents(List<Object> events) {
this.events = events;
}
} }

View File

@@ -1,208 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class Location {
@SerializedName("creationTime")
@Expose
private Long creationTime;
@SerializedName("lastUpdateTime")
@Expose
private Long lastUpdateTime;
@SerializedName("city")
@Expose
private String city;
@SerializedName("country")
@Expose
private String country;
@SerializedName("postalCode")
@Expose
private String postalCode;
@SerializedName("addressLine1")
@Expose
private String addressLine1;
@SerializedName("addressLine2")
@Expose
private String addressLine2;
@SerializedName("timezone")
@Expose
private String timezone;
@SerializedName("longitude")
@Expose
private Double longitude;
@SerializedName("latitude")
@Expose
private Double latitude;
@SerializedName("twilightMode")
@Expose
private Long twilightMode;
@SerializedName("twilightAngle")
@Expose
private String twilightAngle;
@SerializedName("twilightCity")
@Expose
private String twilightCity;
@SerializedName("summerSolsticeDuskMinutes")
@Expose
private Long summerSolsticeDuskMinutes;
@SerializedName("winterSolsticeDuskMinutes")
@Expose
private Long winterSolsticeDuskMinutes;
@SerializedName("twilightOffsetEnabled")
@Expose
private Boolean twilightOffsetEnabled;
@SerializedName("dawnOffset")
@Expose
private Long dawnOffset;
@SerializedName("duskOffset")
@Expose
private Long duskOffset;
public Long getCreationTime() {
return creationTime;
}
public void setCreationTime(Long creationTime) {
this.creationTime = creationTime;
}
public Long getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Long lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getCountry() {
return country;
}
public void setCountry(String country) {
this.country = country;
}
public String getPostalCode() {
return postalCode;
}
public void setPostalCode(String postalCode) {
this.postalCode = postalCode;
}
public String getAddressLine1() {
return addressLine1;
}
public void setAddressLine1(String addressLine1) {
this.addressLine1 = addressLine1;
}
public String getAddressLine2() {
return addressLine2;
}
public void setAddressLine2(String addressLine2) {
this.addressLine2 = addressLine2;
}
public String getTimezone() {
return timezone;
}
public void setTimezone(String timezone) {
this.timezone = timezone;
}
public Double getLongitude() {
return longitude;
}
public void setLongitude(Double longitude) {
this.longitude = longitude;
}
public Double getLatitude() {
return latitude;
}
public void setLatitude(Double latitude) {
this.latitude = latitude;
}
public Long getTwilightMode() {
return twilightMode;
}
public void setTwilightMode(Long twilightMode) {
this.twilightMode = twilightMode;
}
public String getTwilightAngle() {
return twilightAngle;
}
public void setTwilightAngle(String twilightAngle) {
this.twilightAngle = twilightAngle;
}
public String getTwilightCity() {
return twilightCity;
}
public void setTwilightCity(String twilightCity) {
this.twilightCity = twilightCity;
}
public Long getSummerSolsticeDuskMinutes() {
return summerSolsticeDuskMinutes;
}
public void setSummerSolsticeDuskMinutes(Long summerSolsticeDuskMinutes) {
this.summerSolsticeDuskMinutes = summerSolsticeDuskMinutes;
}
public Long getWinterSolsticeDuskMinutes() {
return winterSolsticeDuskMinutes;
}
public void setWinterSolsticeDuskMinutes(Long winterSolsticeDuskMinutes) {
this.winterSolsticeDuskMinutes = winterSolsticeDuskMinutes;
}
public Boolean getTwilightOffsetEnabled() {
return twilightOffsetEnabled;
}
public void setTwilightOffsetEnabled(Boolean twilightOffsetEnabled) {
this.twilightOffsetEnabled = twilightOffsetEnabled;
}
public Long getDawnOffset() {
return dawnOffset;
}
public void setDawnOffset(Long dawnOffset) {
this.dawnOffset = dawnOffset;
}
public Long getDuskOffset() {
return duskOffset;
}
public void setDuskOffset(Long duskOffset) {
this.duskOffset = duskOffset;
}
}

View File

@@ -1,77 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class RootPlace {
@SerializedName("creationTime")
@Expose
private Long creationTime;
@SerializedName("lastUpdateTime")
@Expose
private Long lastUpdateTime;
@SerializedName("label")
@Expose
private String label;
@SerializedName("type")
@Expose
private Long type;
@SerializedName("oid")
@Expose
private String oid;
@SerializedName("subPlaces")
@Expose
private List<SubPlace> subPlaces = null;
public Long getCreationTime() {
return creationTime;
}
public void setCreationTime(Long creationTime) {
this.creationTime = creationTime;
}
public Long getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Long lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
public List<SubPlace> getSubPlaces() {
return subPlaces;
}
public void setSubPlaces(List<SubPlace> subPlaces) {
this.subPlaces = subPlaces;
}
}

View File

@@ -6,53 +6,13 @@ import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
public class Setup { public class Setup {
@SerializedName("creationTime")
@Expose
private Long creationTime;
@SerializedName("lastUpdateTime")
@Expose
private Long lastUpdateTime;
@SerializedName("id") @SerializedName("id")
@Expose @Expose
private String id; private String id;
@SerializedName("location")
@Expose
private Location location;
@SerializedName("gateways")
@Expose
private List<Gateway> gateways = null;
@SerializedName("devices") @SerializedName("devices")
@Expose @Expose
private List<Device> devices = null; private List<Device> devices = null;
@SerializedName("zones")
@Expose
private List<Object> zones = null;
@SerializedName("resellerDelegationType")
@Expose
private String resellerDelegationType;
@SerializedName("rootPlace")
@Expose
private RootPlace rootPlace;
@SerializedName("features")
@Expose
private List<Feature> features = null;
public Long getCreationTime() {
return creationTime;
}
public void setCreationTime(Long creationTime) {
this.creationTime = creationTime;
}
public Long getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Long lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getId() { public String getId() {
return id; return id;
@@ -62,22 +22,6 @@ public class Setup {
this.id = id; this.id = id;
} }
public Location getLocation() {
return location;
}
public void setLocation(Location location) {
this.location = location;
}
public List<Gateway> getGateways() {
return gateways;
}
public void setGateways(List<Gateway> gateways) {
this.gateways = gateways;
}
public List<Device> getDevices() { public List<Device> getDevices() {
return devices; return devices;
} }
@@ -86,36 +30,6 @@ public class Setup {
this.devices = devices; this.devices = devices;
} }
public List<Object> getZones() {
return zones;
}
public void setZones(List<Object> zones) {
this.zones = zones;
}
public String getResellerDelegationType() {
return resellerDelegationType;
}
public void setResellerDelegationType(String resellerDelegationType) {
this.resellerDelegationType = resellerDelegationType;
}
public RootPlace getRootPlace() {
return rootPlace;
}
public void setRootPlace(RootPlace rootPlace) {
this.rootPlace = rootPlace;
}
public List<Feature> getFeatures() {
return features;
}
public void setFeatures(List<Feature> features) {
this.features = features;
}
} }

View File

@@ -1,55 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class State {
@SerializedName("eventBased")
@Expose
private Boolean eventBased;
@SerializedName("values")
@Expose
private List<String> values = null;
@SerializedName("type")
@Expose
private String type;
@SerializedName("qualifiedName")
@Expose
private String qualifiedName;
public Boolean getEventBased() {
return eventBased;
}
public void setEventBased(Boolean eventBased) {
this.eventBased = eventBased;
}
public List<String> getValues() {
return values;
}
public void setValues(List<String> values) {
this.values = values;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getQualifiedName() {
return qualifiedName;
}
public void setQualifiedName(String qualifiedName) {
this.qualifiedName = qualifiedName;
}
}

View File

@@ -1,43 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class State_ {
@SerializedName("name")
@Expose
private String name;
@SerializedName("type")
@Expose
private Long type;
@SerializedName("value")
@Expose
private String value;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}

View File

@@ -1,88 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class SubPlace {
@SerializedName("creationTime")
@Expose
private Long creationTime;
@SerializedName("lastUpdateTime")
@Expose
private Long lastUpdateTime;
@SerializedName("label")
@Expose
private String label;
@SerializedName("type")
@Expose
private Long type;
@SerializedName("metadata")
@Expose
private String metadata;
@SerializedName("oid")
@Expose
private String oid;
@SerializedName("subPlaces")
@Expose
private List<SubPlace_> subPlaces = null;
public Long getCreationTime() {
return creationTime;
}
public void setCreationTime(Long creationTime) {
this.creationTime = creationTime;
}
public Long getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Long lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public String getMetadata() {
return metadata;
}
public void setMetadata(String metadata) {
this.metadata = metadata;
}
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
public List<SubPlace_> getSubPlaces() {
return subPlaces;
}
public void setSubPlaces(List<SubPlace_> subPlaces) {
this.subPlaces = subPlaces;
}
}

View File

@@ -1,88 +0,0 @@
package com.bwssystems.HABridge.plugins.somfy.jsonschema2pojo.getsetup;
import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class SubPlace_ {
@SerializedName("creationTime")
@Expose
private Long creationTime;
@SerializedName("lastUpdateTime")
@Expose
private Long lastUpdateTime;
@SerializedName("label")
@Expose
private String label;
@SerializedName("type")
@Expose
private Long type;
@SerializedName("metadata")
@Expose
private String metadata;
@SerializedName("oid")
@Expose
private String oid;
@SerializedName("subPlaces")
@Expose
private List<Object> subPlaces = null;
public Long getCreationTime() {
return creationTime;
}
public void setCreationTime(Long creationTime) {
this.creationTime = creationTime;
}
public Long getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Long lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Long getType() {
return type;
}
public void setType(Long type) {
this.type = type;
}
public String getMetadata() {
return metadata;
}
public void setMetadata(String metadata) {
this.metadata = metadata;
}
public String getOid() {
return oid;
}
public void setOid(String oid) {
this.oid = oid;
}
public List<Object> getSubPlaces() {
return subPlaces;
}
public void setSubPlaces(List<Object> subPlaces) {
this.subPlaces = subPlaces;
}
}

View File

@@ -14,4 +14,6 @@ Boxes checked:
Use long integers Use long integers
Use double numbers Use double numbers
Include getters and setters Include getters and setters
Allow additional properties Allow additional properties
Then manually removed all the unused methods so we have minimal json->pojo representation.