added javaDoc for UserService
This commit is contained in:
@ -128,9 +128,9 @@ public class EventService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gibt eine Liste aus Gruppen zurück in denen sich der User befindet.
|
* Gibt eine Liste aus GruppenIds zurück in denen sich der User befindet.
|
||||||
* @param userId Der User
|
* @param userId Die Id des Users
|
||||||
* @return Liste aus Gruppen
|
* @return Liste aus GruppenIds
|
||||||
*/
|
*/
|
||||||
public List<UUID> findGroupIdsByUser(String userId) {
|
public List<UUID> findGroupIdsByUser(String userId) {
|
||||||
return eventStore.findGroupIdsWhereUserId(userId).stream()
|
return eventStore.findGroupIdsWhereUserId(userId).stream()
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
//Hallo
|
|
||||||
@Service
|
@Service
|
||||||
public class UserService {
|
public class UserService {
|
||||||
|
|
||||||
@ -23,24 +22,33 @@ public class UserService {
|
|||||||
this.eventService = eventService;
|
this.eventService = eventService;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Test nötig??
|
/**
|
||||||
|
* Gibt eine Liste aus Gruppen zurück, in denen sich der übergebene User befindet.
|
||||||
public List<Group> getUserGroups(User user) throws EventException {
|
* @param user Der User
|
||||||
|
* @return Liste aus Gruppen
|
||||||
|
*/
|
||||||
|
public List<Group> getUserGroups(User user) {
|
||||||
List<UUID> groupIds = eventService.findGroupIdsByUser(user.getId());
|
List<UUID> groupIds = eventService.findGroupIdsByUser(user.getId());
|
||||||
List<Event> events = groupService.getGroupEvents(groupIds);
|
List<Event> events = groupService.getGroupEvents(groupIds);
|
||||||
List<Group> groups = groupService.projectEventList(events);
|
List<Group> groups = groupService.projectEventList(events);
|
||||||
List<Group> newGroups = new ArrayList<>();
|
List<Group> newGroups = new ArrayList<>();
|
||||||
|
|
||||||
for (Group group : groups) {
|
for (Group group : groups) {
|
||||||
if (group.getMembers().contains(user)) {
|
if (group.getMembers().contains(user)) {
|
||||||
newGroups.add(group);
|
newGroups.add(group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
groupService.sortByGroupType(newGroups);
|
groupService.sortByGroupType(newGroups);
|
||||||
|
|
||||||
return newGroups;
|
return newGroups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt die Gruppe zurück, die zu der übergebenen Id passt.
|
||||||
|
* @param groupId Die Id der gesuchten Gruppe
|
||||||
|
* @return Die gesuchte Gruppe
|
||||||
|
* @throws EventException Wenn die Gruppe nicht gefunden wird
|
||||||
|
*/
|
||||||
public Group getGroupById(UUID groupId) throws EventException {
|
public Group getGroupById(UUID groupId) throws EventException {
|
||||||
List<UUID> groupIds = new ArrayList<>();
|
List<UUID> groupIds = new ArrayList<>();
|
||||||
groupIds.add(groupId);
|
groupIds.add(groupId);
|
||||||
|
|||||||
Reference in New Issue
Block a user