001
014
015 package com.liferay.portlet.journal.search;
016
017 import com.liferay.portal.kernel.dao.search.SearchContainer;
018 import com.liferay.portal.kernel.util.StringUtil;
019 import com.liferay.portlet.journal.model.JournalTemplate;
020
021 import java.util.ArrayList;
022 import java.util.List;
023
024 import javax.portlet.PortletRequest;
025 import javax.portlet.PortletURL;
026
027
030 public class TemplateSearch extends SearchContainer<JournalTemplate> {
031
032 static List<String> headerNames = new ArrayList<String>();
033
034 static {
035 headerNames.add("id");
036 headerNames.add("name");
037 headerNames.add("description");
038 }
039
040 public static final String EMPTY_RESULTS_MESSAGE =
041 "no-templates-were-found";
042
043 public TemplateSearch(
044 PortletRequest portletRequest, int delta, PortletURL iteratorURL) {
045
046 super(
047 portletRequest, new TemplateDisplayTerms(portletRequest),
048 new TemplateSearchTerms(portletRequest), DEFAULT_CUR_PARAM, delta,
049 iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
050
051 TemplateDisplayTerms displayTerms =
052 (TemplateDisplayTerms)getDisplayTerms();
053
054 iteratorURL.setParameter(
055 TemplateDisplayTerms.DESCRIPTION, displayTerms.getDescription());
056 iteratorURL.setParameter(
057 TemplateDisplayTerms.GROUP_IDS,
058 StringUtil.merge(displayTerms.getGroupIds()));
059 iteratorURL.setParameter(
060 TemplateDisplayTerms.NAME, displayTerms.getName());
061 iteratorURL.setParameter(
062 TemplateDisplayTerms.STRUCTURE_ID, displayTerms.getStructureId());
063 iteratorURL.setParameter(
064 TemplateDisplayTerms.TEMPLATE_ID, displayTerms.getTemplateId());
065 }
066
067 public TemplateSearch(
068 PortletRequest portletRequest, PortletURL iteratorURL) {
069
070 this(portletRequest, DEFAULT_DELTA, iteratorURL);
071 }
072
073 }