589e1ad3
jcartign
First version
|
1
2
|
package fr.plil.sio.examen.api;
|
575ff2e8
msahmane
Examen terminé.
|
3
4
5
6
7
8
9
10
|
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;
|
589e1ad3
jcartign
First version
|
11
12
13
14
15
16
17
18
19
20
21
|
/**
* 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.
*/
|
575ff2e8
msahmane
Examen terminé.
|
22
|
@Entity
|
589e1ad3
jcartign
First version
|
23
24
|
public class Comment {
|
575ff2e8
msahmane
Examen terminé.
|
25
26
27
28
29
|
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@ManyToOne(optional = false)
|
589e1ad3
jcartign
First version
|
30
31
|
private Owner reporter;
|
575ff2e8
msahmane
Examen terminé.
|
32
|
@ManyToOne(optional = false)
|
589e1ad3
jcartign
First version
|
33
34
|
private Animal animal;
|
575ff2e8
msahmane
Examen terminé.
|
35
|
@Column(nullable = false)
|
589e1ad3
jcartign
First version
|
36
|
private String message;
|
575ff2e8
msahmane
Examen terminé.
|
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
|
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 animal;
}
public void setAnimal(Animal animal) {
this.animal = animal;
}
public String getMessage(){
return this.message;
}
public void setMessage(String message){
this.message = message;
}
|
589e1ad3
jcartign
First version
|
70
|
}
|