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