@Override protected void processSecure() throws GamedayException { if (RequestUtils.isSubmit(request, "commit")) { Team team = TeamFormBean.parse(request); team.setId(id); getLogic().update(team); request.getSession().removeAttribute("club"); request.getSession().removeAttribute(ClubTeamsCommand.DATA_TYPE); sendRedirect("/Exec.do?command=ClubTeams&club_id=" + club.getId().toString()); } else { List<Team> teams = getSessionData(ClubTeamsCommand.DATA_TYPE); TeamLogic logic = getLogic(); if (!logic.processList(id, teams)) { throw new TeamNotFoundException(id); } Team team = logic.getCurrent(); request.setAttribute("team", team); request.setAttribute("teamLeagues", getLeagues(team)); request.setAttribute("prevTeam", logic.getPrevious()); request.setAttribute("nextTeam", logic.getNext()); request.setAttribute("teamTypes", getTypes()); request.setAttribute(PersonsCommand.DATA_TYPE, PersonLogic.getPersons()); request.setAttribute(SeasonsCommand.DATA_TYPE, SeasonLogic.getSeasons()); List<Venue> venues = VenueLogic.getVenues(); venues = new VenueTownSorter().sort(venues); request.setAttribute(VenuesCommand.DATA_TYPE, venues); command.forward(ClubTeamsCommand.CLUB_TEAM_EDIT_JSP); } }
public Collection<TeamContact> getTeamContacts() { Collection<TeamContact> contacts = new ArrayList<TeamContact>(); List<Team> teams = getTeams(getCurrent()); for (Team team : teams) { contacts.addAll(team.getContacts()); } return contacts; }