various updates, opensocial support
[ical-aggregator.git] / src / main / java / net / bzzt / ical / aggregator / model / Feed.java
blob1e230ae64a66bef76ee4f982694b4dc1311431d2
1 package net.bzzt.ical.aggregator.model;
3 import java.io.Serializable;
4 import java.net.URL;
5 import java.util.Date;
7 import javax.persistence.Column;
8 import javax.persistence.Entity;
9 import javax.persistence.GeneratedValue;
10 import javax.persistence.Id;
12 import net.bzzt.ical.aggregator.web.model.Identifiable;
14 import org.hibernate.annotations.Cache;
15 import org.hibernate.annotations.CacheConcurrencyStrategy;
17 @Entity
18 @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
19 public class Feed implements Serializable, Identifiable<Long>, Comparable<Feed> {
20 /**
23 private static final long serialVersionUID = 1L;
25 @Id
26 @GeneratedValue
27 public Long id;
29 @Column(nullable=false)
30 public String name;
32 @Column(nullable=false,unique=true)
33 public String shortName;
35 /**
36 * Feeds zonder URL hebben alleen handmatige events
38 @Column(nullable=true)
39 public URL url;
41 public Date lastUpdate;
43 public Integer lastUpdateEvents = 0;
45 public Integer lastUpdateAdded = 0;
47 public String lastUpdateError;
49 private Integer prio = 50;
51 private Boolean showByDefault = true;
53 /** bijv. homepage van de bron */
54 public URL link;
56 public String description;
58 public Feed() { }
60 public Feed(String name, String shortName) {
61 this.shortName = shortName;
62 this.name = name;
65 public Feed(String name, String shortName, URL url, URL link, String description, Integer prio, Boolean showByDefault)
67 this.name = name;
68 this.shortName = shortName;
69 this.url = url;
70 this.link = link;
71 this.description = description;
72 this.prio = prio;
73 this.showByDefault = showByDefault;
76 public Long getId() {
77 return id;
80 public URL getUrl() {
81 return url;
84 @Override
85 public String toString() {
86 return name;
89 public Integer getPrio() {
90 return prio;
93 public void setPrio(Integer prio)
95 if (prio == null)
97 this.prio = 50;
99 else
101 this.prio = prio;
105 /* (non-Javadoc)
106 * @see java.lang.Object#equals(java.lang.Object)
108 @Override
109 public boolean equals(Object obj)
111 if (obj == null || !(obj instanceof Feed))
113 return false;
115 Feed feed = (Feed) obj;
116 if (id != null)
118 return id.equals(feed.getId());
120 else
122 return this == obj;
127 * @return the showByDefault
129 public Boolean getShowByDefault()
131 return showByDefault;
135 * @param showByDefault the showByDefault to set
137 public void setShowByDefault(Boolean showByDefault)
139 if (showByDefault == null)
141 this.showByDefault = true;
143 else
145 this.showByDefault = showByDefault;
149 @Override
150 public int compareTo(Feed o)
152 return name.compareTo(o.name);
156 * @return the name
158 public String getName()
160 return name;
164 * @param name the name to set
166 public void setName(String name)
168 this.name = name;
172 * @return the shortName
174 public String getShortName()
176 return shortName;
180 * @param shortName the shortName to set
182 public void setShortName(String shortName)
184 this.shortName = shortName;