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

View file

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

View file

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

View file

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

View file

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