1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.journal.search;
16  
17  import com.liferay.portal.kernel.dao.search.SearchContainer;
18  import com.liferay.portlet.journal.model.JournalFeed;
19  
20  import java.util.ArrayList;
21  import java.util.List;
22  
23  import javax.portlet.PortletRequest;
24  import javax.portlet.PortletURL;
25  
26  /**
27   * <a href="FeedSearch.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Raymond Augé
30   */
31  public class FeedSearch extends SearchContainer<JournalFeed> {
32  
33      static List<String> headerNames = new ArrayList<String>();
34  
35      static {
36          headerNames.add("id");
37          headerNames.add("description");
38      }
39  
40      public static final String EMPTY_RESULTS_MESSAGE = "no-feeds-were-found";
41  
42      public FeedSearch(PortletRequest portletRequest, PortletURL iteratorURL) {
43          super(
44              portletRequest, new FeedDisplayTerms(portletRequest),
45              new FeedSearchTerms(portletRequest), DEFAULT_CUR_PARAM,
46              DEFAULT_DELTA, iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
47  
48          FeedDisplayTerms displayTerms = (FeedDisplayTerms)getDisplayTerms();
49  
50          iteratorURL.setParameter(
51              FeedDisplayTerms.GROUP_ID,
52              String.valueOf(displayTerms.getGroupId()));
53          iteratorURL.setParameter(
54              FeedDisplayTerms.FEED_ID, displayTerms.getFeedId());
55          iteratorURL.setParameter(FeedDisplayTerms.NAME, displayTerms.getName());
56          iteratorURL.setParameter(
57              FeedDisplayTerms.DESCRIPTION, displayTerms.getDescription());
58      }
59  
60  }