13 package cz.vutbr.fit.knot.annotations.entity;
16 import java.io.Serializable;
17 import javax.persistence.Basic;
18 import javax.persistence.Column;
19 import javax.persistence.Entity;
20 import javax.persistence.GeneratedValue;
21 import javax.persistence.GenerationType;
22 import javax.persistence.Id;
23 import javax.persistence.JoinColumn;
24 import javax.persistence.ManyToOne;
25 import javax.persistence.NamedQueries;
26 import javax.persistence.NamedQuery;
27 import javax.persistence.Table;
28 import javax.validation.constraints.NotNull;
29 import javax.validation.constraints.Size;
38 @Table(name =
"source")
40 @NamedQuery(name =
"Source.findAll", query =
"SELECT s FROM Source s"),
41 @NamedQuery(name =
"Source.findById", query =
"SELECT s FROM Source s WHERE s.id = :id"),
42 @NamedQuery(name =
"Source.findByAnnotType", query =
"SELECT s FROM Source s WHERE s.annotType = :annotType"),
43 @NamedQuery(name =
"Source.findByUser", query =
"SELECT s FROM Source s WHERE s.userUri = :userUri"),
44 @NamedQuery(name =
"Source.findBySource", query =
"SELECT s FROM Source s WHERE s.source = :source"),
45 @NamedQuery(name =
"Source.findByPolarity", query =
"SELECT s FROM Source s WHERE s.polarity = :polarity"),
46 @NamedQuery(name =
"Source.findByPackageId", query =
"SELECT s FROM Source s WHERE s.packageId = :packageId")})
47 public class Source implements Serializable {
48 private static final long serialVersionUID = 1L;
51 @GeneratedValue(strategy = GenerationType.IDENTITY)
52 @Basic(optional =
false)
58 @Column(name = "annotType")
59 private String annotType;
63 @Column(name = "userUri")
64 private String userUri;
68 @Column(name = "source")
69 private String source;
72 @Basic(optional = false)
74 @Column(name = "polarity")
75 private
boolean polarity;
78 @Basic(optional = false)
79 @Column(name = "packageId", nullable = false, insertable = false, updatable = false)
80 private Integer packageId;
83 @ManyToOne(optional = false)
84 @JoinColumn(name = "packageId", referencedColumnName = "
id")
108 public Source(Integer
id,
boolean polarity) {
110 this.polarity = polarity;
146 this.annotType = annotType;
182 this.source = source;
200 this.polarity = polarity;
218 this.packageId = packageId;
227 return refSubscription;
236 this.refSubscription = refSubscription;
242 hash += (
id != null ? id.hashCode() : 0);
255 if (!(
object instanceof
Source)) {
258 Source other = (Source)
object;
259 if ((this.
id == null && other.
id != null) || (this.id != null && !this.id.equals(other.id))) {
267 return "cz.vutbr.fit.knot.annotations.entity.Source[ id=" +
id +
" ]";
277 StringBuilder result =
new StringBuilder(
"<source ");
279 result.append(
"subscribe=\"");
280 result.append(polarity);
281 result.append(
"\" ");
283 if(annotType != null && !annotType.isEmpty()){
284 result.append(
"typeUri=\"");
285 result.append(annotType);
286 result.append(
"\" ");
289 if(userUri != null && !userUri.isEmpty()){
290 result.append(
"authorUri=\"");
291 result.append(userUri);
292 result.append(
"\" ");
295 if(source != null && !source.isEmpty()){
296 result.append(
"groupUri=\"");
297 result.append(source);
298 result.append(
"\" ");
302 return result.toString();
Class representing subscription.
boolean equals(Object object)
void setAnnotType(String annotType)
Source(Integer id, boolean polarity)
void setUser(String user)
void setRefSubscription(Subscription refSubscription)
SubscribedSource getSourceAsSubSource()
void setPackageId(Integer packageId)
Subscribed source of annotations.
void setSource(String source)
Class representing source of subscription.
void setPolarity(boolean polarity)
Subscription getRefSubscription()