7e9ee1cc544938a32fd9c575ef25db17293563b9.svn-base
4.83 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/**
* Copyright © 2015-2018 ODM All rights reserved.
*/
package com.thinkgem.jeesite.modules.cms.entity;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.NotNull;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.Length;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.google.common.collect.Lists;
import com.thinkgem.jeesite.common.persistence.DataEntity;
import com.thinkgem.jeesite.modules.cms.utils.CmsUtils;
/**
* 文章Entity
* @author ThinkGem
* @version 2013-05-15
*/
public class Article extends DataEntity<Article> {
public static final String DEFAULT_TEMPLATE = "frontViewArticle";
private static final long serialVersionUID = 1L;
private Category category;// 分类编号
private String title; // 标题
private String link; // 外部链接
private String color; // 标题颜色(red:红色;green:绿色;blue:蓝色;yellow:黄色;orange:橙色)
private String image; // 文章图片
private String keywords;// 关键字
private String description;// 描述、摘要
private Integer weight; // 权重,越大越靠前
private Date weightDate;// 权重期限,超过期限,将weight设置为0
private Integer hits; // 点击数
private String posid; // 推荐位,多选(1:首页焦点图;2:栏目页文章推荐;)
private String customContentView; // 自定义内容视图
private String viewConfig; // 视图参数
private ArticleData articleData; //文章副表
private Date beginDate; // 开始时间
private Date endDate; // 结束时间
private User user;
public Article() {
super();
this.weight = 0;
this.hits = 0;
this.posid = "";
}
public Article(String id){
this();
this.id = id;
}
public Article(Category category){
this();
this.category = category;
}
public void prePersist(){
//TODO 后续处理,暂不知有何用处
//super.prePersist();
articleData.setId(this.id);
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Length(min=0, max=255)
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
@Length(min=0, max=50)
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
@Length(min=0, max=255)
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;//CmsUtils.formatImageSrcToDb(image);
}
@Length(min=0, max=255)
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
@Length(min=0, max=255)
public String getDescription() {
return description;
}
public Date getBeginDate() {
return beginDate;
}
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public void setDescription(String description) {
this.description = description;
}
@NotNull
public Integer getWeight() {
return weight;
}
public void setWeight(Integer weight) {
this.weight = weight;
}
public Date getWeightDate() {
return weightDate;
}
public void setWeightDate(Date weightDate) {
this.weightDate = weightDate;
}
public Integer getHits() {
return hits;
}
public void setHits(Integer hits) {
this.hits = hits;
}
@Length(min=0, max=10)
public String getPosid() {
return posid;
}
public void setPosid(String posid) {
this.posid = posid;
}
public String getCustomContentView() {
return customContentView;
}
public void setCustomContentView(String customContentView) {
this.customContentView = customContentView;
}
public String getViewConfig() {
return viewConfig;
}
public void setViewConfig(String viewConfig) {
this.viewConfig = viewConfig;
}
public ArticleData getArticleData() {
return articleData;
}
public void setArticleData(ArticleData articleData) {
this.articleData = articleData;
}
public List<String> getPosidList() {
List<String> list = Lists.newArrayList();
if (posid != null){
for (String s : StringUtils.split(posid, ",")) {
list.add(s);
}
}
return list;
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public void setPosidList(List<String> list) {
posid = ","+StringUtils.join(list, ",")+",";
}
public String getUrl() {
return CmsUtils.getUrlDynamic(this);
}
public String getImageSrc() {
return CmsUtils.formatImageSrcToWeb(this.image);
}
}