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.journalcontentsearch.action;
16  
17  import com.liferay.portal.model.LayoutTypePortlet;
18  import com.liferay.portal.struts.PortletAction;
19  import com.liferay.portal.theme.ThemeDisplay;
20  import com.liferay.portal.util.PortalUtil;
21  import com.liferay.portal.util.WebKeys;
22  
23  import javax.portlet.PortletConfig;
24  import javax.portlet.RenderRequest;
25  import javax.portlet.RenderResponse;
26  
27  import org.apache.struts.action.ActionForm;
28  import org.apache.struts.action.ActionForward;
29  import org.apache.struts.action.ActionMapping;
30  
31  /**
32   * <a href="SearchAction.java.html"><b><i>View Source</i></b></a>
33   *
34   * @author Alexander Chow
35   */
36  public class SearchAction extends PortletAction {
37  
38      public ActionForward render(
39              ActionMapping mapping, ActionForm form, PortletConfig portletConfig,
40              RenderRequest renderRequest, RenderResponse renderResponse)
41          throws Exception {
42  
43          ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest.getAttribute(
44              WebKeys.THEME_DISPLAY);
45  
46          LayoutTypePortlet layoutTypePortlet =
47              themeDisplay.getLayoutTypePortlet();
48  
49          String portletId = PortalUtil.getPortletId(renderRequest);
50  
51          if (!layoutTypePortlet.hasPortletId(portletId)) {
52              renderResponse.setTitle(themeDisplay.translate("search"));
53          }
54  
55          return mapping.findForward("portlet.journal_content_search.search");
56      }
57  
58  }