-
Notifications
You must be signed in to change notification settings - Fork 2
/
Group.java
239 lines (206 loc) · 5.98 KB
/
Group.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
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
import java.util.*;
public class Group {
private ArrayList<Category> categories;
private ArrayList<UUID> members;
private ArrayList<String> events;
private String name;
private String author;
private String description;
private int rating;
private String authorContact;
private UUID id;
private ArrayList<String> messageList;
public Group(String name, String description, ArrayList<Category> categories2) {
id = UUID.randomUUID();
this.name = name;
this.description = description;
this.categories = categories2;
}
public Group(UUID groupID, String groupName, ArrayList<String> groupUpcomingEvent,
ArrayList<Category> groupCategories,
ArrayList<UUID> groupMemberList, String groupDescription, int groupRating, String groupAuthor,
ArrayList<String> groupMessageList,
String groupAuthorContact) {
this.id = groupID;
this.name = groupName;
this.events = groupUpcomingEvent;
this.categories = groupCategories;
this.members = groupMemberList;
this.description = groupDescription;
this.rating = groupRating;
this.author = groupAuthor;
this.messageList = groupMessageList;
this.authorContact = groupAuthorContact;
}
/*
* @param getEventID returns an arrayList of the events UUID //no long returns
* UUID because they weren't set up.
*/
public ArrayList<String> getEventID() {
return events;
}
/*
* @param addEventID takes in eventID as a parameter and adds the eventID to the
* array of events. // no longer adds event UUID
* as it was implemented
*/
public void addEventID(String eventID) {
events.add(eventID);
}
/*
* @parram getMessageList is an arrayList of strings that will return the
* messageList
*/
public ArrayList<String> getMessageList() {
return messageList;
}
/*
* @param addMessage takes in message as a parameter and adds it to the string
* arraylist of messages.
*/
public void addMessage(String message) {
messageList.add(message);
}
/*
* @param getDescription returns description
*/
public String getDescription() {
return description;
}
/*
* @param getGroupName returns name
*/
public String getGroupName() {
return name;
}
/*
* @param getGroupID returns id
*/
public UUID getGroupId() {
return id;
}
/*
* @param getUpcomingEvents returns description
*/
public ArrayList<Event> getUpcomingEvents() {
return null;
}
/*
* @param getDescription returns description
*/
public ArrayList<String> getCategoryTypes() {
return null;
}
/*
* @param getGroupMembers returns members
*/
public ArrayList<String> getGroupMembers() {
UserList ul = UserList.getInstance();
ArrayList<String> gMembers = new ArrayList<String>();
for (UUID member : members) {
for (User user : ul.getAllUsers()) {
if (member.equals(user.getUserId())
&& (!gMembers.contains(user.getFirstName() + " " + user.getLastName()))) {
gMembers.add(user.getFirstName() + " " + user.getLastName());
}
}
}
return gMembers;
}
/*
* @param addMembers takes in memberID as parameter and then adds it to the
* arrayList of members.
*/
public void addMembers(UUID memberID) {
members.add(memberID);
}
/*
* @param getGroupRating returns the integer rating
*/
public int getGroupRating() {
return rating;
}
/*
* @param getDescription returns the string authorContact
*/
public String getContact() {
return authorContact;
}
/*
* @param setDescription sets the descirption for the group
*/
public void setDescription(String description) {
this.description = description;
}
/*
* @param setGroupName sets the name for the group
*/
public void setGroupName(String name) {
this.name = name;
}
/*
* @param setDescription sets the id for the group
*/
public void setGroupId(UUID id) {
this.id = id;
}
/*
* @param setUpcomingEvents sets the events for the group
*/
public void setUpcomingEvents(ArrayList<String> events) {
this.events = events;
}
/*
* @param setCategoryTypes sets the categories for the group
*/
public void setCategoryTypes(ArrayList<Category> category) {
this.categories = category;
}
/*
* @param setDescription sets the descirption for the group
*/
public void setGroupRating(int rating) {
this.rating = rating;
}
/*
* @param setDescription sets the descirption for the group
*/
public void setAuthorContact(String authorContact)// Author's email
{
this.authorContact = authorContact;
}
/*
* @param addToAllGroups sets the descirption for the group
*/
public void addToAllGroups(Group group) {
}
/*
* @param hasCategory returns whether or not it is true that a group is part of
* a category.
*/
public boolean hasCategory(Category category) {
return categories.contains(category);
}
/**
* This method returns the authors name, not the UUID
*
* @return a String of the group's author's name.
*/
public String getGroupAuthor() {
return this.author;
}
/*
* @param UUID getAuthor will return an authors UUID
*/
public UUID getAuthor() {
UUID author;
UserList ul = UserList.getInstance();
for (User user : ul.getAllUsers()) {
if (user.getEmailAddress().equals(authorContact)) {
author = user.userId;
return author;
}
}
return null;
}
}