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.shopping.search;
16  
17  import com.liferay.portal.kernel.dao.search.SearchContainer;
18  import com.liferay.portlet.shopping.model.ShoppingOrder;
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="OrderSearch.java.html"><b><i>View Source</i></b></a>
28   *
29   * @author Brian Wing Shun Chan
30   */
31  public class OrderSearch extends SearchContainer<ShoppingOrder> {
32  
33      static List<String> headerNames = new ArrayList<String>();
34  
35      static {
36          headerNames.add("number");
37          headerNames.add("date");
38          headerNames.add("status");
39          headerNames.add("customer");
40      }
41  
42      public static final String EMPTY_RESULTS_MESSAGE =
43          "no-orders-were-found";
44  
45      public OrderSearch(PortletRequest portletRequest, PortletURL iteratorURL) {
46          super(
47              portletRequest, new OrderDisplayTerms(portletRequest),
48              new OrderSearchTerms(portletRequest), DEFAULT_CUR_PARAM,
49              DEFAULT_DELTA, iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
50  
51          OrderDisplayTerms displayTerms =
52              (OrderDisplayTerms)getDisplayTerms();
53  
54          iteratorURL.setParameter(
55              OrderDisplayTerms.NUMBER, displayTerms.getNumber());
56          iteratorURL.setParameter(
57              OrderDisplayTerms.STATUS, displayTerms.getStatus());
58          iteratorURL.setParameter(
59              OrderDisplayTerms.FIRST_NAME, displayTerms.getFirstName());
60          iteratorURL.setParameter(
61              OrderDisplayTerms.LAST_NAME, displayTerms.getLastName());
62          iteratorURL.setParameter(
63              OrderDisplayTerms.EMAIL_ADDRESS, displayTerms.getEmailAddress());
64      }
65  
66  }