Comment.java
1.87 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
package fr.plil.sio.examen.api;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;
/**
* A comment is made by an reporter (i.e. an owner) on ANY animal
* (not only the ones he owns).
* An reporter can have zero, one or more comments on any animal (i.e. it can
* exists several comments from the same reporter on the same animal).
* An animal can have zero, one or more comments by any reporter (i.e. it can
* exists several comments from the same reporter on the same animal).
*
* TODO: complete the classes in API to support comment serialization in the
* database.
*/
@Entity
@Table(name="COMMENT_T")
public class Comment {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@ManyToOne(optional = false)
@JoinColumn(name="OWNER_ID")
private Owner reporter;
@ManyToOne(optional = false)
@JoinColumn(name="ANIMAL_ID")
private Animal animal;
@Column(nullable = false)
private String message;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Owner getReporter(){
return this.reporter;
}
public void setReporter(Owner owner){
this.reporter = owner;
}
public Animal getAnimal(){
return this.animal;
}
public void setAnimal(Animal animal){
this.animal = animal;
}
public String getMessage(){
return this.message;
}
public void setMessage(String message){
this.message = message;
}
}