-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathComment.java
78 lines (65 loc) · 2.06 KB
/
Comment.java
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
75
76
77
78
package files;
import java.time.LocalDateTime;
public class Comment {
private Collaborator owner;
private String content;
private LocalDateTime publication;
private LocalDateTime modification;
private Event event;
public Comment(String content, LocalDateTime publication, Collaborator owner, Event event) {
this.setContent(content);
this.setPublication(publication);
this.setOwner(owner);
this.setEvent(event);
this.setModification(null);
}
public Collaborator getOwner() {
return owner;
}
public void setOwner(Collaborator owner) {
if (owner != null) {
this.owner = owner;
} else {
System.out.println("Le propriétaire du commentaire ne peut pas être nul.");
}
}
public String getContent() {
return content;
}
public void setContent(String content) {
if (content != null && !content.isEmpty()) {
this.content = content;
this.modification = LocalDateTime.now();
} else {
System.out.println("Le contenu du commentaire ne peut pas être vide.");
this.content = "Commentaire par défaut";
}
}
public LocalDateTime getPublication() {
return publication;
}
public void setPublication(LocalDateTime publication) {
if (publication != null) {
this.publication = publication;
} else {
System.out.println("La date de publication ne peut pas être nulle.");
this.publication = LocalDateTime.now();
}
}
public LocalDateTime getModification() {
return modification;
}
public void setModification(LocalDateTime modification) {
this.modification = modification;
}
public Event getEvent() {
return event;
}
public void setEvent(Event event) {
if (event != null) {
this.event = event;
} else {
System.out.println("L'événement associé au commentaire ne peut pas être nul.");
}
}
}