implements Grupp chat room
parent
e14f94dfff
commit
9482632faf
|
@ -31,9 +31,16 @@ public class ChatRoom {
|
||||||
public int getRoomId() {
|
public int getRoomId() {
|
||||||
return roomId;
|
return roomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public User getUser1() {
|
||||||
public List<Message> getMessages() {
|
return user1;
|
||||||
|
}
|
||||||
|
public User getUser2() {
|
||||||
|
return user2;
|
||||||
|
}
|
||||||
|
public List<Message> getMessages() {
|
||||||
return messages;
|
return messages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,35 +3,161 @@ package domain;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class GruppenRoom {
|
public class GruppenRoom {
|
||||||
private User creater;
|
private static int nextGroupId = 1000;
|
||||||
private List<User> roots;
|
private final int groupId;
|
||||||
private List<User> participants;
|
private final User creator;
|
||||||
private String description;
|
private List<User> admins;
|
||||||
private String name;
|
private List<User> participants;
|
||||||
private List<Message> messages;
|
private String description;
|
||||||
private final LocalDateTime createdAt;
|
private String name;
|
||||||
|
private List<Message> messages;
|
||||||
public GruppenRoom(User creater, String description, String name) {
|
private final LocalDateTime createdAt;
|
||||||
super();
|
|
||||||
this.creater = creater;
|
public GruppenRoom(User creator, String name, String description) {
|
||||||
this.description = description;
|
Objects.requireNonNull(creator, "Creator darf nicht null sein");
|
||||||
this.name = name;
|
Objects.requireNonNull(name, "Name darf nicht null sein");
|
||||||
this.createdAt = LocalDateTime.now();
|
|
||||||
|
this.groupId = nextGroupId++;
|
||||||
this.roots = new ArrayList<>();
|
this.creator = creator;
|
||||||
this.participants = new ArrayList<>();
|
this.name = name;
|
||||||
this.messages = new ArrayList<>();
|
this.description = description != null ? description : "";
|
||||||
|
this.createdAt = LocalDateTime.now();
|
||||||
this.roots.add(creater);
|
|
||||||
this.participants.add(creater);
|
this.admins = new ArrayList<>();
|
||||||
}
|
this.participants = new ArrayList<>();
|
||||||
|
this.messages = new ArrayList<>();
|
||||||
public boolean addparticipants(User user) {
|
|
||||||
return participants.add(user);
|
this.admins.add(creator);
|
||||||
}
|
this.participants.add(creator);
|
||||||
|
|
||||||
|
// Gruppe beim Creator registrieren
|
||||||
|
creator.getUserGruppenRoom().addGruppenRoom(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean addParticipant(User user) {
|
||||||
|
Objects.requireNonNull(user, "User darf nicht null sein");
|
||||||
|
|
||||||
|
if (participants.contains(user)) {
|
||||||
|
throw new IllegalArgumentException("User ist bereits Teil der Gruppe: " + user.getUsername());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gruppe beim User registrieren
|
||||||
|
boolean added = user.getUserGruppenRoom().addGruppenRoom(this);
|
||||||
|
if (!added) {
|
||||||
|
throw new IllegalStateException("Gruppe konnte nicht beim User registriert werden");
|
||||||
|
}
|
||||||
|
|
||||||
|
return participants.add(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeParticipant(User remover, User userToRemove) {
|
||||||
|
Objects.requireNonNull(remover, "Remover darf nicht null sein");
|
||||||
|
Objects.requireNonNull(userToRemove, "UserToRemove darf nicht null sein");
|
||||||
|
|
||||||
|
if (!admins.contains(remover) && !remover.equals(userToRemove)) {
|
||||||
|
throw new IllegalArgumentException("Nur Admins können andere User entfernen");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userToRemove.equals(creator)) {
|
||||||
|
throw new IllegalArgumentException("Der Creator kann nicht entfernt werden");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gruppe beim User deregistrieren
|
||||||
|
userToRemove.getUserGruppenRoom().removeGruppenRoom(this);
|
||||||
|
|
||||||
|
// Admin-Rechte entfernen falls nötig
|
||||||
|
if (admins.contains(userToRemove)) {
|
||||||
|
admins.remove(userToRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
return participants.remove(userToRemove);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addAdmin(User promoter, User userToPromote) {
|
||||||
|
Objects.requireNonNull(promoter, "Promoter darf nicht null sein");
|
||||||
|
Objects.requireNonNull(userToPromote, "UserToPromote darf nicht null sein");
|
||||||
|
|
||||||
|
if (!admins.contains(promoter)) {
|
||||||
|
throw new IllegalArgumentException("Nur Admins können andere zu Admins befördern");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!participants.contains(userToPromote)) {
|
||||||
|
throw new IllegalArgumentException("User ist nicht Teil der Gruppe");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (admins.contains(userToPromote)) {
|
||||||
|
throw new IllegalArgumentException("User ist bereits Admin");
|
||||||
|
}
|
||||||
|
|
||||||
|
return admins.add(userToPromote);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeAdmin(User demoter, User userToDemote) {
|
||||||
|
Objects.requireNonNull(demoter, "Demoter darf nicht null sein");
|
||||||
|
Objects.requireNonNull(userToDemote, "UserToDemote darf nicht null sein");
|
||||||
|
|
||||||
|
if (!admins.contains(demoter)) {
|
||||||
|
throw new IllegalArgumentException("Nur Admins können Admin-Rechte entziehen");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userToDemote.equals(creator)) {
|
||||||
|
throw new IllegalArgumentException("Der Creator kann nicht seiner Admin-Rechte entzogen werden");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!admins.contains(userToDemote)) {
|
||||||
|
throw new IllegalArgumentException("User ist kein Admin");
|
||||||
|
}
|
||||||
|
|
||||||
|
return admins.remove(userToDemote);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMessage(User sender, String content) {
|
||||||
|
Objects.requireNonNull(sender, "Sender darf nicht null sein");
|
||||||
|
Objects.requireNonNull(content, "Content darf nicht null sein");
|
||||||
|
|
||||||
|
if (!participants.contains(sender)) {
|
||||||
|
throw new IllegalArgumentException("Nur Gruppenmitglieder können Nachrichten senden");
|
||||||
|
}
|
||||||
|
|
||||||
|
Message message = new Message(sender, content);
|
||||||
|
messages.add(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> showMessages() {
|
||||||
|
if (messages.isEmpty()) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
return messages.stream()
|
||||||
|
.map(Message::toString)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAdmin(User user) {
|
||||||
|
return admins.contains(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isParticipant(User user) {
|
||||||
|
return participants.contains(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Getter-Methoden
|
||||||
|
public int getGroupId() { return groupId; }
|
||||||
|
public User getCreator() { return creator; }
|
||||||
|
public String getName() { return name; }
|
||||||
|
public String getDescription() { return description; }
|
||||||
|
public LocalDateTime getCreatedAt() { return createdAt; }
|
||||||
|
public List<User> getAdmins() { return new ArrayList<>(admins); }
|
||||||
|
public List<User> getParticipants() { return new ArrayList<>(participants); }
|
||||||
|
public List<Message> getMessages() { return new ArrayList<>(messages); }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.format("GruppenRoom{name='%s', id=%d, participants=%d, messages=%d}",
|
||||||
|
name, groupId, participants.size(), messages.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,37 +2,68 @@ package domain;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class UserChatRoom {
|
public class UserChatRoom {
|
||||||
|
private List<ChatRoom> chatRooms; // Bessere Namensgebung: chatRooms statt chatsRooms
|
||||||
private List<ChatRoom> chatsRooms;
|
|
||||||
|
public UserChatRoom() {
|
||||||
public UserChatRoom() {
|
this.chatRooms = new ArrayList<>();
|
||||||
this.chatsRooms = new ArrayList<>();
|
}
|
||||||
}
|
|
||||||
|
public boolean addChat(ChatRoom chatRoom) {
|
||||||
public boolean addChat(ChatRoom chatRoom) {
|
Objects.requireNonNull(chatRoom, "ChatRoom darf nicht null sein");
|
||||||
if (chatRoom == null)
|
|
||||||
throw new IllegalArgumentException("ChatRoom soll nicht null sein");
|
if (chatRooms.contains(chatRoom)) {
|
||||||
|
throw new IllegalArgumentException("ChatRoom bereits vorhanden: " + chatRoom.getRoomId());
|
||||||
if (chatsRooms.contains(chatRoom))
|
}
|
||||||
throw new IllegalArgumentException("chatRoom ist vorhanden");
|
|
||||||
|
return chatRooms.add(chatRoom);
|
||||||
return chatsRooms.add(chatRoom);
|
}
|
||||||
}
|
|
||||||
|
public boolean removeChat(ChatRoom chatRoom) {
|
||||||
public boolean removeChat(ChatRoom chatRoom) {
|
Objects.requireNonNull(chatRoom, "ChatRoom darf nicht null sein");
|
||||||
if (chatRoom == null)
|
|
||||||
throw new IllegalArgumentException("ChatRoom soll nicht null sein");
|
if (!chatRooms.contains(chatRoom)) {
|
||||||
|
throw new IllegalArgumentException("ChatRoom nicht gefunden: " + chatRoom.getRoomId());
|
||||||
if (!chatsRooms.contains(chatRoom))
|
}
|
||||||
throw new IllegalArgumentException("chatRoom nicht gefunden");
|
|
||||||
|
return chatRooms.remove(chatRoom);
|
||||||
return chatsRooms.remove(chatRoom);
|
}
|
||||||
}
|
|
||||||
|
public List<ChatRoom> getAllChatRooms() {
|
||||||
public List<ChatRoom> getAllChatsRooms() {
|
return new ArrayList<>(chatRooms); // Rückgabe einer Kopie für Encapsulation
|
||||||
return new ArrayList<>(chatsRooms);
|
}
|
||||||
}
|
|
||||||
|
public List<Integer> getChatRoomIds() {
|
||||||
}
|
List<Integer> ids = new ArrayList<>();
|
||||||
|
for (ChatRoom room : chatRooms) {
|
||||||
|
ids.add(room.getRoomId());
|
||||||
|
}
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(ChatRoom chatRoom) {
|
||||||
|
return chatRooms.contains(chatRoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getChatRoomCount() {
|
||||||
|
return chatRooms.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return chatRooms.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearChatRooms() {
|
||||||
|
chatRooms.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getChatRoomInfos() {
|
||||||
|
List<String> infos = new ArrayList<>();
|
||||||
|
for (ChatRoom room : chatRooms) {
|
||||||
|
infos.add(room.toString());
|
||||||
|
}
|
||||||
|
return infos;
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,14 +4,44 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class UserGruppenRoom {
|
public class UserGruppenRoom {
|
||||||
private List<GruppenRoom> gruppenRooms;
|
private List<GruppenRoom> gruppenRooms;
|
||||||
|
|
||||||
public UserGruppenRoom() {
|
public UserGruppenRoom() {
|
||||||
this.gruppenRooms = new ArrayList<>();
|
this.gruppenRooms = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addGroupproom(GruppenRoom gruppenRoom) {
|
public boolean addGruppenRoom(GruppenRoom gruppenRoom) {
|
||||||
return gruppenRooms.add(gruppenRoom);
|
if (gruppenRooms.contains(gruppenRoom))
|
||||||
}
|
return false;
|
||||||
|
|
||||||
}
|
return gruppenRooms.add(gruppenRoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean removeGruppenRoom(GruppenRoom gruppenRoom) {
|
||||||
|
return gruppenRooms.remove(gruppenRoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<GruppenRoom> getGruppenRooms() {
|
||||||
|
return new ArrayList<>(gruppenRooms); // Rückgabe einer Kopie
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean contains(GruppenRoom gruppenRoom) {
|
||||||
|
return gruppenRooms.contains(gruppenRoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSize() {
|
||||||
|
return gruppenRooms.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return gruppenRooms.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getGruppenRoomNames() {
|
||||||
|
List<String> names = new ArrayList<>();
|
||||||
|
for (GruppenRoom room : gruppenRooms) {
|
||||||
|
names.add(room.getName());
|
||||||
|
}
|
||||||
|
return names;
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,11 +7,15 @@ import domain.*;
|
||||||
|
|
||||||
public class ChatService {
|
public class ChatService {
|
||||||
private Map<Integer, ChatRoom> chatrooms;
|
private Map<Integer, ChatRoom> chatrooms;
|
||||||
|
private Map<Integer, GruppenRoom> gruppenRooms;
|
||||||
private Map<String, User> users;
|
private Map<String, User> users;
|
||||||
|
private Map<Integer, User> usersById;
|
||||||
|
|
||||||
public ChatService() {
|
public ChatService() {
|
||||||
chatrooms = new HashMap<>();
|
chatrooms = new HashMap<>();
|
||||||
|
gruppenRooms = new HashMap<>();
|
||||||
users = new HashMap<>();
|
users = new HashMap<>();
|
||||||
|
usersById = new HashMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean createUser(String userName) {
|
public boolean createUser(String userName) {
|
||||||
|
@ -20,14 +24,17 @@ public class ChatService {
|
||||||
|
|
||||||
User tempUser = new User(userName);
|
User tempUser = new User(userName);
|
||||||
users.put(userName, tempUser);
|
users.put(userName, tempUser);
|
||||||
|
usersById.put(tempUser.getUserId(), tempUser);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private User getUser(String userName) {
|
public User getUser(String userName) {
|
||||||
return users.get(userName);
|
return users.get(userName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public User getUser(int userId) {
|
||||||
|
return usersById.get(userId);
|
||||||
|
}
|
||||||
|
|
||||||
public int createChatRoom(String user1Name, String user2Name) {
|
public int createChatRoom(String user1Name, String user2Name) {
|
||||||
User user1 = getUser(user1Name);
|
User user1 = getUser(user1Name);
|
||||||
|
@ -36,6 +43,14 @@ public class ChatService {
|
||||||
if (user1 == null || user2 == null)
|
if (user1 == null || user2 == null)
|
||||||
throw new IllegalArgumentException("User existiert nicht");
|
throw new IllegalArgumentException("User existiert nicht");
|
||||||
|
|
||||||
|
// Prüfen ob Chat bereits existiert
|
||||||
|
for (ChatRoom room : chatrooms.values()) {
|
||||||
|
if ((room.getUser1().equals(user1) && room.getUser2().equals(user2)) ||
|
||||||
|
(room.getUser1().equals(user2) && room.getUser2().equals(user1))) {
|
||||||
|
return room.getRoomId(); // Existierenden Chat zurückgeben
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ChatRoom tempChatRoom = new ChatRoom(user1, user2);
|
ChatRoom tempChatRoom = new ChatRoom(user1, user2);
|
||||||
chatrooms.put(tempChatRoom.getRoomId(), tempChatRoom);
|
chatrooms.put(tempChatRoom.getRoomId(), tempChatRoom);
|
||||||
user1.getUserChatRoom().addChat(tempChatRoom);
|
user1.getUserChatRoom().addChat(tempChatRoom);
|
||||||
|
@ -44,8 +59,6 @@ public class ChatService {
|
||||||
return tempChatRoom.getRoomId();
|
return tempChatRoom.getRoomId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void sendMessage(int roomId, String senderName, String content) {
|
public void sendMessage(int roomId, String senderName, String content) {
|
||||||
ChatRoom room = chatrooms.get(roomId);
|
ChatRoom room = chatrooms.get(roomId);
|
||||||
if (room == null)
|
if (room == null)
|
||||||
|
@ -56,7 +69,10 @@ public class ChatService {
|
||||||
throw new IllegalArgumentException("Sender existiert nicht: " + senderName);
|
throw new IllegalArgumentException("Sender existiert nicht: " + senderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prüfen ob Sender im Chatroom ist
|
||||||
|
if (!room.getUser1().equals(sender) && !room.getUser2().equals(sender)) {
|
||||||
|
throw new IllegalArgumentException("Sender ist nicht Teil des Chatrooms");
|
||||||
|
}
|
||||||
|
|
||||||
Message message = new Message(sender, content);
|
Message message = new Message(sender, content);
|
||||||
room.addMessage(message);
|
room.addMessage(message);
|
||||||
|
@ -80,6 +96,11 @@ public class ChatService {
|
||||||
User contactUser = users.get(contactUserName);
|
User contactUser = users.get(contactUserName);
|
||||||
User currentUser = users.get(currentUserName);
|
User currentUser = users.get(currentUserName);
|
||||||
|
|
||||||
|
// Verhindere Selbsthinzufügung
|
||||||
|
if (contactUser.equals(currentUser)) {
|
||||||
|
throw new IllegalArgumentException("Kann sich nicht selbst als Kontakt hinzufügen");
|
||||||
|
}
|
||||||
|
|
||||||
return currentUser.getUserContacts().addContact(contactUser);
|
return currentUser.getUserContacts().addContact(contactUser);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +112,13 @@ public class ChatService {
|
||||||
return user.getUserContacts().showAllContacts();
|
return user.getUserContacts().showAllContacts();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Integer> getUserChatRoomIds(String userName) {
|
||||||
|
if (!users.containsKey(userName))
|
||||||
|
throw new IllegalArgumentException("User existiert nicht: " + userName);
|
||||||
|
|
||||||
|
User user = users.get(userName);
|
||||||
|
return user.getUserChatRoom().getChatRoomIds();
|
||||||
|
}
|
||||||
|
|
||||||
public String getChatRoomInfo(int roomId) {
|
public String getChatRoomInfo(int roomId) {
|
||||||
ChatRoom room = chatrooms.get(roomId);
|
ChatRoom room = chatrooms.get(roomId);
|
||||||
|
@ -100,4 +127,69 @@ public class ChatService {
|
||||||
|
|
||||||
return room.toString();
|
return room.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gruppen-Funktionen
|
||||||
|
public int createGruppenRoom(String creatorName, String groupName, String description) {
|
||||||
|
User creator = getUser(creatorName);
|
||||||
|
if (creator == null) {
|
||||||
|
throw new IllegalArgumentException("Creator existiert nicht: " + creatorName);
|
||||||
|
}
|
||||||
|
|
||||||
|
GruppenRoom gruppenRoom = new GruppenRoom(creator, groupName, description);
|
||||||
|
gruppenRooms.put(gruppenRoom.getGroupId(), gruppenRoom);
|
||||||
|
return gruppenRoom.getGroupId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean addParticipantToGroup(int groupId, String adderName, String userToAddName) {
|
||||||
|
GruppenRoom group = gruppenRooms.get(groupId);
|
||||||
|
User adder = getUser(adderName);
|
||||||
|
User userToAdd = getUser(userToAddName);
|
||||||
|
|
||||||
|
if (group == null) throw new IllegalArgumentException("Gruppe existiert nicht: " + groupId);
|
||||||
|
if (adder == null) throw new IllegalArgumentException("Adder existiert nicht: " + adderName);
|
||||||
|
if (userToAdd == null) throw new IllegalArgumentException("User existiert nicht: " + userToAddName);
|
||||||
|
|
||||||
|
if (!group.isAdmin(adder)) {
|
||||||
|
throw new IllegalArgumentException("Nur Admins können Teilnehmer hinzufügen");
|
||||||
|
}
|
||||||
|
|
||||||
|
return group.addParticipant(userToAdd);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendGroupMessage(int groupId, String senderName, String content) {
|
||||||
|
GruppenRoom group = gruppenRooms.get(groupId);
|
||||||
|
User sender = getUser(senderName);
|
||||||
|
|
||||||
|
if (group == null) throw new IllegalArgumentException("Gruppe existiert nicht: " + groupId);
|
||||||
|
if (sender == null) throw new IllegalArgumentException("Sender existiert nicht: " + senderName);
|
||||||
|
|
||||||
|
group.addMessage(sender, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getGroupMessages(int groupId) {
|
||||||
|
GruppenRoom group = gruppenRooms.get(groupId);
|
||||||
|
if (group == null) {
|
||||||
|
throw new IllegalArgumentException("Gruppe existiert nicht: " + groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return group.showMessages();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getUserGruppenRooms(String userName) {
|
||||||
|
User user = getUser(userName);
|
||||||
|
if (user == null) {
|
||||||
|
throw new IllegalArgumentException("User existiert nicht: " + userName);
|
||||||
|
}
|
||||||
|
|
||||||
|
return user.getUserGruppenRoom().getGruppenRoomNames();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGruppenRoomInfo(int groupId) {
|
||||||
|
GruppenRoom room = gruppenRooms.get(groupId);
|
||||||
|
if (room == null) {
|
||||||
|
throw new IllegalArgumentException("Gruppenraum existiert nicht: " + groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return room.toString();
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue