Skip to content
Snippets Groups Projects
Commit 143575dd authored by Manuel Spuhler's avatar Manuel Spuhler
Browse files

Look Ma, more cleanup

parent b7bb12fe
No related branches found
No related tags found
No related merge requests found
......@@ -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));
}
}
/*
* 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;
}
}
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);
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment