forked from maxliaops/Java_Web_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArticleType.java
More file actions
89 lines (75 loc) · 1.99 KB
/
ArticleType.java
File metadata and controls
89 lines (75 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.hrl.model;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Set;
public class ArticleType {
private Integer articleTypeId = null;
private String articleTypeName = null;
private String articleTypeDesc = null;
private Set<Article> articles = null;
public Integer getArticleTypeId() {
return articleTypeId;
}
public void setArticleTypeId(Integer articleTypeId) {
this.articleTypeId = articleTypeId;
}
public String getArticleTypeName() {
return articleTypeName;
}
public void setArticleTypeName(String articleTypeName) {
this.articleTypeName = articleTypeName;
}
public String getArticleTypeDesc() {
return articleTypeDesc;
}
public void setArticleTypeDesc(String articleTypeDesc) {
this.articleTypeDesc = articleTypeDesc;
}
public Set<Article> getArticles() {
return articles;
}
public void setArticles(Set<Article> articles) {
this.articles = articles;
}
public String getTotalReplyCount() {
Integer count = 0;
if (articles != null) {
for (Article article : articles) {
if (article.getReplies() != null) {
count = count + article.getReplies().size();
}
return count.toString();
}
}
return "0";
}
public String getTotalArticleCount() {
if (articles != null) {
return new Integer(articles.size()).toString();
}
return null;
}
public Article getLastUpdateArticle() {
if (articles != null) {
return new ArrayList<Article>(articles).get(0);
}
return null;
}
public String getArticleCountOfToday() {
Integer count = 0;
if (articles != null) {
for (Article article : articles) {
String lastUpdateTime = article.getLastUpdateTime().toString()
.substring(0, 11).trim();
String today = new SimpleDateFormat("yyyy-MM-dd").format(
new Date()).trim();
if (lastUpdateTime.equals(today)) {
count++;
}
}
return count.toString();
}
return "0";
}
}