Blame view

src/main/java/fr/plil/sio/examen/api/Comment.java 1.87 KB
589e1ad3   jcartign   First version
1
2
  package fr.plil.sio.examen.api;

  

069a0012   rvangrev   Annotations ajoutées
3
4
5
6
7
8
9
10
11
12
  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;

  

589e1ad3   jcartign   First version
13
14
15
16
17
18
19
20
21
22
23
  /**

   * 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.

   */

069a0012   rvangrev   Annotations ajoutées
24
25
  @Entity

  @Table(name="COMMENT_T")

589e1ad3   jcartign   First version
26
27
  public class Comment {

      

069a0012   rvangrev   Annotations ajoutées
28
29
30
31
32
33
      @Id

      @GeneratedValue(strategy = GenerationType.AUTO)

      private Long id;

      

      @ManyToOne(optional = false)

      @JoinColumn(name="OWNER_ID")

589e1ad3   jcartign   First version
34
35
      private Owner reporter;

      

069a0012   rvangrev   Annotations ajoutées
36
37
      @ManyToOne(optional = false)

      @JoinColumn(name="ANIMAL_ID")

589e1ad3   jcartign   First version
38
39
      private Animal animal;

      

069a0012   rvangrev   Annotations ajoutées
40
      @Column(nullable = false)

589e1ad3   jcartign   First version
41
      private String message;

5fd5c185   rvangrev   Correction des Mé...
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
      

      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;

      }

589e1ad3   jcartign   First version
74
  }