From 143575dd1f937556d85668221e389ca9afad6caf Mon Sep 17 00:00:00 2001 From: Manuel Spuhler <manuel.spuhler@chuv.ch> Date: Wed, 30 Oct 2019 15:53:45 +0100 Subject: [PATCH] Look Ma, more cleanup --- src/main/java/eu/hbp/mip/model/User.java | 18 ----- src/main/java/eu/hbp/mip/model/Vote.java | 73 ------------------- .../hbp/mip/repositories/VoteRepository.java | 14 ---- 3 files changed, 105 deletions(-) delete mode 100644 src/main/java/eu/hbp/mip/model/Vote.java delete mode 100644 src/main/java/eu/hbp/mip/repositories/VoteRepository.java diff --git a/src/main/java/eu/hbp/mip/model/User.java b/src/main/java/eu/hbp/mip/model/User.java index c0c845876..03b402e41 100644 --- a/src/main/java/eu/hbp/mip/model/User.java +++ b/src/main/java/eu/hbp/mip/model/User.java @@ -83,9 +83,6 @@ public class User { private Boolean agreeNDA = null; - @OneToMany(mappedBy = "user", fetch = FetchType.EAGER) - private Set<Vote> appsVotes = new HashSet<>(); - public User() { /* @@ -331,19 +328,4 @@ public class User { public void setAgreeNDA(Boolean agreeNDA) { this.agreeNDA = agreeNDA; } - - - public Set<Vote> getAppsVotes() { - return appsVotes; - } - - public void setAppsVotes(Set<Vote> appsVotes) { - this.appsVotes = appsVotes; - } - - - public Set<App> getVotedApps() { - - return appsVotes.stream().map(Vote::getApp).collect(Collectors.toCollection(LinkedHashSet::new)); - } } diff --git a/src/main/java/eu/hbp/mip/model/Vote.java b/src/main/java/eu/hbp/mip/model/Vote.java deleted file mode 100644 index fcd52e485..000000000 --- a/src/main/java/eu/hbp/mip/model/Vote.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Created by mirco on 24.05.16. - */ - -package eu.hbp.mip.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import io.swagger.annotations.ApiModel; - -import javax.persistence.*; -import javax.validation.constraints.Max; -import javax.validation.constraints.Min; - -@Entity -@Table(name = "`vote`") -@ApiModel -@JsonInclude(JsonInclude.Include.NON_NULL) -public class Vote { - - @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE) - private Long id; - - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) - private User user; - - @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER) - private App app; - - @Min(0) - @Max(5) - private int value; - - - public Vote() { - /* - * Empty constructor is needed by Hibernate - */ - } - - - public Long getId() { - return id; - } - - public void setId(Long id) { - this.id = id; - } - - public User getUser() { - return user; - } - - public void setUser(User user) { - this.user = user; - } - - public App getApp() { - return app; - } - - public void setApp(App app) { - this.app = app; - } - - public int getValue() { - return value; - } - - public void setValue(int value) { - this.value = value; - } -} diff --git a/src/main/java/eu/hbp/mip/repositories/VoteRepository.java b/src/main/java/eu/hbp/mip/repositories/VoteRepository.java deleted file mode 100644 index 30499e551..000000000 --- a/src/main/java/eu/hbp/mip/repositories/VoteRepository.java +++ /dev/null @@ -1,14 +0,0 @@ -package eu.hbp.mip.repositories; - -import eu.hbp.mip.model.App; -import eu.hbp.mip.model.User; -import eu.hbp.mip.model.Vote; -import org.springframework.data.repository.CrudRepository; - -/** - * Created by mirco on 11.07.16. - */ - -public interface VoteRepository extends CrudRepository<Vote, Long> { - Iterable<Vote> findByUserAndApp(User user, App app); -} -- GitLab