/**
 * 
 */
package org.richfaces.realworld.search;

import java.util.List;

import org.richfaces.realworld.domain.Image;
import org.richfaces.realworld.service.ISearchAction;

/**
 * @author Andrey Markavtsov
 *
 */
public class SearchOptionByUser extends ISearchOption {

	/* (non-Javadoc)
	 * @see org.richfaces.realworld.search.ISearchOption#getName()
	 */
	@Override
	public String getName() {
		return "Users";
	}

	/* (non-Javadoc)
	 * @see org.richfaces.realworld.search.ISearchOption#getSearchResultName()
	 */
	@Override
	public String getSearchResultName() {
		return "Users search result";
	}

	/* (non-Javadoc)
	 * @see org.richfaces.realworld.search.ISearchOption#getSearchResultTemplate()
	 */
	@Override
	public String getSearchResultTemplate() {
		return "/includes/search/result/userResult.xhtml";
	}

	/* (non-Javadoc)
	 * @see org.richfaces.realworld.search.ISearchOption#getTemplate()
	 */
	@Override
	public String getTemplate() {
		return null;
	}

	/* (non-Javadoc)
	 * @see org.richfaces.realworld.search.ISearchOption#search(org.richfaces.realworld.service.ISearchAction)
	 */
	@Override
	public void search(ISearchAction action, String q, boolean searchInMyAlbums, boolean searchInShared) {
		List<Image> searchByUsers = action.searchByUsers(q, searchInMyAlbums, searchInShared);
		setSearchResult(searchByUsers);

	}

}
