org.opencms.frontend.templateone
Class CmsTemplateSearch

java.lang.Object
  extended by org.opencms.jsp.CmsJspBean
      extended by org.opencms.jsp.CmsJspActionElement
          extended by org.opencms.frontend.templateone.CmsTemplateBase
              extended by org.opencms.frontend.templateone.CmsTemplateBean
                  extended by org.opencms.frontend.templateone.CmsTemplateSearch

public class CmsTemplateSearch
extends CmsTemplateBean

Provides methods for the search result JSP page.

Since:
6.0.0

Field Summary
static java.lang.String PARAM_SEARCHALL
          Request parameter name for the search entire website flag.
 
Fields inherited from class org.opencms.frontend.templateone.CmsTemplateBean
FILE_CONFIG_COMMON, FILE_CSS, FILE_CSS_ACCESSIBLE, FILE_LINKS_HEAD, FOLDER_ELEMENTS, MESSAGE_BUNDLE, MODULE_NAME, PARAM_ACCESSIBLE, PARAM_COMMON, PARAM_HELPURI, PARAM_LAYOUT, PARAM_LOGINURI, PARAM_PART, PARAM_PRINT, PARAM_SITE, PARAM_URI, PROPERTY_CONFIGPATH, PROPERTY_EXTENSIONMODULE, PROPERTY_HEAD_DEFAULTLINK, PROPERTY_HEAD_ELEMENTURI, PROPERTY_HEAD_IMGHEIGHT, PROPERTY_HEAD_IMGLINK, PROPERTY_HEAD_IMGURI, PROPERTY_LAYOUT_CENTER, PROPERTY_LAYOUT_RIGHT, PROPERTY_NAVLEFT_ELEMENTURI, PROPERTY_RESOURCEPATH, PROPERTY_SHOW_HEADNAV, PROPERTY_SHOW_NAVLEFT, PROPERTY_SHOWHEADIMAGE, PROPERTY_SHOWHEADLINKS, PROPERTY_SIDE_URI, PROPERTY_STARTFOLDER, PROPERTY_VALUE_NONE, RESOURCE_TYPE_MICROSITE_NAME
 
Fields inherited from class org.opencms.frontend.templateone.CmsTemplateBase
ATTRIBUTE_ORIGINAL_URI
 
Fields inherited from class org.opencms.jsp.CmsJspActionElement
NOT_INITIALIZED
 
Constructor Summary
CmsTemplateSearch()
          Empty constructor, required for every JavaBean.
