001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.dynamicdatalists.search;
016    
017    import com.liferay.portal.kernel.dao.search.SearchContainer;
018    import com.liferay.portlet.dynamicdatalists.model.DDLRecordSet;
019    
020    import java.util.ArrayList;
021    import java.util.List;
022    
023    import javax.portlet.PortletRequest;
024    import javax.portlet.PortletURL;
025    
026    /**
027     * @author Marcellus Tavares
028     */
029    public class RecordSetSearch extends SearchContainer<DDLRecordSet> {
030    
031            static List<String> headerNames = new ArrayList<String>();
032    
033            static {
034                    headerNames.add("id");
035                    headerNames.add("name");
036                    headerNames.add("description");
037                    headerNames.add("modified-date");
038            }
039    
040            public static final String EMPTY_RESULTS_MESSAGE = "no-entries-were-found";
041    
042            public RecordSetSearch(
043                    PortletRequest portletRequest, PortletURL iteratorURL) {
044    
045                    super(
046                            portletRequest, new RecordSetDisplayTerms(portletRequest),
047                            new RecordSetSearchTerms(portletRequest), DEFAULT_CUR_PARAM,
048                            DEFAULT_DELTA, iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
049    
050                    RecordSetDisplayTerms displayTerms =
051                            (RecordSetDisplayTerms)getDisplayTerms();
052    
053                    iteratorURL.setParameter(
054                            RecordSetDisplayTerms.DESCRIPTION, displayTerms.getDescription());
055                    iteratorURL.setParameter(
056                            RecordSetDisplayTerms.NAME, String.valueOf(displayTerms.getName()));
057            }
058    
059    }