This commit is contained in:
omenem 2020-04-25 15:00:22 +02:00
parent 509d890c7e
commit 5eadb2314c
3 changed files with 26 additions and 1 deletions

View file

@ -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();
}
}

View file

@ -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<ScenePriority> scenes = new HashSet<>();
@NotNull @NotEmpty private String name;
public long getId() {
return id;
}
@ -38,4 +42,12 @@ public class Automation {
public Set<ScenePriority> getScenes() {
return scenes;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View file

@ -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<ScenePriority, Long> {}
public interface ScenePriorityRepository extends CrudRepository<ScenePriority, Long> {
List<ScenePriority> findAllBySceneId(@Param("sceneId") long sceneId);
}