Repository navigation
Expand file tree
/
Copy pathEvent.java
More file actions
116 lines (96 loc) · 3.28 KB
/
Copy pathEvent.java
File metadata and controls
116 lines (96 loc) · 3.28 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
package eventManagement;
import java.time.LocalDateTime;
public abstract class Event {
private String eventId;
private String title;
private LocalDateTime dateTime;
private String location;
private int capacity;
private EventStatus status;
public Event(String eventId, String title, LocalDateTime dateTime,
String location, int capacity) {
this(eventId, title, dateTime, location, capacity, EventStatus.ACTIVE);
}
public Event(String eventId, String title, LocalDateTime dateTime,
String location, int capacity, EventStatus status) {
if (eventId == null || eventId.trim().isEmpty()) {
throw new IllegalArgumentException("eventId required");
}
if (title == null || title.trim().isEmpty()) {
throw new IllegalArgumentException("title required");
}
if (dateTime == null) {
throw new IllegalArgumentException("dateTime required");
}
if (location == null || location.trim().isEmpty()) {
throw new IllegalArgumentException("location required");
}
if (capacity <= 0) {
throw new IllegalArgumentException("capacity must be > 0");
}
if (status == null) {
throw new IllegalArgumentException("status required");
}
this.eventId = eventId;
this.title = title;
this.dateTime = dateTime;
this.location = location;
this.capacity = capacity;
this.status = status;
}
public String getEventId() {
return eventId;
}
public String getTitle() {
return title;
}
public LocalDateTime getDateTime() {
return dateTime;
}
public String getLocation() {
return location;
}
public int getCapacity() {
return capacity;
}
public EventStatus getStatus() {
return status;
}
public void setTitle(String title) {
if (title == null || title.trim().isEmpty()) {
throw new IllegalArgumentException("title required");
}
this.title = title;
}
public void setDateTime(LocalDateTime dateTime) {
if (dateTime == null) {
throw new IllegalArgumentException("dateTime required");
}
this.dateTime = dateTime;
}
public void setLocation(String location) {
if (location == null || location.trim().isEmpty()) {
throw new IllegalArgumentException("location required");
}
this.location = location;
}
public void setCapacity(int capacity) {
if (capacity <= 0) {
throw new IllegalArgumentException("capacity must be > 0");
}
this.capacity = capacity;
}
public void setStatus(EventStatus status) {
if (status == null) {
throw new IllegalArgumentException("status required");
}
this.status = status;
}
public void cancel() {
this.status = EventStatus.CANCELLED;
}
public abstract EventType getType();
public abstract String getExtraLabel();
public abstract String getExtraValue();
public abstract void setExtraValue(String value);
}