Redoing all @tommi27 work on model since git merge is now sentient and trying to delete stuff from our project
This commit is contained in:
parent
5ae97da8a7
commit
eecee30841
17 changed files with 14 additions and 80 deletions
|
@ -34,7 +34,6 @@ public class ButtonDimmerController {
|
||||||
newBD.setLights(bd.getLights());
|
newBD.setLights(bd.getLights());
|
||||||
newBD.setId(bd.getId());
|
newBD.setId(bd.getId());
|
||||||
newBD.setName(bd.getName());
|
newBD.setName(bd.getName());
|
||||||
newBD.setRoom(bd.getRoom());
|
|
||||||
newBD.setRoomId(bd.getRoomId());
|
newBD.setRoomId(bd.getRoomId());
|
||||||
|
|
||||||
return buttonDimmerService.save(newBD);
|
return buttonDimmerService.save(newBD);
|
||||||
|
|
|
@ -35,7 +35,6 @@ public class DimmableLightController {
|
||||||
newDL.setIntensity(dl.getIntensity());
|
newDL.setIntensity(dl.getIntensity());
|
||||||
newDL.setId(dl.getId());
|
newDL.setId(dl.getId());
|
||||||
newDL.setName(dl.getName());
|
newDL.setName(dl.getName());
|
||||||
newDL.setRoom(dl.getRoom());
|
|
||||||
newDL.setRoomId(dl.getRoomId());
|
newDL.setRoomId(dl.getRoomId());
|
||||||
|
|
||||||
return dimmableLightService.save(newDL);
|
return dimmableLightService.save(newDL);
|
||||||
|
|
|
@ -35,7 +35,6 @@ public class KnobDimmerController {
|
||||||
newKD.setLights(kd.getLights());
|
newKD.setLights(kd.getLights());
|
||||||
newKD.setId(kd.getId());
|
newKD.setId(kd.getId());
|
||||||
newKD.setName(kd.getName());
|
newKD.setName(kd.getName());
|
||||||
newKD.setRoom(kd.getRoom());
|
|
||||||
newKD.setRoomId(kd.getRoomId());
|
newKD.setRoomId(kd.getRoomId());
|
||||||
|
|
||||||
return knobDimmerService.save(newKD);
|
return knobDimmerService.save(newKD);
|
||||||
|
|
|
@ -35,7 +35,6 @@ public class MotionSensorController {
|
||||||
newMS.setDetected(ms.isDetected());
|
newMS.setDetected(ms.isDetected());
|
||||||
newMS.setId(ms.getId());
|
newMS.setId(ms.getId());
|
||||||
newMS.setName(ms.getName());
|
newMS.setName(ms.getName());
|
||||||
newMS.setRoom(ms.getRoom());
|
|
||||||
newMS.setRoomId(ms.getRoomId());
|
newMS.setRoomId(ms.getRoomId());
|
||||||
|
|
||||||
return motionSensorService.save(newMS);
|
return motionSensorService.save(newMS);
|
||||||
|
|
|
@ -41,7 +41,6 @@ public class RegularLightController {
|
||||||
RegularLight newRL = new RegularLight();
|
RegularLight newRL = new RegularLight();
|
||||||
newRL.setId(rl.getId());
|
newRL.setId(rl.getId());
|
||||||
newRL.setName(rl.getName());
|
newRL.setName(rl.getName());
|
||||||
newRL.setRoom(rl.getRoom());
|
|
||||||
newRL.setRoomId(rl.getRoomId());
|
newRL.setRoomId(rl.getRoomId());
|
||||||
newRL.setOn(rl.isOn());
|
newRL.setOn(rl.isOn());
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ public class SensorController {
|
||||||
newSensor.setValue(s.getValue());
|
newSensor.setValue(s.getValue());
|
||||||
newSensor.setId(s.getId());
|
newSensor.setId(s.getId());
|
||||||
newSensor.setName(s.getName());
|
newSensor.setName(s.getName());
|
||||||
newSensor.setRoom(s.getRoom());
|
|
||||||
newSensor.setRoomId(s.getRoomId());
|
newSensor.setRoomId(s.getRoomId());
|
||||||
|
|
||||||
return sensorRepository.save(newSensor);
|
return sensorRepository.save(newSensor);
|
||||||
|
|
|
@ -34,7 +34,6 @@ public class SmartPlugController {
|
||||||
newSP.setOn(sp.isOn());
|
newSP.setOn(sp.isOn());
|
||||||
newSP.setId(sp.getId());
|
newSP.setId(sp.getId());
|
||||||
newSP.setName(sp.getName());
|
newSP.setName(sp.getName());
|
||||||
newSP.setRoom(sp.getRoom());
|
|
||||||
newSP.setRoomId(sp.getRoomId());
|
newSP.setRoomId(sp.getRoomId());
|
||||||
|
|
||||||
return smartPlugRepository.save(newSP);
|
return smartPlugRepository.save(newSP);
|
||||||
|
|
|
@ -33,7 +33,6 @@ public class SwitchController {
|
||||||
Switch newSwitch = new Switch();
|
Switch newSwitch = new Switch();
|
||||||
newSwitch.setId(s.getId());
|
newSwitch.setId(s.getId());
|
||||||
newSwitch.setName(s.getName());
|
newSwitch.setName(s.getName());
|
||||||
newSwitch.setRoom(s.getRoom());
|
|
||||||
newSwitch.setRoomId(s.getRoomId());
|
newSwitch.setRoomId(s.getRoomId());
|
||||||
newSwitch.setOn(s.isOn());
|
newSwitch.setOn(s.isOn());
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
||||||
|
|
||||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.DimmableLight;
|
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.DimmableLight;
|
||||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Room;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.Lob;
|
import javax.persistence.Lob;
|
||||||
|
@ -13,9 +12,6 @@ public class KnobDimmerSaveRequest {
|
||||||
/** Device identifier */
|
/** Device identifier */
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
/** The room this device belongs in */
|
|
||||||
private Room room;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
||||||
* a REST call.
|
* a REST call.
|
||||||
|
@ -29,10 +25,6 @@ public class KnobDimmerSaveRequest {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoom(Room room) {
|
|
||||||
this.room = room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoomId(Long roomId) {
|
public void setRoomId(Long roomId) {
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
}
|
}
|
||||||
|
@ -45,10 +37,6 @@ public class KnobDimmerSaveRequest {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Room getRoom() {
|
|
||||||
return room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRoomId() {
|
public Long getRoomId() {
|
||||||
return roomId;
|
return roomId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
||||||
|
|
||||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Room;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
public class MotionSensorSaveRequest {
|
public class MotionSensorSaveRequest {
|
||||||
|
@ -9,9 +8,6 @@ public class MotionSensorSaveRequest {
|
||||||
/** Device identifier */
|
/** Device identifier */
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
/** The room this device belongs in */
|
|
||||||
private Room room;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
||||||
* a REST call.
|
* a REST call.
|
||||||
|
@ -25,10 +21,6 @@ public class MotionSensorSaveRequest {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoom(Room room) {
|
|
||||||
this.room = room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoomId(Long roomId) {
|
public void setRoomId(Long roomId) {
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
}
|
}
|
||||||
|
@ -41,10 +33,6 @@ public class MotionSensorSaveRequest {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Room getRoom() {
|
|
||||||
return room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRoomId() {
|
public Long getRoomId() {
|
||||||
return roomId;
|
return roomId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
||||||
|
|
||||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Room;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
public class RegularLightSaveRequest {
|
public class RegularLightSaveRequest {
|
||||||
|
@ -10,9 +9,6 @@ public class RegularLightSaveRequest {
|
||||||
/** Device identifier */
|
/** Device identifier */
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
/** The room this device belongs in */
|
|
||||||
private Room room;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
||||||
* a REST call.
|
* a REST call.
|
||||||
|
@ -26,10 +22,6 @@ public class RegularLightSaveRequest {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoom(Room room) {
|
|
||||||
this.room = room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoomId(Long roomId) {
|
public void setRoomId(Long roomId) {
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
}
|
}
|
||||||
|
@ -42,10 +34,6 @@ public class RegularLightSaveRequest {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Room getRoom() {
|
|
||||||
return room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRoomId() {
|
public Long getRoomId() {
|
||||||
return roomId;
|
return roomId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
||||||
|
|
||||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Room;
|
|
||||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Sensor;
|
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Sensor;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import javax.persistence.EnumType;
|
import javax.persistence.EnumType;
|
||||||
|
@ -35,9 +34,6 @@ public class SensorSaveRequest {
|
||||||
/** Device identifier */
|
/** Device identifier */
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
/** The room this device belongs in */
|
|
||||||
private Room room;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
||||||
* a REST call.
|
* a REST call.
|
||||||
|
@ -51,10 +47,6 @@ public class SensorSaveRequest {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoom(Room room) {
|
|
||||||
this.room = room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoomId(Long roomId) {
|
public void setRoomId(Long roomId) {
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
}
|
}
|
||||||
|
@ -67,10 +59,6 @@ public class SensorSaveRequest {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Room getRoom() {
|
|
||||||
return room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRoomId() {
|
public Long getRoomId() {
|
||||||
return roomId;
|
return roomId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
||||||
|
|
||||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Room;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
public class SmartPlugSaveRequest {
|
public class SmartPlugSaveRequest {
|
||||||
|
@ -10,9 +9,6 @@ public class SmartPlugSaveRequest {
|
||||||
/** Device identifier */
|
/** Device identifier */
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
/** The room this device belongs in */
|
|
||||||
private Room room;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
||||||
* a REST call.
|
* a REST call.
|
||||||
|
@ -26,10 +22,6 @@ public class SmartPlugSaveRequest {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoom(Room room) {
|
|
||||||
this.room = room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoomId(Long roomId) {
|
public void setRoomId(Long roomId) {
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
}
|
}
|
||||||
|
@ -42,10 +34,6 @@ public class SmartPlugSaveRequest {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Room getRoom() {
|
|
||||||
return room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRoomId() {
|
public Long getRoomId() {
|
||||||
return roomId;
|
return roomId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
|
||||||
|
|
||||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Room;
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
public class SwitchSaveRequest {
|
public class SwitchSaveRequest {
|
||||||
|
@ -10,9 +9,6 @@ public class SwitchSaveRequest {
|
||||||
/** Device identifier */
|
/** Device identifier */
|
||||||
private long id;
|
private long id;
|
||||||
|
|
||||||
/** The room this device belongs in */
|
|
||||||
private Room room;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
* The room this device belongs in, as a foreign key id. To use when updating and inserting from
|
||||||
* a REST call.
|
* a REST call.
|
||||||
|
@ -26,10 +22,6 @@ public class SwitchSaveRequest {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRoom(Room room) {
|
|
||||||
this.room = room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRoomId(Long roomId) {
|
public void setRoomId(Long roomId) {
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
}
|
}
|
||||||
|
@ -42,10 +34,6 @@ public class SwitchSaveRequest {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Room getRoom() {
|
|
||||||
return room;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getRoomId() {
|
public Long getRoomId() {
|
||||||
return roomId;
|
return roomId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a dimmer that can only instruct an increase or decrease of intensity (i.e. like a
|
* Represents a dimmer that can only instruct an increase or decrease of intensity (i.e. like a
|
||||||
|
@ -12,6 +15,9 @@ public class ButtonDimmer extends Dimmer {
|
||||||
super("button-dimmer");
|
super("button-dimmer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "dimmer")
|
||||||
|
private Set<DimmableLight> lights;
|
||||||
|
|
||||||
/** Increases the current intensity level of the dimmable light by 1 */
|
/** Increases the current intensity level of the dimmable light by 1 */
|
||||||
public void increaseIntensity() {
|
public void increaseIntensity() {
|
||||||
for (DimmableLight dl : lights) {
|
for (DimmableLight dl : lights) {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
import javax.validation.constraints.Max;
|
import javax.validation.constraints.Max;
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
@ -14,6 +15,8 @@ public class DimmableLight extends Light {
|
||||||
super("light");
|
super("light");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ManyToOne private Dimmer dimmer;
|
||||||
|
|
||||||
/** The light intensity value. Goes from 0 (off) to 100 (on) */
|
/** The light intensity value. Goes from 0 (off) to 100 (on) */
|
||||||
@NotNull
|
@NotNull
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a dimmer able to set absolute intensity values (i.e. knowing the absolute intensity
|
* Represents a dimmer able to set absolute intensity values (i.e. knowing the absolute intensity
|
||||||
|
@ -12,6 +14,9 @@ public class KnobDimmer extends Dimmer {
|
||||||
super("knob-dimmer");
|
super("knob-dimmer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OneToMany(mappedBy = "dimmer")
|
||||||
|
private Set<DimmableLight> lights;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Increases or decreases the current intensity level by 5, moving between absolute multiples of
|
* Increases or decreases the current intensity level by 5, moving between absolute multiples of
|
||||||
* 5 between 0 and 100, of all dimmable lights mapped to this knob
|
* 5 between 0 and 100, of all dimmable lights mapped to this knob
|
||||||
|
|
Loading…
Reference in a new issue