1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
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.JournalStructure;
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="StructureSearch.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class StructureSearch extends SearchContainer<JournalStructure> {
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 =
41          "no-structures-were-found";
42  
43      public StructureSearch(
44          PortletRequest portletRequest, int delta, PortletURL iteratorURL) {
45  
46          super(
47              portletRequest, new StructureDisplayTerms(portletRequest),
48              new StructureSearchTerms(portletRequest), DEFAULT_CUR_PARAM, delta,
49              iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
50  
51          StructureDisplayTerms displayTerms =
52              (StructureDisplayTerms)getDisplayTerms();
53  
54          iteratorURL.setParameter(
55              StructureDisplayTerms.GROUP_ID,
56              String.valueOf(displayTerms.getGroupId()));
57          iteratorURL.setParameter(
58              StructureDisplayTerms.STRUCTURE_ID, displayTerms.getStructureId());
59          iteratorURL.setParameter(
60              StructureDisplayTerms.NAME, displayTerms.getName());
61          iteratorURL.setParameter(
62              StructureDisplayTerms.DESCRIPTION, displayTerms.getDescription());
63      }
64  
65      public StructureSearch(
66          PortletRequest portletRequest, PortletURL iteratorURL) {
67  
68          this(portletRequest, DEFAULT_DELTA, iteratorURL);
69      }
70  
71  }