001
014
015 package com.liferay.portlet.shopping.search;
016
017 import com.liferay.portal.kernel.dao.search.SearchContainer;
018 import com.liferay.portlet.shopping.model.ShoppingCoupon;
019
020 import java.util.ArrayList;
021 import java.util.List;
022
023 import javax.portlet.PortletRequest;
024 import javax.portlet.PortletURL;
025
026
029 public class CouponSearch extends SearchContainer<ShoppingCoupon> {
030
031 static List<String> headerNames = new ArrayList<String>();
032
033 static {
034 headerNames.add("code");
035 headerNames.add("description");
036 headerNames.add("start-date");
037 headerNames.add("expiration-date");
038 headerNames.add("discount-type");
039 }
040
041 public static final String EMPTY_RESULTS_MESSAGE = "no-coupons-were-found";
042
043 public CouponSearch(PortletRequest portletRequest, PortletURL iteratorURL) {
044 super(
045 portletRequest, new CouponDisplayTerms(portletRequest),
046 new CouponSearchTerms(portletRequest), DEFAULT_CUR_PARAM,
047 DEFAULT_DELTA, iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
048
049 CouponDisplayTerms displayTerms = (CouponDisplayTerms)getDisplayTerms();
050
051 iteratorURL.setParameter(
052 CouponDisplayTerms.ACTIVE, String.valueOf(displayTerms.isActive()));
053 iteratorURL.setParameter(
054 CouponDisplayTerms.CODE, displayTerms.getCode());
055 iteratorURL.setParameter(
056 CouponDisplayTerms.DISCOUNT_TYPE, displayTerms.getDiscountType());
057 }
058
059 }