private void reload() { UltimateFestivalOrganizerSoap ufo = UFOService.getInstance(); venues = ufo.getAllVenues().getVenue(); artists = ufo.getAllButDeletedArtists().getArtist(); // Performances performances.clear(); if (performancesSessionBean.getSelectedDate() == null) { return; } // fill with new for (Venue v : venues) { performances.put(v.getId(), new HashMap<>()); for (int hour = 14; hour <= 23; ++hour) { Performance p = new Performance(); p.setVenue(v); Calendar c = new GregorianCalendar(); c.setTime(performancesSessionBean.getSelectedDate()); c.add(Calendar.HOUR_OF_DAY, hour); p.setDateTime(dateToGregorian(c.getTime())); Artist a = new Artist(); a.setId(0); p.setArtist(a); performances.get(v.getId()).put(hour, p); } } // fill with existing List<Performance> allPerformances = ufo.getPerformancesByDate(dateToGregorian(performancesSessionBean.getSelectedDate())) .getPerformance(); for (Performance p : allPerformances) { int venueId = p.getVenue().getId(); int hour = p.getDateTime().getHour(); performances.get(venueId).put(hour, p); } }
public String getSelectedDate() { return (performancesSessionBean.getSelectedDate() == null) ? "" : format.format(performancesSessionBean.getSelectedDate()); }