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:
Claudio Maggioni 2020-03-02 21:59:49 +01:00
parent 5ae97da8a7
commit eecee30841
17 changed files with 14 additions and 80 deletions

View file

@ -34,7 +34,6 @@ public class ButtonDimmerController {
newBD.setLights(bd.getLights());
newBD.setId(bd.getId());
newBD.setName(bd.getName());
newBD.setRoom(bd.getRoom());
newBD.setRoomId(bd.getRoomId());
return buttonDimmerService.save(newBD);

View file

@ -35,7 +35,6 @@ public class DimmableLightController {
newDL.setIntensity(dl.getIntensity());
newDL.setId(dl.getId());
newDL.setName(dl.getName());
newDL.setRoom(dl.getRoom());
newDL.setRoomId(dl.getRoomId());
return dimmableLightService.save(newDL);

View file

@ -35,7 +35,6 @@ public class KnobDimmerController {
newKD.setLights(kd.getLights());
newKD.setId(kd.getId());
newKD.setName(kd.getName());
newKD.setRoom(kd.getRoom());
newKD.setRoomId(kd.getRoomId());
return knobDimmerService.save(newKD);

View file

@ -35,7 +35,6 @@ public class MotionSensorController {
newMS.setDetected(ms.isDetected());
newMS.setId(ms.getId());
newMS.setName(ms.getName());
newMS.setRoom(ms.getRoom());
newMS.setRoomId(ms.getRoomId());
return motionSensorService.save(newMS);

View file

@ -41,7 +41,6 @@ public class RegularLightController {
RegularLight newRL = new RegularLight();
newRL.setId(rl.getId());
newRL.setName(rl.getName());
newRL.setRoom(rl.getRoom());
newRL.setRoomId(rl.getRoomId());
newRL.setOn(rl.isOn());

View file

@ -35,7 +35,6 @@ public class SensorController {
newSensor.setValue(s.getValue());
newSensor.setId(s.getId());
newSensor.setName(s.getName());
newSensor.setRoom(s.getRoom());
newSensor.setRoomId(s.getRoomId());
return sensorRepository.save(newSensor);

View file

@ -34,7 +34,6 @@ public class SmartPlugController {
newSP.setOn(sp.isOn());
newSP.setId(sp.getId());
newSP.setName(sp.getName());
newSP.setRoom(sp.getRoom());
newSP.setRoomId(sp.getRoomId());
return smartPlugRepository.save(newSP);

View file

@ -33,7 +33,6 @@ public class SwitchController {
Switch newSwitch = new Switch();
newSwitch.setId(s.getId());
newSwitch.setName(s.getName());
newSwitch.setRoom(s.getRoom());
newSwitch.setRoomId(s.getRoomId());
newSwitch.setOn(s.isOn());

View file

@ -1,7 +1,6 @@
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.Room;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Lob;
@ -13,9 +12,6 @@ public class KnobDimmerSaveRequest {
/** Device identifier */
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
* a REST call.
@ -29,10 +25,6 @@ public class KnobDimmerSaveRequest {
this.id = id;
}
public void setRoom(Room room) {
this.room = room;
}
public void setRoomId(Long roomId) {
this.roomId = roomId;
}
@ -45,10 +37,6 @@ public class KnobDimmerSaveRequest {
return id;
}
public Room getRoom() {
return room;
}
public Long getRoomId() {
return roomId;
}

View file

@ -1,6 +1,5 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Room;
import javax.validation.constraints.NotNull;
public class MotionSensorSaveRequest {
@ -9,9 +8,6 @@ public class MotionSensorSaveRequest {
/** Device identifier */
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
* a REST call.
@ -25,10 +21,6 @@ public class MotionSensorSaveRequest {
this.id = id;
}
public void setRoom(Room room) {
this.room = room;
}
public void setRoomId(Long roomId) {
this.roomId = roomId;
}
@ -41,10 +33,6 @@ public class MotionSensorSaveRequest {
return id;
}
public Room getRoom() {
return room;
}
public Long getRoomId() {
return roomId;
}

View file

@ -1,6 +1,5 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Room;
import javax.validation.constraints.NotNull;
public class RegularLightSaveRequest {
@ -10,9 +9,6 @@ public class RegularLightSaveRequest {
/** Device identifier */
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
* a REST call.
@ -26,10 +22,6 @@ public class RegularLightSaveRequest {
this.id = id;
}
public void setRoom(Room room) {
this.room = room;
}
public void setRoomId(Long roomId) {
this.roomId = roomId;
}
@ -42,10 +34,6 @@ public class RegularLightSaveRequest {
return id;
}
public Room getRoom() {
return room;
}
public Long getRoomId() {
return roomId;
}

View file

@ -1,6 +1,5 @@
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 com.google.gson.annotations.SerializedName;
import javax.persistence.EnumType;
@ -35,9 +34,6 @@ public class SensorSaveRequest {
/** Device identifier */
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
* a REST call.
@ -51,10 +47,6 @@ public class SensorSaveRequest {
this.id = id;
}
public void setRoom(Room room) {
this.room = room;
}
public void setRoomId(Long roomId) {
this.roomId = roomId;
}
@ -67,10 +59,6 @@ public class SensorSaveRequest {
return id;
}
public Room getRoom() {
return room;
}
public Long getRoomId() {
return roomId;
}

View file

@ -1,6 +1,5 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Room;
import javax.validation.constraints.NotNull;
public class SmartPlugSaveRequest {
@ -10,9 +9,6 @@ public class SmartPlugSaveRequest {
/** Device identifier */
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
* a REST call.
@ -26,10 +22,6 @@ public class SmartPlugSaveRequest {
this.id = id;
}
public void setRoom(Room room) {
this.room = room;
}
public void setRoomId(Long roomId) {
this.roomId = roomId;
}
@ -42,10 +34,6 @@ public class SmartPlugSaveRequest {
return id;
}
public Room getRoom() {
return room;
}
public Long getRoomId() {
return roomId;
}

View file

@ -1,6 +1,5 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.dto;
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.Room;
import javax.validation.constraints.NotNull;
public class SwitchSaveRequest {
@ -10,9 +9,6 @@ public class SwitchSaveRequest {
/** Device identifier */
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
* a REST call.
@ -26,10 +22,6 @@ public class SwitchSaveRequest {
this.id = id;
}
public void setRoom(Room room) {
this.room = room;
}
public void setRoomId(Long roomId) {
this.roomId = roomId;
}
@ -42,10 +34,6 @@ public class SwitchSaveRequest {
return id;
}
public Room getRoom() {
return room;
}
public Long getRoomId() {
return roomId;
}

View file

@ -1,6 +1,9 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import java.util.Set;
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
@ -12,6 +15,9 @@ public class ButtonDimmer extends Dimmer {
super("button-dimmer");
}
@OneToMany(mappedBy = "dimmer")
private Set<DimmableLight> lights;
/** Increases the current intensity level of the dimmable light by 1 */
public void increaseIntensity() {
for (DimmableLight dl : lights) {

View file

@ -2,6 +2,7 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
@ -14,6 +15,8 @@ public class DimmableLight extends Light {
super("light");
}
@ManyToOne private Dimmer dimmer;
/** The light intensity value. Goes from 0 (off) to 100 (on) */
@NotNull
@Column(nullable = false)

View file

@ -1,6 +1,8 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
/**
* 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");
}
@OneToMany(mappedBy = "dimmer")
private Set<DimmableLight> lights;
/**
* 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