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.assetpublisher.search;
16  
17  import com.liferay.portal.kernel.dao.search.SearchContainer;
18  import com.liferay.portlet.asset.model.AssetEntry;
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="AssetSearch.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   * @author Julio Camarero
31   */
32  public class AssetSearch extends SearchContainer<AssetEntry> {
33  
34      static List<String> headerNames = new ArrayList<String>();
35  
36      static {
37          headerNames.add("title");
38          headerNames.add("description");
39          headerNames.add("user-name");
40          headerNames.add("modified-date");
41      }
42  
43      public static final String EMPTY_RESULTS_MESSAGE =
44          "there-are-no-results";
45  
46      public AssetSearch(
47          PortletRequest portletRequest, int delta, PortletURL iteratorURL) {
48  
49          super(
50              portletRequest, new AssetDisplayTerms(portletRequest),
51              new AssetSearchTerms(portletRequest), DEFAULT_CUR_PARAM, delta,
52              iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
53  
54          AssetDisplayTerms displayTerms =
55              (AssetDisplayTerms)getDisplayTerms();
56  
57          iteratorURL.setParameter(
58              AssetDisplayTerms.DESCRIPTION, displayTerms.getDescription());
59          iteratorURL.setParameter(
60              AssetDisplayTerms.GROUP_ID,
61              String.valueOf(displayTerms.getGroupId()));
62          iteratorURL.setParameter(
63              AssetDisplayTerms.TITLE, displayTerms.getTitle());
64          iteratorURL.setParameter(
65              AssetDisplayTerms.USER_NAME, displayTerms.getUserName());
66      }
67  
68      public AssetSearch(
69          PortletRequest portletRequest, PortletURL iteratorURL) {
70  
71          this(portletRequest, DEFAULT_DELTA, iteratorURL);
72      }
73  
74  }