wip
This commit is contained in:
parent
509d890c7e
commit
5eadb2314c
3 changed files with 26 additions and 1 deletions
|
@ -1,8 +1,11 @@
|
||||||
package ch.usi.inf.sa4.sanmarinoes.smarthut.controller;
|
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 ch.usi.inf.sa4.sanmarinoes.smarthut.models.ScenePriorityRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@ -12,4 +15,9 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
public class ScenePriorityController {
|
public class ScenePriorityController {
|
||||||
|
|
||||||
@Autowired ScenePriorityRepository scenePriorityRepository;
|
@Autowired ScenePriorityRepository scenePriorityRepository;
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public ScenePriority get(@PathVariable long id) {
|
||||||
|
return new ScenePriority();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
public class Automation {
|
public class Automation {
|
||||||
|
@ -23,6 +25,8 @@ public class Automation {
|
||||||
@GsonExclude
|
@GsonExclude
|
||||||
private Set<ScenePriority> scenes = new HashSet<>();
|
private Set<ScenePriority> scenes = new HashSet<>();
|
||||||
|
|
||||||
|
@NotNull @NotEmpty private String name;
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
@ -38,4 +42,12 @@ public class Automation {
|
||||||
public Set<ScenePriority> getScenes() {
|
public Set<ScenePriority> getScenes() {
|
||||||
return scenes;
|
return scenes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue