fix @SocketGsonExclude on device and children

This commit is contained in:
Claudio Maggioni (maggicl) 2020-04-27 14:28:34 +02:00
parent 27de35acf0
commit 579dcaacfd
6 changed files with 12 additions and 2 deletions

View file

@ -29,7 +29,7 @@ public class RangeTriggerController {
return rangeTriggerRepository.findAllByAutomationId(automationId);
}
private RangeTrigger<?> save(RangeTrigger newRL, RangeTriggerSaveRequest s) {
private RangeTrigger<?> save(RangeTrigger<?> newRL, RangeTriggerSaveRequest s) {
newRL.setDeviceId(s.getDeviceId());
newRL.setAutomationId(s.getAutomationId());
newRL.setOperator(s.getOperator());
@ -41,7 +41,7 @@ public class RangeTriggerController {
@PostMapping
public RangeTrigger<?> create(
@Valid @RequestBody RangeTriggerSaveRequest booleanTriggerSaveRequest) {
return save(new RangeTrigger(), booleanTriggerSaveRequest);
return save(new RangeTrigger<>(), booleanTriggerSaveRequest);
}
@PutMapping

View file

@ -1,6 +1,7 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.GsonExclude;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.SocketGsonExclude;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.Max;
@ -23,6 +24,7 @@ public class Dimmable extends Switchable implements RangeTriggerable {
@ManyToMany(mappedBy = "dimmables", cascade = CascadeType.DETACH)
@GsonExclude
@SocketGsonExclude
private Set<Dimmer> dimmers;
/** The light intensity value. Goes from 0 (off) to 100 (on) */

View file

@ -1,6 +1,7 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.GsonExclude;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.SocketGsonExclude;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
@ -15,6 +16,7 @@ public abstract class Dimmer extends InputDevice {
@ManyToMany(cascade = CascadeType.DETACH)
@GsonExclude
@SocketGsonExclude
@JoinTable(
name = "dimmer_dimmable",
joinColumns = @JoinColumn(name = "dimmer_id"),

View file

@ -1,6 +1,7 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.GsonExclude;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.SocketGsonExclude;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
@ -11,6 +12,7 @@ public class Switch extends InputDevice implements BooleanTriggerable {
@ManyToMany(cascade = CascadeType.DETACH)
@GsonExclude
@SocketGsonExclude
@JoinTable(
name = "switch_switchable",
joinColumns = @JoinColumn(name = "switch_id"),

View file

@ -1,6 +1,7 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.GsonExclude;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.SocketGsonExclude;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
@ -15,6 +16,7 @@ public abstract class Switchable extends OutputDevice {
@ManyToMany(mappedBy = "switchables", cascade = CascadeType.DETACH)
@GsonExclude
@SocketGsonExclude
private Set<Switch> inputs = new HashSet<>();
protected Switchable(String kind) {

View file

@ -1,6 +1,7 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.GsonExclude;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.SocketGsonExclude;
import com.google.gson.annotations.SerializedName;
import java.math.BigDecimal;
import java.util.HashSet;
@ -87,6 +88,7 @@ public class Thermostat extends Switchable implements BooleanTriggerable {
@OneToMany(mappedBy = "scene", orphanRemoval = true)
@GsonExclude
@SocketGsonExclude
private Set<BooleanTrigger<? extends Device>> triggers = new HashSet<>();
/** Creates a thermostat with a temperature sensor and its initial OFF state */