1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.mobility.news.entity;
17
18 import java.io.Serializable;
19 import java.util.ArrayList;
20 import java.util.List;
21
22
23
24
25
26
27 public class NewsFeed implements Serializable, Comparable<NewsFeed> {
28
29 private static final long serialVersionUID = 475441282491797666L;
30
31 private String title;
32 private String author;
33 private String description;
34 private long sourceId;
35 private List<NewsArticle> articles;
36 private int order;
37
38 public NewsFeed copy() {
39 NewsFeed copy = new NewsFeed();
40 copy.setSourceId(sourceId);
41 copy.setOrder(order);
42 if (title != null) {
43 copy.setTitle(new String(title));
44 }
45 if (author != null) {
46 copy.setAuthor(new String(author));
47 }
48 if (description != null) {
49 copy.setDescription(new String(description));
50 }
51 if (!articles.isEmpty()) {
52 List<NewsArticle> articlesCopy = new ArrayList<NewsArticle>();
53 for (NewsArticle article : articles) {
54 articlesCopy.add(article.copy());
55 }
56 copy.setArticles(articlesCopy);
57 }
58 return copy;
59 }
60
61 public NewsFeed() {
62 articles = new ArrayList<NewsArticle>();
63 }
64
65 @Override
66 public int compareTo(NewsFeed o) {
67 return order - o.order;
68 }
69
70
71
72
73 public String getTitle() {
74 return title;
75 }
76
77
78
79
80 public void setTitle(String title) {
81 this.title = title;
82 }
83
84
85
86
87 public String getAuthor() {
88 return author;
89 }
90
91
92
93
94 public void setAuthor(String author) {
95 this.author = author;
96 }
97
98
99
100
101 public String getDescription() {
102 return description;
103 }
104
105
106
107
108 public void setDescription(String description) {
109 this.description = description;
110 }
111
112
113
114
115 public long getSourceId() {
116 return sourceId;
117 }
118
119
120
121
122 public void setSourceId(long sourceId) {
123 this.sourceId = sourceId;
124 }
125
126
127
128
129 public List<NewsArticle> getArticles() {
130 return articles;
131 }
132
133
134
135
136 public void setArticles(List<NewsArticle> articles) {
137 this.articles = articles;
138 }
139
140
141
142
143 public int getOrder() {
144 return order;
145 }
146
147
148
149
150 public void setOrder(int order) {
151 this.order = order;
152 }
153 }