@Override public void execute() { clearLocalCache(); session = VeggieDinner.getSession(); if (session == null || session.getUser() == null) return; me = VeggieDinner.getUser(session.getUser()); if (me == null) { VeggieDinner.requestNewUser(session.getUser(), populateLocalCache); return; } boolean hasAll = true; myGroupDTOs.addAll(VeggieDinner.getGroups(me.getGroups()).values()); myEventDTOs.addAll(VeggieDinner.getEvents(me.getSchedule()).values()); myEventDTOs.addAll(VeggieDinner.getEvents(getEventsFromGroups(myGroupDTOs)).values()); myCohosts.addAll(VeggieDinner.getUsers(getHostsFromGroups(myGroupDTOs)).values()); if (!myGroupDTOs.containsAll(me.getGroups())) { VeggieDinner.requestNewGroup(me.getGroups(), populateLocalCache); return; } if (!myEventDTOs.containsAll(me.getSchedule()) || !myEventDTOs.containsAll(getEventsFromGroups(myGroupDTOs))) { HashSet<Key<EventDTO>> events = getEventsFromGroups(myGroupDTOs); events.addAll(me.getSchedule()); VeggieDinner.requestNewEvent(events, populateLocalCache); return; } if (!myCohosts.containsAll(getHostsFromGroups(myGroupDTOs))) { VeggieDinner.requestNewUser(getHostsFromGroups(myGroupDTOs), populateLocalCache); return; } DeferredCommand.addCommand(updateMyStuff); }
@Override public void execute() { HashMap<Key<GroupDTO>, GroupDTO> invites = VeggieDinner.getGroups(me.getGroups()); myInvites = new MenuBar(true); myStuff.addItem("My Invites", myInvites); for (GroupDTO g : invites.values()) { final GroupDTO finalGroup = g; String hostsString = "Me"; for (UserDTO u : VeggieDinner.getUsers(g.getHosts()).values()) if (!u.getKey().equals(me.getKey())) hostsString += ", " + u.getUserName(); myInvites.addItem( hostsString, new Command() { @Override public void execute() { VeggieDinner.showGroup(finalGroup.getKey()); } }); } }