You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
3.2 KiB
129 lines
3.2 KiB
package com.project.model;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
public class PostInfo {
|
|
private String title;
|
|
private String content;
|
|
private String author;
|
|
private LocalDate postDate;
|
|
private int likeCount;
|
|
private int commentCount;
|
|
private int viewCount;
|
|
private String tags;
|
|
private String sentiment;
|
|
|
|
public PostInfo() {
|
|
}
|
|
|
|
public PostInfo(String title, String content, String author, LocalDate postDate,
|
|
int likeCount, int commentCount, int viewCount, String tags, String sentiment) {
|
|
this.title = title;
|
|
this.content = content;
|
|
this.author = author;
|
|
this.postDate = postDate;
|
|
this.likeCount = likeCount;
|
|
this.commentCount = commentCount;
|
|
this.viewCount = viewCount;
|
|
this.tags = tags;
|
|
this.sentiment = sentiment;
|
|
}
|
|
|
|
public String getTitle() {
|
|
return title;
|
|
}
|
|
|
|
public void setTitle(String title) {
|
|
this.title = title;
|
|
}
|
|
|
|
public String getContent() {
|
|
return content;
|
|
}
|
|
|
|
public void setContent(String content) {
|
|
this.content = content;
|
|
}
|
|
|
|
public String getAuthor() {
|
|
return author;
|
|
}
|
|
|
|
public void setAuthor(String author) {
|
|
this.author = author;
|
|
}
|
|
|
|
public LocalDate getPostDate() {
|
|
return postDate;
|
|
}
|
|
|
|
public void setPostDate(LocalDate postDate) {
|
|
this.postDate = postDate;
|
|
}
|
|
|
|
public int getLikeCount() {
|
|
return likeCount;
|
|
}
|
|
|
|
public void setLikeCount(int likeCount) {
|
|
this.likeCount = likeCount;
|
|
}
|
|
|
|
public int getCommentCount() {
|
|
return commentCount;
|
|
}
|
|
|
|
public void setCommentCount(int commentCount) {
|
|
this.commentCount = commentCount;
|
|
}
|
|
|
|
public int getViewCount() {
|
|
return viewCount;
|
|
}
|
|
|
|
public void setViewCount(int viewCount) {
|
|
this.viewCount = viewCount;
|
|
}
|
|
|
|
public String getTags() {
|
|
return tags;
|
|
}
|
|
|
|
public void setTags(String tags) {
|
|
this.tags = tags;
|
|
}
|
|
|
|
public String getSentiment() {
|
|
return sentiment;
|
|
}
|
|
|
|
public void setSentiment(String sentiment) {
|
|
this.sentiment = sentiment;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "PostInfo{" +
|
|
"title='" + title + '\'' +
|
|
", author='" + author + '\'' +
|
|
", postDate=" + postDate +
|
|
", likeCount=" + likeCount +
|
|
", commentCount=" + commentCount +
|
|
", viewCount=" + viewCount +
|
|
", sentiment='" + sentiment + '\'' +
|
|
'}';
|
|
}
|
|
|
|
public String toCSV() {
|
|
return String.format("\"%s\",\"%s\",\"%s\",\"%s\",%d,%d,%d,\"%s\",\"%s\"",
|
|
title != null ? title.replace("\"", "\"\"") : "",
|
|
content != null ? content.replace("\"", "\"\"").replace("\n", " ") : "",
|
|
author != null ? author.replace("\"", "\"\"") : "",
|
|
postDate != null ? postDate.toString() : "",
|
|
likeCount,
|
|
commentCount,
|
|
viewCount,
|
|
tags != null ? tags.replace("\"", "\"\"") : "",
|
|
sentiment != null ? sentiment.replace("\"", "\"\"") : "");
|
|
}
|
|
}
|
|
|