writer.writeAttribute(ComponentConstants.ID_ATTRIBUTE, youTubeVideoList.getClientId(context),
ComponentConstants.ID_ATTRIBUTE);
// get the component attributes.
List<ServiceParameter> parameters = new ArrayList<ServiceParameter>();
YouTubeSearchService youTubeSearchService = YouTubeServicesFactory.getYouTubeSearchService();
parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.VERSION, "2"));
parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.MAX_RESULTS, youTubeVideoList.getMaxResults().toString()));
parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.QUERY, youTubeVideoList.getSearchQuery()));
if (youTubeVideoList.getCategory() != null) {
parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.CATEGORY, youTubeVideoList.getCategory()));
}
if (youTubeVideoList.getLocation() != null) {
parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.LOCATION, youTubeVideoList.getLocation()));
}
if (youTubeVideoList.getLocationRadius() != null) {
parameters.add(new ServiceParameter(YouTubeSearchServiceParameters.LOCATION_RADIUS, youTubeVideoList.getLocationRadius()));
}
// perform the actual video search on youTube.
List<YouTubeSearchResultItem> videoResults = youTubeSearchService.getVideoList(parameters);
// encode results .
UIComponent itemFacet = youTubeVideoList.getFacet(YOUTUBE_RESULT_ITEM);
if (itemFacet == null) {