Code example for ModelAndView

Methods: addAllObjectsaddObjectsetViewsetViewName

0
        		map.put("url", "http://www.last.fm/group/" + group); 
        	} 
        }  
         
        ModelAndView result = super.handleRequestInternal(request, response); 
        result.addObject("model", map); 
        return result; 
    } 
     
    private void setArtists(HttpServletRequest request, String genre, String group, int page, Map<String, Object> map) throws UnsupportedEncodingException { 
        User user = securityService.getCurrentUser(request); 
        UserSettings userSettings = settingsService.getUserSettings(user.getUsername()); 
        boolean albumArtists = userSettings.isOnlyAlbumArtistRecommendations(); 
 
        final int ARTISTS = userSettings.getDefaultHomeArtists(); 
		List<ArtistRecommendation> ars = square(genre != null ? 
				recService.getGenreArtistsInLibrary(genre, page * ARTISTS, ARTISTS + 1, albumArtists) : 
				recService.getGroupArtistsInLibrary(group, page * ARTISTS, ARTISTS + 1, albumArtists)); 
		if (page == 0) { 
			map.put("artistsNotInLibrary", getRecommendedArtists( 
					genre, group, userSettings.getRecommendedArtists(), albumArtists)); 
		} 
		if (ars.size() > ARTISTS) { 
			map.put("morePages", true); 
			ars.remove(ARTISTS); 
		} 
 
		map.put("page", page); 
		map.put("artists", ars); 
		map.put("artistGridWidth", userSettings.getArtistGridWidth()); 
    } 
     
    private List<ArtistLink> getRecommendedArtists(String genre, String group, int amount, boolean onlyAlbumArtists) throws UnsupportedEncodingException { 
    	List<String> namesNotInLibrary = genre != null ? 
    			recService.getGenreArtistsNotInLibrary(genre, amount, onlyAlbumArtists) : 
    			recService.getGroupArtistsNotInLibrary(group, amount, onlyAlbumArtists); 
 
    	List<ArtistLink> artistsNotInLibrary = new ArrayList<>(); 
    	for (String name : namesNotInLibrary) { 
    		artistsNotInLibrary.add(new ArtistLink(name, encode(name, ENCODING_UTF8))); 
    	} 
    	 
    	return artistsNotInLibrary; 
    } 
     
    // Spring setters 
 
	public void setTagService(TagService tagService) { 
		this.tagService = tagService; 
	} 
 
	public void setSettingsService(SettingsService settingsService) { 
		this.settingsService = settingsService; 
	} 
 
	public void setSecurityService(SecurityService securityService) { 
		this.securityService = securityService; 
	} 
 
	public void setTagInfoService(TagInfoService tagInfoService) { 
		this.tagInfoService = tagInfoService; 
	} 
	 
	public void setLastFmService(LastFmService lastFmService) { 
		this.lastFmService = lastFmService; 
	} 
 
	public void setArtistRecommendationService(ArtistRecommendationService recService) { 
		this.recService = recService; 
	} 
 
	public void setLibraryBrowserService(LibraryBrowserService libraryBrowserService) { 
		this.libraryBrowserService = libraryBrowserService; 
	} 
 
} 
Experience pair programming with AI  Get Codota for Java