Merge branch 'sonar-fix' into 'dev'
Even more Sonarqube fixes See merge request sa4-2020/the-sanmarinoes/backend!123
This commit is contained in:
commit
bc82532691
5 changed files with 60 additions and 22 deletions
|
@ -16,10 +16,10 @@ import org.springframework.web.bind.annotation.*;
|
|||
@RequestMapping("/dimmableLight")
|
||||
public class DimmableLightController extends GuestEnabledController<DimmableLight> {
|
||||
|
||||
private DimmableLightRepository dimmableLightRepository;
|
||||
private SceneRepository sceneRepository;
|
||||
private StateRepository<State<?>> stateRepository;
|
||||
private DeviceService deviceService;
|
||||
private final DimmableLightRepository dimmableLightRepository;
|
||||
private final SceneRepository sceneRepository;
|
||||
private final StateRepository<State<?>> stateRepository;
|
||||
private final DeviceService deviceService;
|
||||
|
||||
@Autowired
|
||||
public DimmableLightController(
|
||||
|
|
|
@ -6,7 +6,6 @@ import ch.usi.inf.sa4.sanmarinoes.smarthut.dto.RoomSaveRequest;
|
|||
import ch.usi.inf.sa4.sanmarinoes.smarthut.error.NotFoundException;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.*;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.service.DeviceService;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.service.ThermostatService;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.utils.Utils;
|
||||
import java.security.Principal;
|
||||
import java.util.*;
|
||||
|
@ -20,19 +19,33 @@ import org.springframework.web.bind.annotation.*;
|
|||
@RequestMapping("/room")
|
||||
public class RoomController {
|
||||
|
||||
@Autowired private RoomRepository roomRepository;
|
||||
private final RoomRepository roomRepository;
|
||||
|
||||
@Autowired private UserRepository userRepository;
|
||||
private final UserRepository userRepository;
|
||||
|
||||
@Autowired private DeviceService deviceService;
|
||||
private final DeviceService deviceService;
|
||||
|
||||
@Autowired private SwitchRepository switchRepository;
|
||||
private final SwitchRepository switchRepository;
|
||||
|
||||
@Autowired private ButtonDimmerRepository buttonDimmerRepository;
|
||||
private final ButtonDimmerRepository buttonDimmerRepository;
|
||||
|
||||
@Autowired private KnobDimmerRepository knobDimmerRepository;
|
||||
private final KnobDimmerRepository knobDimmerRepository;
|
||||
|
||||
@Autowired private ThermostatService thermostatService;
|
||||
@Autowired
|
||||
public RoomController(
|
||||
RoomRepository roomRepository,
|
||||
UserRepository userRepository,
|
||||
DeviceService deviceService,
|
||||
SwitchRepository switchRepository,
|
||||
ButtonDimmerRepository buttonDimmerRepository,
|
||||
KnobDimmerRepository knobDimmerRepository) {
|
||||
this.roomRepository = roomRepository;
|
||||
this.userRepository = userRepository;
|
||||
this.deviceService = deviceService;
|
||||
this.switchRepository = switchRepository;
|
||||
this.buttonDimmerRepository = buttonDimmerRepository;
|
||||
this.knobDimmerRepository = knobDimmerRepository;
|
||||
}
|
||||
|
||||
private <T> List<T> fetchOwnerOrGuest(
|
||||
final List<T> list, Long hostId, final Principal principal) throws NotFoundException {
|
||||
|
|
|
@ -22,12 +22,22 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
@EnableAutoConfiguration
|
||||
@RequestMapping("/securityCamera")
|
||||
public class SecurityCameraController {
|
||||
private final DeviceService deviceService;
|
||||
private final SecurityCameraRepository securityCameraService;
|
||||
private final SceneRepository sceneRepository;
|
||||
private final StateRepository<State<?>> stateRepository;
|
||||
|
||||
@Autowired private DeviceService deviceService;
|
||||
@Autowired private SecurityCameraRepository securityCameraService;
|
||||
@Autowired private SceneRepository sceneRepository;
|
||||
@Autowired private StateRepository<State<?>> stateRepository;
|
||||
@Autowired private RoomRepository roomRepository;
|
||||
@Autowired
|
||||
public SecurityCameraController(
|
||||
DeviceService deviceService,
|
||||
SecurityCameraRepository securityCameraService,
|
||||
SceneRepository sceneRepository,
|
||||
StateRepository<State<?>> stateRepository) {
|
||||
this.deviceService = deviceService;
|
||||
this.securityCameraService = securityCameraService;
|
||||
this.sceneRepository = sceneRepository;
|
||||
this.stateRepository = stateRepository;
|
||||
}
|
||||
|
||||
private SecurityCamera save(
|
||||
SecurityCamera newSC, SwitchableSaveRequest sc, final Principal principal) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import ch.usi.inf.sa4.sanmarinoes.smarthut.error.NotFoundException;
|
|||
import ch.usi.inf.sa4.sanmarinoes.smarthut.models.*;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.service.DeviceService;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.service.SensorService;
|
||||
import ch.usi.inf.sa4.sanmarinoes.smarthut.socket.SensorSocketEndpoint;
|
||||
import java.math.BigDecimal;
|
||||
import java.security.Principal;
|
||||
import java.util.*;
|
||||
|
@ -19,13 +18,21 @@ import org.springframework.web.bind.annotation.*;
|
|||
@RequestMapping("/sensor")
|
||||
public class SensorController {
|
||||
|
||||
@Autowired private DeviceService deviceService;
|
||||
private final DeviceService deviceService;
|
||||
|
||||
@Autowired private SensorRepository sensorRepository;
|
||||
private final SensorRepository sensorRepository;
|
||||
|
||||
@Autowired private SensorSocketEndpoint sensorSocketEndpoint;
|
||||
private final SensorService sensorService;
|
||||
|
||||
@Autowired private SensorService sensorService;
|
||||
@Autowired
|
||||
public SensorController(
|
||||
DeviceService deviceService,
|
||||
SensorRepository sensorRepository,
|
||||
SensorService sensorService) {
|
||||
this.deviceService = deviceService;
|
||||
this.sensorRepository = sensorRepository;
|
||||
this.sensorService = sensorService;
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public Sensor create(@Valid @RequestBody SensorSaveRequest s, final Principal principal)
|
||||
|
|
|
@ -75,6 +75,14 @@ public abstract class Device {
|
|||
@SocketGsonExclude
|
||||
private Set<State<?>> states;
|
||||
|
||||
public String getKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
public FlowType getFlowType() {
|
||||
return flowType;
|
||||
}
|
||||
|
||||
@Transient @GsonExclude private Long fromHostId = null;
|
||||
|
||||
@Transient @GsonExclude private boolean fromGuest = false;
|
||||
|
|
Loading…
Reference in a new issue