CmsTemplateSearch(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Constructor, with parameters.
 
Method Summary
 java.lang.String buildSearchErrorMessages(org.opencms.search.CmsSearch search, java.util.List results)
          Builds the html to display error messages on the search result page.
 java.lang.String buildSearchHeadline()
          Builds the html for the search result page headline.
 java.lang.String buildSearchLinks(org.opencms.search.CmsSearch search)
          Builds the html for the links to previous and next search result pages.
 java.lang.String buildSearchResultList(java.util.List results)
          Builds the html for the search result list for a single page.
 java.lang.String getFileIcon(java.lang.String fileName)
          Returns the HTML of the file icon for the given resource name or an empty String if no icon can be found.
 java.lang.String getPageUri()
          Returns the URI of the page calling the search result page.
 java.lang.String getSearchAllChecked()
          Returns the "checked" attribute String if the user checked the "search all" checkbox.
 java.util.List getSearchResults(org.opencms.search.CmsSearch search)
          Returns the list of search results depending on the search root and the form data.
 void includeWithPageUri(java.lang.String element)
          Includes the specified template element with the page URI specified in the request parameter "uri".
 void init(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Initialize this bean with the current page context, request and response.
 boolean isSearchAll()
          Returns true if the entire website should be searched.
 boolean isSearchAllDisplayed()
          Returns true if the checkbox to search the entire website should be displayed.
 void setSearchAll(boolean searchAll)
          Sets if the entire website should be searched.
 
Methods inherited from class org.opencms.frontend.templateone.CmsTemplateBean
buildHtmlBodyEnd, getAreaName, getConfigPath, getConfiguration, getConfigurationFile, getConfigurationValue, getConfigurationValue, getDescription, getEncoding, getExtensionModuleFileUri, getHeadElementUri, getHeadLinks, getKeywords, getLayout, getLeftNavigationElementUri, getNavigationStartFolder, getProperties, getResourcePath, getSearchIndexName, getStartFolder, getStyleSheetConfigUri, getStyleSheetUri, getStyleSheetUri, getTemplateParts, getTitle, includeElements, includePopup, includeRightLists, key, keyDefault, messages, messages, putNavigationProperties, setLayout, showAccessibleVersion, showHeadImage, showHeadLinks, showHeadNavigation, showLeftNavigation, showPrintVersion
 
Methods inherited from class org.opencms.frontend.templateone.CmsTemplateBase
getOriginalUri, initUri, isUriChanged
 
Methods inherited from class org.opencms.jsp.CmsJspActionElement
editable, editable, editable, editableManualClose, editableManualOpen, getContent, getContent, getMessages, getMessages, getMessages, getMessages, getNavigation, getNavigationUri, img, img, include, include, include, include, include, include, includeSilent, includeSilent, includeSilent, includeSilent, info, label, link, link, properties, properties, property, property, property, property, template, template, template, toAbsolute, user
 
Methods inherited from class org.opencms.jsp.CmsJspBean
getCmsObject, getController, getJspContext, getMessage, getRequest, getRequestContext, getResponse, handleException, isNotInitialized, isSupressingExceptions, setContentType, setStatus, setSupressingExceptions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAM_SEARCHALL

public static final java.lang.String PARAM_SEARCHALL
Request parameter name for the search entire website flag.

See Also:
Constant Field Values
Constructor Detail

CmsTemplateSearch

public CmsTemplateSearch()
Empty constructor, required for every JavaBean.


CmsTemplateSearch

public CmsTemplateSearch(javax.servlet.jsp.PageContext context,
                         javax.servlet.http.HttpServletRequest req,
                         javax.servlet.http.HttpServletResponse res)
Constructor, with parameters.

Use this constructor for the template.

Parameters:
context - the JSP page context object
req - the JSP request
res - the JSP response
Method Detail

buildSearchErrorMessages

public java.lang.String buildSearchErrorMessages(org.opencms.search.CmsSearch search,
                                                 java.util.List results)
Builds the html to display error messages on the search result page.

If no error occurs, an empty String will be returned.

Parameters:
search - the search result object holding all necessary information
results - the list of result objects to display
Returns:
the html to display error messages

buildSearchHeadline

public java.lang.String buildSearchHeadline()
Builds the html for the search result page headline.

Returns:
the html for the search result page headline

buildSearchLinks

public java.lang.String buildSearchLinks(org.opencms.search.CmsSearch search)
Builds the html for the links to previous and next search result pages.

Parameters:
search - the search result object holding all necessary information
Returns:
the html for the links to previous and next search result pages

buildSearchResultList

public java.lang.String buildSearchResultList(java.util.List results)
Builds the html for the search result list for a single page.

Parameters:
results - the list of result objects to display
Returns:
the html for the search result list

getFileIcon

public java.lang.String getFileIcon(java.lang.String fileName)
Returns the HTML of the file icon for the given resource name or an empty String if no icon can be found.

Parameters:
fileName - the filename to check
Returns:
the HTML of the file icon for the given resource name or an empty String

getPageUri

public java.lang.String getPageUri()
Returns the URI of the page calling the search result page.

Returns:
the URI of the page calling the search result page

getSearchAllChecked

public java.lang.String getSearchAllChecked()
Returns the "checked" attribute String if the user checked the "search all" checkbox.

Returns:
the "checked" attribute String or an empty String

getSearchResults

public java.util.List getSearchResults(org.opencms.search.CmsSearch search)
Returns the list of search results depending on the search root and the form data.

Either returns the results of the entire website or of the search root.

Parameters:
search - the instanciated search object
Returns:
the results of the entire website or of the search root

includeWithPageUri

public void includeWithPageUri(java.lang.String element)
                        throws javax.servlet.jsp.JspException
Includes the specified template element with the page URI specified in the request parameter "uri".

After inclusion, the request context URI is reset to the old value.

Parameters:
element - the element (template selector) to display from the target template
Throws:
javax.servlet.jsp.JspException - if including the target fails

init

public void init(javax.servlet.jsp.PageContext context,
                 javax.servlet.http.HttpServletRequest req,
                 javax.servlet.http.HttpServletResponse res)
Initialize this bean with the current page context, request and response.

It is required to call one of the init() methods before you can use the instance of this bean.

Overrides:
init in class CmsTemplateBean
Parameters:
context - the JSP page context object
req - the JSP request
res - the JSP response

isSearchAll

public boolean isSearchAll()
Returns true if the entire website should be searched.

Returns:
true if the entire website should be searched, otherwise false

isSearchAllDisplayed

public boolean isSearchAllDisplayed()
Returns true if the checkbox to search the entire website should be displayed.

Returns:
true if the checkbox to search the entire website should be displayed, otherwise false

setSearchAll

public void setSearchAll(boolean searchAll)
Sets if the entire website should be searched.

Parameters:
searchAll - true if the entire website should be searched, otherwise false