Skip to content
Snippets Groups Projects
Commit 835541cf authored by Mirco Nasuti's avatar Mirco Nasuti
Browse files

add Vote class

parent ed0ea5be
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,8 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;
@Entity
@Table(name = "`app`")
......@@ -39,6 +41,9 @@ public class App {
private Integer ratingCount;
@OneToMany(mappedBy = "app", fetch = FetchType.EAGER)
private Set<Vote> votes = new HashSet<>();
public App() {
}
......@@ -132,4 +137,13 @@ public class App {
public void setRatingCount(Integer ratingCount) {
this.ratingCount = ratingCount;
}
public Set<Vote> getVotes() {
return votes;
}
public void setVotes(Set<Vote> votes) {
this.votes = votes;
}
}
......@@ -9,8 +9,10 @@ import com.google.gson.annotations.Expose;
import io.swagger.annotations.ApiModel;
import javax.persistence.*;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -81,6 +83,9 @@ public class User {
private Boolean agreeNDA = null;
@OneToMany(mappedBy = "user", fetch = FetchType.EAGER)
private Set<Vote> appsVotes = new HashSet<>();
public User() {
}
......@@ -324,4 +329,12 @@ public class User {
this.agreeNDA = agreeNDA;
}
public Set<Vote> getAppsVotes() {
return appsVotes;
}
public void setAppsVotes(Set<Vote> appsVotes) {
this.appsVotes = appsVotes;
}
}
/**
* Created by mirco on 24.05.16.
*/
package org.hbp.mip.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import javax.persistence.*;
@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;
private int value;
public Vote() {
}
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;
}
}
......@@ -30,6 +30,7 @@
<mapping class="org.hbp.mip.model.Group"/>
<mapping class="org.hbp.mip.model.Config"/>
<mapping class="org.hbp.mip.model.App"/>
<mapping class="org.hbp.mip.model.Vote"/>
</session-factory>
</hibernate-configuration>
db @ 2cf7c0b7
Subproject commit 4f109917a05e4b32be69702660177e3011e44092
Subproject commit 2cf7c0b7921e69bfd7f3dfac78437a135b8aadbb
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