diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/ScenePriorityController.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/ScenePriorityController.java index 9093a71..fc1a45f 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/ScenePriorityController.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/controller/ScenePriorityController.java @@ -1,8 +1,11 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.controller; +import ch.usi.inf.sa4.sanmarinoes.smarthut.models.ScenePriority; import ch.usi.inf.sa4.sanmarinoes.smarthut.models.ScenePriorityRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -12,4 +15,9 @@ import org.springframework.web.bind.annotation.RestController; public class ScenePriorityController { @Autowired ScenePriorityRepository scenePriorityRepository; + + @GetMapping("/{id}") + public ScenePriority get(@PathVariable long id) { + return new ScenePriority(); + } } diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Automation.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Automation.java index fb5d7d2..27bda84 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Automation.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Automation.java @@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashSet; import java.util.Set; import javax.persistence.*; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; @Entity public class Automation { @@ -23,6 +25,8 @@ public class Automation { @GsonExclude private Set scenes = new HashSet<>(); + @NotNull @NotEmpty private String name; + public long getId() { return id; } @@ -38,4 +42,12 @@ public class Automation { public Set getScenes() { return scenes; } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/ScenePriorityRepository.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/ScenePriorityRepository.java index 2dc81c4..30ee4e5 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/ScenePriorityRepository.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/ScenePriorityRepository.java @@ -1,5 +1,10 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.models; +import java.util.List; import org.springframework.data.repository.CrudRepository; +import org.springframework.data.repository.query.Param; -public interface ScenePriorityRepository extends CrudRepository {} +public interface ScenePriorityRepository extends CrudRepository { + + List findAllBySceneId(@Param("sceneId") long sceneId); +}