public void removeUser(String username) { // TODO: handle if user doesn't exist! User removeUser = this.userStorage.remove(username); for (Mumble mumble : removeUser.getMumbles()) { this.mumbleStorage.remove(mumble.getId()); this.mumbleTimeline.remove(mumble); } }
public void removeMumble(String mumbleId) { // TODO: handle if mumble doesn't exist! Mumble removedMumble = this.mumbleStorage.remove(mumbleId); this.mumbleTimeline.remove(removedMumble); // remove the mumble from the User! User user = this.userStorage.get(removedMumble.getUsername()); user.getMumbles().remove(removedMumble); }
public Mumble newMumble(String username, String message) { User user = this.userStorage.get(username); // TODO: what if user doesn't exist? Mumble newMumble = new Mumble(username, message); user.addMumble(newMumble); this.mumbleStorage.put(newMumble.getId(), newMumble); this.mumbleTimeline.add(newMumble); return newMumble; }
public void updateUser(User user) { // TODO: handle if user doesn't exist! this.userStorage.put(user.getUsername(), user); }
public void addUser(User user) { // TODO: what if we already have that username? this.userStorage.put(user.getUsername(), user); }