View Javadoc

1   /**
2    * Copyright 2011 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.mobility.news.entity;
17  
18  import java.util.List;
19  import javax.persistence.Column;
20  import javax.persistence.Entity;
21  import javax.persistence.GeneratedValue;
22  import javax.persistence.GenerationType;
23  import javax.persistence.Id;
24  import javax.persistence.Table;
25  import javax.persistence.Transient;
26  import javax.persistence.Version;
27  
28  /**
29   * Represents a source for a news feed.  Each NewsSource has an associated NewsFeed.
30   * A NewsSource contains the URL and display order for a feed, whereas the NewsFeed contains the actual feed data.
31   *
32   * @author Kuali Mobility Team (moblitiy.collab@kuali.org)
33   *
34   */
35  @Entity
36  @Table(name="NEWS_SRC_T")
37  public class NewsSourceDBImpl implements NewsSource {
38  
39  	@Id
40  	@GeneratedValue(strategy = GenerationType.TABLE)
41  	@Column(name="ID")
42  	private Long id;
43  
44  	@Column(name="NAME")
45  	private String name;
46  
47  	@Column(name="URL")
48  	private String url;
49  
50  	@Column(name="ACTIVE")
51  	private boolean active;
52  
53  	@Column(name="ORDR")
54  	private int order;
55  
56  	// TODO: Change this so it can be persisted.
57  	@Transient
58  	private Long parentId;
59  
60  	@Transient
61  	private String title;
62  
63      @Transient
64  	private String author;
65  
66      @Transient
67  	private String description;
68  
69      @Transient
70  	private List<NewsArticleImpl> articles;
71  
72      @Transient
73      private List<NewsSourceDBImpl> children;
74  
75  	/* (non-Javadoc)
76  	 * @see org.kuali.mobility.news.entity.NewsSource#getId()
77  	 */
78  	@Override
79  	public Long getId() {
80  		return id;
81  	}
82  
83  	/* (non-Javadoc)
84  	 * @see org.kuali.mobility.news.entity.NewsSource#setId(java.lang.Long)
85  	 */
86  	@Override
87  	public void setId(Long id) {
88  		this.id = id;
89  	}
90  
91  	/* (non-Javadoc)
92  	 * @see org.kuali.mobility.news.entity.NewsSource#getUrl()
93  	 */
94  	@Override
95  	public String getUrl() {
96  		return url;
97  	}
98  
99  	/* (non-Javadoc)
100 	 * @see org.kuali.mobility.news.entity.NewsSource#setUrl(java.lang.String)
101 	 */
102 	public void setUrl(String url) {
103 		this.url = url;
104 	}
105 
106 	/* (non-Javadoc)
107 	 * @see org.kuali.mobility.news.entity.NewsSource#isActive()
108 	 */
109 	@Override
110 	public boolean isActive() {
111 		return active;
112 	}
113 
114 	/* (non-Javadoc)
115 	 * @see org.kuali.mobility.news.entity.NewsSource#setActive(boolean)
116 	 */
117 	@Override
118 	public void setActive(boolean active) {
119 		this.active = active;
120 	}
121 
122 	/* (non-Javadoc)
123 	 * @see org.kuali.mobility.news.entity.NewsSource#getName()
124 	 */
125 	@Override
126 	public String getName() {
127 		return name;
128 	}
129 
130 	/* (non-Javadoc)
131 	 * @see org.kuali.mobility.news.entity.NewsSource#setName(java.lang.String)
132 	 */
133 	public void setName(String name) {
134 		this.name = name;
135 	}
136 
137 	/* (non-Javadoc)
138 	 * @see org.kuali.mobility.news.entity.NewsSource#getOrder()
139 	 */
140 	@Override
141 	public int getOrder() {
142 		return order;
143 	}
144 
145 	/* (non-Javadoc)
146 	 * @see org.kuali.mobility.news.entity.NewsSource#setOrder(int)
147 	 */
148 	@Override
149 	public void setOrder(int order) {
150 		this.order = order;
151 	}
152 
153 	public Long getParentId() {
154 		return parentId;
155 	}
156 
157 	public void setParentId(Long parentId) {
158 		this.parentId = parentId;
159 	}
160 
161     /**
162      * @return the title
163      */
164     public String getTitle() {
165         return title;
166     }
167 
168     /**
169      * @param title the title to set
170      */
171     public void setTitle(String title) {
172         this.title = title;
173     }
174 
175     /**
176      * @return the author
177      */
178     public String getAuthor() {
179         return author;
180     }
181 
182     /**
183      * @param author the author to set
184      */
185     public void setAuthor(String author) {
186         this.author = author;
187     }
188 
189     /**
190      * @return the description
191      */
192     public String getDescription() {
193         return description;
194     }
195 
196     /**
197      * @param description the description to set
198      */
199     public void setDescription(String description) {
200         this.description = description;
201     }
202 
203     /**
204      * @return the articles
205      */
206     public List<? extends NewsArticle> getArticles() {
207         return articles;
208     }
209 
210     /**
211      * @param articles the articles to set
212      */
213     public void setArticles(List<? extends NewsArticle> articles) {
214         this.articles = (List<NewsArticleImpl>)(List<?>)articles;
215     }
216 
217     /**
218      * @return the children
219      */
220     public List<? extends NewsSource> getChildren() {
221         return children;
222     }
223 
224     /**
225      * @param children the children to set
226      */
227     public void setChildren(List<? extends NewsSource> children) {
228         this.children = (List<NewsSourceDBImpl>)(List<?>)children;
229     }
230 
231     public void addChild( NewsSource child ) {
232         this.children.add( (NewsSourceDBImpl)child);
233     }
234 }