1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.jboss.as.quickstarts.tasks;
18
19 import static javax.persistence.GenerationType.IDENTITY;
20
21 import javax.persistence.*;
22 import java.io.Serializable;
23
24
25
26
27
28
29 @SuppressWarnings("serial")
30 @Entity
31 public class Task implements Serializable {
32
33 @Id
34 @GeneratedValue(strategy = IDENTITY)
35 private Long id;
36
37 @ManyToOne
38 private User owner;
39
40 private String title;
41
42 public Task() {
43 }
44
45 public Task(String title) {
46 super();
47 this.title = title;
48 }
49
50 public Long getId() {
51 return id;
52 }
53
54 public void setId(Long id) {
55 this.id = id;
56 }
57
58 public User getOwner() {
59 return owner;
60 }
61
62 public void setOwner(User owner) {
63 this.owner = owner;
64 }
65
66 public String getTitle() {
67 return title;
68 }
69
70 public void setTitle(String title) {
71 this.title = title;
72 }
73
74 @Override
75 public int hashCode() {
76 final int prime = 31;
77 int result = 1;
78 result = prime * result + ((owner == null) ? 0 : owner.hashCode());
79 result = prime * result + ((title == null) ? 0 : title.hashCode());
80 return result;
81 }
82
83 @Override
84 public boolean equals(Object obj) {
85 if (this == obj)
86 return true;
87 if (obj == null)
88 return false;
89 if (getClass() != obj.getClass())
90 return false;
91 Task other = (Task) obj;
92 if (owner == null) {
93 if (other.owner != null)
94 return false;
95 } else if (!owner.equals(other.owner))
96 return false;
97 if (title == null) {
98 if (other.title != null)
99 return false;
100 } else if (!title.equals(other.title))
101 return false;
102 return true;
103 }
104
105 }