// Path: src/main/java/org/podcastpedia/web/categories/CategoryService.java
// public interface CategoryService {
// 
// 	/**
// 	 * Returns a list with the categories that have podcasts belong to that
// 	 * category and orders the result by number of podcasts descending
// 	 * 
// 	 * @return
// 	 */
// 	public List<Category> getCategoriesOrderedByNoOfPodcasts();
// 	
// }


import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.podcastpedia.common.controllers.propertyeditors.MediaTypeEditor;
import org.podcastpedia.common.domain.Category;
import org.podcastpedia.common.types.LanguageCode;
import org.podcastpedia.common.types.MediaType;
import org.podcastpedia.common.types.OrderByOption;
import org.podcastpedia.common.types.SearchModeType;
import org.podcastpedia.web.categories.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
package org.podcastpedia.web.searching;




/**
 * Annotation-driven controller that handles searching for podcasts.
 * 
 * "advancedSearchData" is an object passed along the session to navigate from
 * search bar to advanced search results and from one page result to the other.
 * 
 * @author Ama
 * 
 */
@Controller
@RequestMapping("/search")
public class SearchController {

	protected static Logger LOG = Logger.getLogger(SearchController.class);

	@Autowired
	private SearchService searchService;

	@Autowired
	private CategoryService categoryService;

	/**
	 * If the users decides to write "http://localhost:8080/search/" into the
	 * browser she should get redirected to the advanced search formular
	 * 
	 * @return
	 */
	@RequestMapping(method = RequestMethod.GET)
// Path: src/main/java/org/podcastpedia/web/categories/CategoryService.java
// public interface CategoryService {
// 
// 	/**
// 	 * Returns a list with the categories that have podcasts belong to that
// 	 * category and orders the result by number of podcasts descending
// 	 * 
// 	 * @return
// 	 */
// 	public List<Category> getCategoriesOrderedByNoOfPodcasts();
// 	
// }


// Path: src/main/java/org/podcastpedia/web/searching/SearchController.java
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.log4j.Logger;
import org.podcastpedia.common.controllers.propertyeditors.MediaTypeEditor;
import org.podcastpedia.common.domain.Category;
import org.podcastpedia.common.types.LanguageCode;
import org.podcastpedia.common.types.MediaType;
import org.podcastpedia.common.types.OrderByOption;
import org.podcastpedia.common.types.SearchModeType;
import org.podcastpedia.web.categories.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.StringTrimmerEditor;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

package org.podcastpedia.web.searching;




/**
 * Annotation-driven controller that handles searching for podcasts.
 * 
 * "advancedSearchData" is an object passed along the session to navigate from
 * search bar to advanced search results and from one page result to the other.
 * 
 * @author Ama
 * 
 */
@Controller
@RequestMapping("/search")
public class SearchController {

	protected static Logger LOG = Logger.getLogger(SearchController.class);

	@Autowired
	private SearchService searchService;

	@Autowired
	private CategoryService categoryService;

	/**
	 * If the users decides to write "http://localhost:8080/search/" into the
	 * browser she should get redirected to the advanced search formular
	 * 
	 * @return
	 */
	@RequestMapping(method = RequestMethod.GET)
	public String redirectToAdvancedSearch() {