-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Vicente <v.gonzalez.2020@alumnos.urjc.es>
- Loading branch information
1 parent
8ce8ed8
commit 0513473
Showing
6 changed files
with
393 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package net.daw.alist.models; | ||
|
||
import java.sql.Blob; | ||
import java.util.Date; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Lob; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
|
||
@Entity | ||
public class Comment { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private Long id; | ||
|
||
private Date date; | ||
private User author; | ||
private String content; | ||
|
||
@Lob | ||
@JsonIgnore | ||
private Blob image; | ||
|
||
public Comment() { } | ||
|
||
public Comment( | ||
User author, | ||
String content, | ||
Blob image | ||
) { | ||
this.date = new Date(); | ||
this.author = author; | ||
this.content = content; | ||
this.image = image; | ||
} | ||
|
||
public void setAuthor(User author) { | ||
this.author = author; | ||
} | ||
|
||
public void setContent(String content) { | ||
this.content = content; | ||
} | ||
|
||
public void setImage(Blob image) { | ||
this.image = image; | ||
} | ||
|
||
public Date getDate() { | ||
return date; | ||
} | ||
|
||
public User getAuthor() { | ||
return author; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
|
||
public Blob getImage() { | ||
return image; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package net.daw.alist.models; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Date; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.OneToMany; | ||
|
||
@Entity | ||
public class Post { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private Long id; | ||
|
||
private Date date; | ||
private String title; | ||
|
||
@OneToMany | ||
private Set<User> upVotes = new HashSet<>(); | ||
|
||
@OneToMany | ||
private Set<User> downVotes = new HashSet<>(); | ||
|
||
@OneToMany | ||
private List<Topic> topics = new ArrayList<>(); | ||
|
||
@OneToMany | ||
private List<PostItem> items = new ArrayList<>(); | ||
|
||
@OneToMany | ||
private List<Comment> comments = new ArrayList<>(); | ||
|
||
public Post() { } | ||
|
||
public Post( | ||
String title, | ||
List<Topic> topics, | ||
List<PostItem> items | ||
) { | ||
this.date = new Date(); | ||
this.title = title; | ||
this.topics = topics; | ||
this.items = items; | ||
} | ||
|
||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
public void setUpVotes(Set<User> upVotes) { | ||
this.upVotes = upVotes; | ||
} | ||
|
||
public void setDownVotes(Set<User> downVotes) { | ||
this.downVotes = downVotes; | ||
} | ||
|
||
public void setTopics(List<Topic> topics) { | ||
this.topics = topics; | ||
} | ||
|
||
public void setItems(List<PostItem> items) { | ||
this.items = items; | ||
} | ||
|
||
public void setComments(List<Comment> comments) { | ||
this.comments = comments; | ||
} | ||
|
||
public Date getDate() { | ||
return date; | ||
} | ||
|
||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
public Set<User> getUpVotes() { | ||
return upVotes; | ||
} | ||
|
||
public Set<User> getDownVotes() { | ||
return downVotes; | ||
} | ||
|
||
public List<Topic> getTopics() { | ||
return topics; | ||
} | ||
|
||
public List<PostItem> getItems() { | ||
return items; | ||
} | ||
|
||
public List<Comment> getComments() { | ||
return comments; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package net.daw.alist.models; | ||
|
||
import java.sql.Blob; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
import javax.persistence.Lob; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
|
||
@Entity | ||
public class PostItem { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private Long id; | ||
|
||
private String description; | ||
|
||
@Lob | ||
@JsonIgnore | ||
private Blob image; | ||
|
||
public PostItem() { } | ||
|
||
public PostItem( | ||
String description, | ||
Blob image | ||
) { | ||
this.description = description; | ||
this.image = image; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public void setImage(Blob image) { | ||
this.image = image; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public Blob getImage() { | ||
return image; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package net.daw.alist.models; | ||
|
||
import javax.persistence.Entity; | ||
import javax.persistence.GeneratedValue; | ||
import javax.persistence.GenerationType; | ||
import javax.persistence.Id; | ||
|
||
@Entity | ||
public class Topic { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.AUTO) | ||
private Long id; | ||
|
||
private String name; | ||
private String description; | ||
|
||
public Topic() { } | ||
|
||
public Topic( | ||
String name, | ||
String description | ||
) { | ||
this.name = name; | ||
this.description = description; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
} |
Oops, something went wrong.