com.jalios.jcms.handler
Class QueryHandler

java.lang.Object
  extended by com.jalios.jcms.context.JcmsContext
      extended by com.jalios.jcms.context.JcmsJspContext
          extended by com.jalios.jcms.handler.JcmsFormHandler
              extended by com.jalios.jcms.handler.AbstractQueryHandler<Publication>
                  extended by com.jalios.jcms.handler.QueryHandler
All Implemented Interfaces:
JcmsConstants, JaliosConstants

public class QueryHandler
extends AbstractQueryHandler<Publication>

Holder class and form handler of all parameters to be used for a query.

There is two main use cases :

If you need to perform a custom query in a jsp, use the jsp tag <jalios:query ... /> which delegates to this class and performs all the processing needed.

Version:
$Revision: 49380 $
Author:
Olivier Dedieu , Olivier Jaquemet

Nested Class Summary
 
Nested classes/interfaces inherited from class com.jalios.jcms.handler.AbstractQueryHandler
AbstractQueryHandler.HiddenParamQhPrinter, AbstractQueryHandler.QueryHandlerPrinter, AbstractQueryHandler.QueryStringQhPrinter
 
Field Summary
static String REVISION
           
static String TEXT_MODE_ADVANCED
          The mode value to use to perform a text search with advanced search syntax (wildcard, field, etc).
Value : "advanced".
static String TEXT_MODE_ALL_WORDS
          The mode value to use to perform a text search matching all the words of the search string.
Value : "all".
static String TEXT_MODE_ANY_WORD
          The mode value to use to perform a text search matching at least one of the words of the search string.
Value : "any".
static String TEXT_MODE_EXACT
          The mode value to use to perform a text search matching the exact phrase specified in the search string.
Value : "exact".
 
Fields inherited from class com.jalios.jcms.handler.JcmsFormHandler
contextMap, editFieldSet, noRedirect, noSendRedirect, popupEdition, redirect, redirectOnClosePopup, workspaceForced
 
Fields inherited from class com.jalios.jcms.context.JcmsJspContext
AJAX_REQUEST_ATTRIBUTES, BODY_HEADER, CSS_HEADER, cssboMap, cssfoMap, CUSTOM_HEADER, editIcon, HTTPEQUIV_HEADER, httpequivMap, HTTPNAME_HEADER, httpnameMap, initEditIcon, JAVASCRIPT_CODE_SET_ATTRIBUTE, JAVASCRIPT_SET_ATTRIBUTE, jsboSet, jsfoSet, out, pageContext, SHOW_EDIT_ICON, STYLE_HEADER
 
Fields inherited from class com.jalios.jcms.context.JcmsContext
browser, caddy, channel, inFO, initDone, initWorkspace, isAdmin, isAjaxRequest, isDBMember, isDebug, isLogged, loggedMember, request, response, userCountry, userLang, userLocale, workspace
 
Fields inherited from interface com.jalios.jcms.JcmsConstants
ADATE_SEARCH, ADMIN_NOTES_PROP, ADVANCED_TAB, ARCHIVES_DIR, ASCII_WIDTH, CATEGORY_TAB, CDATE_SEARCH, COMMON_ALARM, CONTENT_TAB, COOKIE_MAX_AGE, CTRL_TOPIC_INTERNAL, CTRL_TOPIC_REF, CTRL_TOPIC_VALUE, CTRL_TOPIC_WRITE, CUSTOM_PROP, DOCCHOOSER_HEIGHT, DOCCHOOSER_WIDTH, DOCS_DIR, EDATE_SEARCH, EMAIL_REGEXP, ERROR_MSG, FORBIDDEN_FILE_ACCESS, FORBIDDEN_REDIRECT, FORCE_REDIRECT, ICON_ARCHIVE, ICON_LOCK, ICON_LOCK_STRONG, ICON_WARN, ICON_WH_BOOK_CLOSED, ICON_WH_BOOK_OPEN, INFORMATION_MSG, JALIOS_JUNIT_PROP, JCMS_CADDY, JCMS_MSG_LIST, JSYNC_DOWNLOAD_DIR, JSYNC_SYNC_ALARM, LOG_FILE, LOG_TOPIC_SECURITY, LOGGER_PROP, LOGGER_XMLPROP, MBR_PHOTO_DIR, MDATE_SEARCH, MONITOR_XML, OP_CREATE, OP_DEEP_COPY, OP_DEEP_DELETE, OP_DELETE, OP_MERGE, OP_UPDATE, PDATE_SEARCH, PHOTO_DIR, PHOTO_ICON, PHOTO_ICON_HEIGHT, PHOTO_ICON_WIDTH, PHOTO_LARGE, PHOTO_LARGE_HEIGHT, PHOTO_LARGE_WIDTH, PHOTO_NORMAL, PHOTO_NORMAL_HEIGHT, PHOTO_NORMAL_WIDTH, PHOTO_SMALL, PHOTO_SMALL_HEIGHT, PHOTO_SMALL_WIDTH, PHOTO_TINY, PHOTO_TINY_HEIGHT, PHOTO_TINY_WIDTH, PREVIOUS_TAB, PRINT_VIEW, PRIVATE_FILE_ACCESS, PUBLIC_FILE_ACCESS, READ_RIGHT_TAB, SDATE_SEARCH, SEARCHENGINE_ALARM, SESSION_AUTHORIZED_FILENAMES_SET, STATS_REPORT_DIR, STATUS_PROP, STORE_XML, TEMPLATE_TAB, THUMBNAIL_LARGE_HEIGHT, THUMBNAIL_LARGE_WIDTH, THUMBNAIL_SMALL_HEIGHT, THUMBNAIL_SMALL_WIDTH, UDATE_SEARCH, UPDATE_RIGHT_TAB, UPLOAD_DIR, URL_REGEXP, WARNING_MSG, WEBAPP_PROP, WFEXPRESS_ALARM, WFREMINDER_ALARM, WORKFLOW_TAB, WORKFLOW_XML
 
Fields inherited from interface com.jalios.util.JaliosConstants
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR
 
Constructor Summary
QueryHandler()
          Default constructor, builds a new QueryHandler with default value.
QueryHandler(QueryHandler original)
          Create a QueryHandler by copying all fields of the specified original QueryHandler, omitting all information linked to the current request.
QueryHandler(String queryString)
          Constructs a new QueryHandler by parsing the specified query string.
QueryHandler(String queryString, javax.servlet.http.HttpServletRequest request)
          Constructs a new QueryHandler by parsing the specified query string and using informations available from the specified request (logged member, user language, etc).
QueryHandler(String text, String mode, boolean catName, boolean exactCat, boolean searchInPub, boolean searchInFile, String[] cids, String[] cidsOff, String[] mids, String[] midsOff, String[] gids, String[] gidsOff, Date beginDate, int beginDay, int beginMonth, int beginYear, Date endDate, int endDay, int endMonth, int endYear, String dateType, int dateSince, String[] types, String[] typesOff, boolean exactType, String[] ratings, String[] pstatus, boolean checkPstatus, String[] langs, boolean replaceFileDoc)
          Constructs a new QueryHandler, settings all the specified values.
 
Method Summary
 void addHighlightAttributes(javax.servlet.http.HttpServletRequest request)
          Add highlight attributes to the given request.
 void clearHighlightAttributes(javax.servlet.http.HttpServletRequest request)
          Remove highlight attributes of the given request.
 String getAbility()
          Retrieves the current the portal element's ability defined for this QueryHandler.
 Set<String> getAllCidSet()
          Returns all the cids contained in this query and all historized queries.
 Date[] getBeginAndEndDates()
          Compute begin and end date of a query from QueryHandler values.
 Date getBeginDate()
           
 int getBeginDay()
           
 int getBeginMonth()
           
 int getBeginYear()
           
 Set<Category> getCategorySet(String inputName)
           
 String getCatMode()
           
 boolean getCatName()
           
 boolean getCheckPstatus()
           
 String[] getCids()
           
 String[] getCidsOff()
           
 HashSet<Class<? extends Publication>> getClassOffSet()
          Return a set of classes corresponding to the 'typesOff' attributes
 HashSet<Class<? extends Publication>> getClassSet()
          Return a set of classes corresponding to the 'types' attributes
static List<String> getContentTypesFromDocumentKind(String kind)
          Retrieve the content type to use for the specified document kind
 int getDateSinceInt()
           
 String getDateType()
           
 String getDescription()
          Returns a description of the query in the language defined by userLang of this handler.
 String getDescription(String lang)
          Returns a description of the query in the specified language.
 String[] getDocumentKinds()
          Retrieve the kind of document defined for this QueryHandler
static Map<String,String> getDocumentKindsGroupMap(String userLang)
          Retrieve a map of all document kind group defined in properties.
static Map<String,String> getDocumentKindsMap(String userLang, String kindGroup)
          Retrieve a map of all document kind for the specified kind group.
 Date getEndDate()
           
 int getEndDay()
           
 int getEndMonth()
           
 int getEndYear()
           
 boolean getExactCat()
           
 boolean getExactType()
           
 String[] getGids()
           
 String[] getGidsOff()
           
 Member getHighlightedMember()
           
 String getHist()
           
 int getHistLevel()
           
 List<String> getHistoryList()
          Not set : - before the query method has been called.
 int[] getIntPstatus()
          Retrieves the current pstatus values to be searched by this query.
 int[] getIntRatings()
          Retrieves the current rating values to be searched by this query.
 String[] getLangs()
          Retrieve the language in which publications must have been translated to be part of the results.
protected  org.apache.log4j.Logger getLogger()
           
 String[] getMids()
           
 String[] getMidsOff()
           
 String getMode()
          Retrieve the string representation of the current text mode being to perform the text search.
protected  String[] getMostRecentTextAndModeInHistory()
           
protected static void getMostRecentTextInHistoryVisitor(String[] textAndMode, QueryHandler qh)
          Internal recursive method used to look for most recent text.
 boolean getPagerAll()
           
 int getPageSize()
           
 String[] getPortalIds()
           
 String[] getPstatus()
          Retrieves the pstatus values to be searched by this query.
 String[] getRatings()
          Retrieves the current rating values to be searched by this query.
 Workspace getRefinedWorkspace()
          Get the Workspace for this request.
 boolean getReplaceFileDoc()
           
 Set<Workspace> getResolvedWorkspaceSet()
          Retrieve the Set of Workspace on which the query is refined.
This set is based on workspaceSet, which may be extended given the state of boolean searchInSubWorkspaces.
 QueryResultSet getResultSet()
          Return results of a query done using this QueryHandler.
 boolean getReverse()
           
 String[] getSearchedFields()
          Retrieves the lucene fields in which the text search is being performed for publications.
 boolean getSearchInDB()
           
 boolean getSearchInFiles()
           
 boolean getSearchInPub()
           
 boolean getSearchInSubWorkspaces()
           
 String getSort()
           
 int getStart()
           
 String getText()
          Retrieve the current text being searched in this query.
 boolean getTextSearch()
          Checks if this query is mainly a text search.
 String[] getTypes()
           
static Class<? extends Publication> getTypesCommonSuperClass(QueryHandler... queryHandlers)
          Retrieve the common super class of types specified in the QueryHandler.
 String[] getTypesOff()
           
 String[] getUnresolvedLangs()
           
 Set<Workspace> getWorkspaceSet()
          Retrieve the Set of Workspace on which the query was initially refined.
 boolean isExpanded(Category cat, String inputName)
           
 boolean isHybridSearch()
          Returns true if this is an hybrid search (i.e.
 boolean isModeAdvanced()
          Checks if the current text mode is to perform the search using advanced search syntaxt.
 boolean isModeAll()
          Checks if the current text mode is to find all words of the search string.
 boolean isModeAny()
          Checks if the current text mode is to find at least one word of the search string.
 boolean isModeExact()
          Checks if the current text mode is to find the exact phrase specified in the search string.
protected  void parseQueryStringParam(String key, String[] values)
          Method to be implemented by subclass to decode parameter from queryString.
protected  String printParams(AbstractQueryHandler.QueryHandlerPrinter printer)
          Print current QueryHandler params using specified QueryHandlerPrinter.
 void setAbility(String ability)
          Sets the portal element's ability to match when PortalElement are found.
 void setBeginDate(Date v)
           
 void setBeginDateW3c(String dateW3c)
          Set the begin date to be used in this query.
 void setBeginDay(int v)
           
 void setBeginMonth(int v)
           
 void setBeginYear(int v)
           
 void setCatMode(String v)
          Define the mode to use when dealing with categories.
 void setCatName(boolean v)
           
 void setCheckPstatus(boolean v)
           
 void setCids(String... v)
           
 void setCidsOff(String... v)
           
 void setDateSince(String v)
           
 void setDateType(String v)
           
 void setDocumentKinds(String... kinds)
          Set the kind of document to match for this QueryHandler
 void setEndDate(Date v)
           
 void setEndDateW3c(String dateW3c)
          Set the end date to be used in this query.
 void setEndDay(int v)
           
 void setEndMonth(int v)
           
 void setEndYear(int v)
           
 void setExactCat(boolean v)
           
 void setExactType(boolean v)
           
 void setGids(String... v)
           
 void setGidsOff(String... v)
           
 void setHist(String v)
           
 void setHistLevel(int v)
           
 void setHistoryList(List<String> historyList)
          Set the list of descriptions of the query and the query recursively in "hist" request param.
 void setIgnoreDefaultTypes(boolean ignoreDefaultTypes)
           
 void setLangs(String... langArray)
          The language(s) in which publications must have been translated to be part of the results.
 void setMids(String... v)
           
 void setMidsOff(String... v)
           
 void setMode(String m)
          Define the text mode to use to perform the text search.
 void setPagerAll(boolean pagerAll)
           
 void setPageSize(int pageSize)
           
 void setPortalIds(String... v)
           
 void setPstatus(String... pstatus)
          Sets the pstatus values to be searched by this query.
 void setRatings(String[] ratings)
          Sets the rating values to be searched by this query.
 void setReplaceFileDoc(boolean v)
           
 void setReverse(boolean v)
           
 void setSearchedFields(String... searchedFields)
          Defines the (lucene) publications fields in which to perform the text search.
 void setSearchInDB(boolean v)
           
 void setSearchInFiles(boolean v)
           
 void setSearchInPub(boolean v)
           
 void setSearchInSubWorkspaces(boolean v)
           
 void setSort(String sort)
           
 void setStart(int start)
           
 void setText(String text)
          Sets the text to search in this query. Default value is null.
 void setTextSearch(boolean textSearch)
          Indicate whether the search being performed through this query is a mainly a text search prior to other things. Default value is false.
 void setTypes(String... types)
           
 void setTypesOff(String... typesOff)
           
 void setWorkspace(Workspace wspc)
           
 void setWorkspaceSet(Set<Workspace> wsSet)
          Specifies a Set of Workspaces to refine the query on.
 void setWrkspc(String... wsIds)
           
 String toString()
           
 
Methods inherited from class com.jalios.jcms.handler.AbstractQueryHandler
getAttribute, getAttributeMap, getDataSet, getHiddenParams, getQueryString, init, parseQueryString, removeAttribute, setAttribute, setDataSet
 
Methods inherited from class com.jalios.jcms.handler.JcmsFormHandler
afterValidation, checkMissingField, getControllerContext, getEditFieldSet, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenField, getHiddenFieldML, getMainLangValue, getMainLangValueArray, getMLMap, getMLMapArray, getRedirect, getRedirectOnClosePopup, getWorkspace, init, isFieldEdition, isFieldMissing, isPartialFieldEdition, isPopupEdition, isWorkspaceForced, processAction, processStatus, sendRedirect, sendRedirect, setEditField, setNoRedirect, setNoSendRedirect, setPopupEdition, setRedirect, setRedirectOnClosePopup, setWs, updateUploadedField, updateUploadedFields, validate
 
Methods inherited from class com.jalios.jcms.context.JcmsJspContext
addBodyAttributes, addCSSHeader, addCSSHeader, addCSSHeader, addCSSHeader, addCustomHeader, addHttpEquivHeader, addHttpNameHeader, addJavaScript, addJavaScript, addJavaScript, addJavaScriptCode, addStyleHeader, addStyleHeader, checkAccess, checkAccess, checkCSRF, debugDisplayContext, disablePacker, forceEditIcon, forceUpdate, getAjaxRequestAttribute, getAjaxRequestId, getAllHeadersDiffMap, getAllHeadersMap, getBackOfficeCSSHeader, getBackOfficeJavaScriptSet, getBodyAttributes, getContentForm, getCSSHeaders, getCtxCategories, getCurrentCategory, getCustomHeaders, getDocType, getFinalCSSMap, getFinalJavaScriptSet, getFormElementCount, getFrontOfficeCSSHeader, getFrontOfficeJavaScriptSet, getHttpEquivHeaders, getHttpNameHeaders, getJavaScriptCodeSet, getJavaScriptSet, getJSONBridge, getPackVersion, getPageContext, getPageTitle, getPageZone, getPortal, getPortalCategory, getPortlet, getPublication, getStyleHeaders, getTemplateUsage, internalSetupEmptyHeader, isEditIcon, isEditIcon, isPrintView, registerDisplayContext, removeAjaxRequestAttribute, setAjaxRequestAttribute, setAjaxRequestId, setAllHeadersDiffMap, setDocType, setEditIcon, setFormElementCount, setPageContext, setPageTitle, setPageZone, setShowEditIcon, setTemplateUsage, showEditIcon, showEditIcon, workaroundBrowserBaseHrefBug
 
Methods inherited from class com.jalios.jcms.context.JcmsContext
addCookie, addMsg, addMsg, addMsgSession, addMsgSession, applySelector, forceWorkspaceUpdate, getBaseUrl, getBrowser, getCaddy, getContextPath, getErrorMsg, getErrorMsgList, getErrorMsgSession, getErrorMsgSessionList, getInfoMsg, getInfoMsgList, getInfoMsgSession, getInfoMsgSessionList, getLoggedMember, getMsgList, getMsgSessionList, getRequest, getResponse, getSession, getUploadedFile, getUploadedFileList, getUrlWithCommonUpdatedParams, getUserCountry, getUserLang, getUserLocale, getWarningMsg, getWarningMsgList, getWarningMsgSession, getWarningMsgSessionList, glp, isAdmin, isAjaxRequest, isDBMember, isDebug, isInFrontOffice, isLogged, isWebdavAccess, removeMessage, removeMessage, retrieveUploadedFile, select, sendForbidden, sendForbidden, sendRedirect, sendRedirect, sendRedirect, setErrorMsg, setErrorMsg, setErrorMsgSession, setErrorMsgSession, setInfoMsg, setInfoMsg, setInfoMsgSession, setInfoMsgSession, setLoggedMember, setRequest, setResponse, setWarningMsg, setWarningMsg, setWarningMsgSession, setWarningMsgSession, validateRegexp, validateSchedule
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

REVISION

public static final String REVISION
See Also:
Constant Field Values

TEXT_MODE_ALL_WORDS

public static final String TEXT_MODE_ALL_WORDS
The mode value to use to perform a text search matching all the words of the search string.
Value : "all".

Since:
jcms-5.6.2
See Also:
setMode(String), Constant Field Values

TEXT_MODE_ANY_WORD

public static final String TEXT_MODE_ANY_WORD
The mode value to use to perform a text search matching at least one of the words of the search string.
Value : "any".

Since:
jcms-5.6.2
See Also:
setMode(String), Constant Field Values

TEXT_MODE_EXACT

public static final String TEXT_MODE_EXACT
The mode value to use to perform a text search matching the exact phrase specified in the search string.
Value : "exact".

Since:
jcms-5.6.2
See Also:
setMode(String), Constant Field Values

TEXT_MODE_ADVANCED

public static final String TEXT_MODE_ADVANCED
The mode value to use to perform a text search with advanced search syntax (wildcard, field, etc).
Value : "advanced".

Since:
jcms-5.6.2
See Also:
setMode(String), Constant Field Values
Constructor Detail

QueryHandler

public QueryHandler()
Default constructor, builds a new QueryHandler with default value. This constructor is required to use this class as a java bean.


QueryHandler

public QueryHandler(String text,
                    String mode,
                    boolean catName,
                    boolean exactCat,
                    boolean searchInPub,
                    boolean searchInFile,
                    String[] cids,
                    String[] cidsOff,
                    String[] mids,
                    String[] midsOff,
                    String[] gids,
                    String[] gidsOff,
                    Date beginDate,
                    int beginDay,
                    int beginMonth,
                    int beginYear,
                    Date endDate,
                    int endDay,
                    int endMonth,
                    int endYear,
                    String dateType,
                    int dateSince,
                    String[] types,
                    String[] typesOff,
                    boolean exactType,
                    String[] ratings,
                    String[] pstatus,
                    boolean checkPstatus,
                    String[] langs,
                    boolean replaceFileDoc)
Constructs a new QueryHandler, settings all the specified values.

This constructors, while not deprecated, should not be used. Prefer the default constructor, followed by calls to the propers setters.

Parameters:
text - the text to be search, see setText(String)
mode - the text search mode to use, see setMode(String)
catName - whether to perform text search in categories, see setCatName(boolean)
exactCat - whether to find publication only when they have one of the category to setCatName(boolean)
searchInPub - whether to perform text search in publication, see setSearchInPub(boolean)
searchInFile - whether to perform text search in files, see setSearchInFiles(boolean)
cids - an array of Category's ids that publication must match to be found, see setCids(String...)
cidsOff - an array of Category's ids that publication must NOT match to be found, see setCidsOff(String...)
mids - an array of Member's ids defining the authors the publication must match to be found, see setMids(String...)
midsOff - an array of Member's ids defining the authors the publication must NOT match to be found, see setMidsOff(String...)
gids - an array of Group's ids defining the group that the author of the publication must belong to in order for a publication to be found, see setGids(String...)
gidsOff - an array of Group's ids defining the group that the author of the publication must NOT belong to in order for a publication to be found, see setGidsOff(String...)
beginDate -
beginDay -
beginMonth -
beginYear -
endDate -
endDay -
endMonth -
endYear -
dateType -
dateSince -
types -
typesOff -
exactType -
ratings -
pstatus -
checkPstatus -
langs -
replaceFileDoc -

QueryHandler

public QueryHandler(String queryString)
Constructs a new QueryHandler by parsing the specified query string.

See QueryHandler(String, HttpServletRequest) for a list of the decoded parameters.

Parameters:
queryString - a query String consisting of parameters (key=value) to be set in this handler.
  • Parameters must be separated with ampersand (&).
  • Values must be encoded in UTF-8.
  • Query must not starts with question mark (?)
  • e.g : "text=welcome&cids=j_42&cids=j_78"

QueryHandler

public QueryHandler(String queryString,
                    javax.servlet.http.HttpServletRequest request)
Constructs a new QueryHandler by parsing the specified query string and using informations available from the specified request (logged member, user language, etc).

The following parameters (and only those listed here) will be automatically decoded from the specified query string. Other parameters should be set using apropriate setters.

Parameters:
queryString - a query String consisting of parameters (key=value) to be set in this handler.
  • Parameters must be separated with ampersand (&).
  • Values must be encoded in UTF-8.
  • Query must not starts with question mark (?)
  • e.g : "text=welcome&cids=j_42&cids=j_78"
request - the HttpServletRequest to use to retrieve loggedMember, userLang, userLocale that will be used by this handler, ignored if null.

QueryHandler

public QueryHandler(QueryHandler original)
Create a QueryHandler by copying all fields of the specified original QueryHandler, omitting all information linked to the current request.

As of current implementation the following parameters are copied :

Parameters:
original - the original QueryHandler from which to retrieve parameters
Since:
jcms-5.7.2
Method Detail

getLogger

protected org.apache.log4j.Logger getLogger()
Specified by:
getLogger in class AbstractQueryHandler<Publication>

parseQueryStringParam

protected void parseQueryStringParam(String key,
                                     String[] values)
Description copied from class: AbstractQueryHandler
Method to be implemented by subclass to decode parameter from queryString.

Specified by:
parseQueryStringParam in class AbstractQueryHandler<Publication>
Parameters:
key - the parameter name, never null nor empty.
values - the parameter values, NEVER NULL NOR EMPTY. You can safely invoke paramValues[0]

printParams

protected String printParams(AbstractQueryHandler.QueryHandlerPrinter printer)
Print current QueryHandler params using specified QueryHandlerPrinter.

Specified by:
printParams in class AbstractQueryHandler<Publication>
Parameters:
printer - a QueryHandlerPrinter to use
Returns:
a string containing all parameters of this handler printed using specified QueryHandlerPrinter.
Since:
jcms-5.7.4

toString

public String toString()
Overrides:
toString in class Object

getResultSet

public QueryResultSet getResultSet()
Return results of a query done using this QueryHandler.

Warning: This method process the query each time it is invoked, therefore do not call it multiple times if you don't need it.

Returns:
a QueryResultSet containing all results of this query, it is a HashSet and therefore it is NOT sorted. use either getAsSortedSet() or getAsSortedSet(Comparator) to obtain a sorted Set.
Since:
jcms-5.0.0

getCategorySet

public Set<Category> getCategorySet(String inputName)

isExpanded

public boolean isExpanded(Category cat,
                          String inputName)

setIgnoreDefaultTypes

public void setIgnoreDefaultTypes(boolean ignoreDefaultTypes)
Parameters:
ignoreDefaultTypes - if true, getTypes() and getTypesOff() won't check the properties for default query types and types off.
Since:
jcms-5.0.0

getRefinedWorkspace

public Workspace getRefinedWorkspace()
Get the Workspace for this request.

Returns:
a Workspace

getWorkspaceSet

public Set<Workspace> getWorkspaceSet()
Retrieve the Set of Workspace on which the query was initially refined.

Returns:
a Set of Workspace. Return an empty set when searching in all workspace, never return null.
Since:
jcms-7.1.3, jcms-8.0.0

getResolvedWorkspaceSet

public Set<Workspace> getResolvedWorkspaceSet()
Retrieve the Set of Workspace on which the query is refined.
This set is based on workspaceSet, which may be extended given the state of boolean searchInSubWorkspaces.

Returns:
a Set of Workspace. Return an empty set when searching in all workspace, never return null.
Since:
jcms-7.1.3, jcms-8.0.0

setWrkspc

public void setWrkspc(String... wsIds)

setWorkspace

public void setWorkspace(Workspace wspc)
Overrides:
setWorkspace in class JcmsFormHandler
Since:
jcms-7.1.3, jcms-8.0.0
See Also:
JcmsFormHandler.setWorkspace(com.jalios.jcms.workspace.Workspace)

setWorkspaceSet

public void setWorkspaceSet(Set<Workspace> wsSet)
Specifies a Set of Workspaces to refine the query on.

Parameters:
wsSet - a Set of Workspace to refine on.
Since:
jcms-7.1.3, jcms-8.0.0

getAllCidSet

public Set<String> getAllCidSet()
Returns all the cids contained in this query and all historized queries.

Returns:
a set of cids

getDescription

public String getDescription()
Returns a description of the query in the language defined by userLang of this handler.

Returns:
the string of the description

getDescription

public String getDescription(String lang)
Returns a description of the query in the specified language.

Parameters:
lang - the ISO-639 code of the language in which to retrieve the query description
Returns:
the string of the description

getBeginAndEndDates

public Date[] getBeginAndEndDates()
Compute begin and end date of a query from QueryHandler values.

Returns:
an array of two Date, the first is the begin date, the second the end Date.

getHighlightedMember

public Member getHighlightedMember()

getClassSet

public HashSet<Class<? extends Publication>> getClassSet()
Return a set of classes corresponding to the 'types' attributes

Returns:
a set of class

getClassOffSet

public HashSet<Class<? extends Publication>> getClassOffSet()
Return a set of classes corresponding to the 'typesOff' attributes

Returns:
a set of class

getMostRecentTextInHistoryVisitor

protected static void getMostRecentTextInHistoryVisitor(String[] textAndMode,
                                                        QueryHandler qh)
Internal recursive method used to look for most recent text.

Parameters:
textAndMode - MUST be an allocated array of String[2] that will be filled with the text and mode if available.

getMostRecentTextAndModeInHistory

protected String[] getMostRecentTextAndModeInHistory()
Returns:
the most recent text in the search history and the mode used, as an array of 2 String, with text as first and mode as second. this method is NOT CACHED and quite SLOW, cache the result yourself. (Used by highlight).

addHighlightAttributes

public void addHighlightAttributes(javax.servlet.http.HttpServletRequest request)
Add highlight attributes to the given request.

Parameters:
request - the current request

clearHighlightAttributes

public void clearHighlightAttributes(javax.servlet.http.HttpServletRequest request)
Remove highlight attributes of the given request.

Parameters:
request - the current request

setMode

public void setMode(String m)
Define the text mode to use to perform the text search.

Parameters:
m - a string representing the mode to use, from one of those values : The specified string will be kept only if choosen from thoses values.

getMode

public String getMode()
Retrieve the string representation of the current text mode being to perform the text search.

Returns:
a string from one of the valid values in
See Also:
setMode(String)

isModeAll

public boolean isModeAll()
Checks if the current text mode is to find all words of the search string.

Returns:
true if getMode() equals TEXT_MODE_ALL_WORDS, false otherwise.
Since:
jcms-5.6.2

isModeAny

public boolean isModeAny()
Checks if the current text mode is to find at least one word of the search string.

Returns:
true if getMode() equals TEXT_MODE_ANY_WORD, false otherwise.
Since:
jcms-5.6.2

isModeExact

public boolean isModeExact()
Checks if the current text mode is to find the exact phrase specified in the search string.

Returns:
true if getMode() equals TEXT_MODE_EXACT, false otherwise.
Since:
jcms-5.6.2

isModeAdvanced

public boolean isModeAdvanced()
Checks if the current text mode is to perform the search using advanced search syntaxt.

Returns:
true if getMode() equals TEXT_MODE_ADVANCED, false otherwise.
Since:
jcms-5.6.2

setText

public void setText(String text)
Sets the text to search in this query. Default value is null.

The specified text will be search in publications/categories/archives/files depending on other parameters of this query, see setSearchInPub(boolean), setCatName(boolean).

The specified text will be search in various way depending on the search mode, see setMode(String) for more information.

Parameters:
text - a String to be searched

getText

public String getText()
Retrieve the current text being searched in this query.

Returns:
a String, may be null if no text search is being performed.

setTextSearch

public void setTextSearch(boolean textSearch)
Indicate whether the search being performed through this query is a mainly a text search prior to other things. Default value is false.

The changing behavior occurs when setting the text to null or an empty string : if set to true, the query will returns an empty result set, if set to false the query will be performed with other parameters.

Parameters:
textSearch - true to indicate that this query is a text search, false otherwise.

getTextSearch

public boolean getTextSearch()
Checks if this query is mainly a text search.

Returns:
true if this query is mainly a text search, false if this query is not specifically decicated to text search.
See Also:
setTextSearch(boolean)

getCatName

public boolean getCatName()

setCatName

public void setCatName(boolean v)

getExactCat

public boolean getExactCat()

setExactCat

public void setExactCat(boolean v)

getSearchInPub

public boolean getSearchInPub()

setSearchInPub

public void setSearchInPub(boolean v)

getSearchInFiles

public boolean getSearchInFiles()

setSearchInFiles

public void setSearchInFiles(boolean v)

getSearchInDB

public boolean getSearchInDB()

setSearchInDB

public void setSearchInDB(boolean v)

getSearchInSubWorkspaces

public boolean getSearchInSubWorkspaces()

setSearchInSubWorkspaces

public void setSearchInSubWorkspaces(boolean v)

getCids

public String[] getCids()

setCids

public void setCids(String... v)

getCidsOff

public String[] getCidsOff()

setCidsOff

public void setCidsOff(String... v)

getMids

public String[] getMids()

setMids

public void setMids(String... v)

getMidsOff

public String[] getMidsOff()

setMidsOff

public void setMidsOff(String... v)

getGids

public String[] getGids()

setGids

public void setGids(String... v)

getGidsOff

public String[] getGidsOff()

setGidsOff

public void setGidsOff(String... v)

getPortalIds

public String[] getPortalIds()

setPortalIds

public void setPortalIds(String... v)

getBeginDate

public Date getBeginDate()

setBeginDate

public void setBeginDate(Date v)

setBeginDateW3c

public void setBeginDateW3c(String dateW3c)
Set the begin date to be used in this query.

Parameters:
dateW3c - a date formatted using W3C format, see DateUtil.parseW3cDate(String) for more information on this format.
Since:
jcms-5.7.2
See Also:
setBeginDate(Date)

getEndDate

public Date getEndDate()

setEndDate

public void setEndDate(Date v)

setEndDateW3c

public void setEndDateW3c(String dateW3c)
Set the end date to be used in this query.

Parameters:
dateW3c - a date formatted using W3C format, see DateUtil.parseW3cDate(String) for more information on this format.
Since:
jcms-5.7.2
See Also:
setEndDate(Date)

getBeginDay

public int getBeginDay()

setBeginDay

public void setBeginDay(int v)

getBeginMonth

public int getBeginMonth()

setBeginMonth

public void setBeginMonth(int v)

getBeginYear

public int getBeginYear()

setBeginYear

public void setBeginYear(int v)

getEndDay

public int getEndDay()

setEndDay

public void setEndDay(int v)

getEndMonth

public int getEndMonth()

setEndMonth

public void setEndMonth(int v)

getEndYear

public int getEndYear()

setEndYear

public void setEndYear(int v)

getDateType

public String getDateType()

setDateType

public void setDateType(String v)

setCatMode

public void setCatMode(String v)
Define the mode to use when dealing with categories.

You can specify any of the following value:
  • "or": Union of categories
  • "and": Intersection of categories (default mode if empty or invalid)
  • Parameters:
    v -

    getCatMode

    public String getCatMode()

    getDateSinceInt

    public int getDateSinceInt()

    setDateSince

    public void setDateSince(String v)

    getHist

    public String getHist()

    setHist

    public void setHist(String v)

    getHistLevel

    public int getHistLevel()

    setHistLevel

    public void setHistLevel(int v)

    getSort

    public String getSort()

    setSort

    public void setSort(String sort)

    getReverse

    public boolean getReverse()

    setReverse

    public void setReverse(boolean v)

    getTypes

    public String[] getTypes()

    setTypes

    public void setTypes(String... types)

    getTypesOff

    public String[] getTypesOff()

    setTypesOff

    public void setTypesOff(String... typesOff)

    getExactType

    public boolean getExactType()

    setExactType

    public void setExactType(boolean v)

    getRatings

    public String[] getRatings()
    Retrieves the current rating values to be searched by this query.

    This method returns the original value defined with the setter setRatings(String[]), use getIntRatings() to retrieve the resolved rating values as an int array.

    Returns:
    an array of String, each string representing a rating value (int) to be searched for
    Since:
    jcms-2.1
    See Also:
    getIntRatings()

    setRatings

    public void setRatings(String[] ratings)
    Sets the rating values to be searched by this query.

    Parameters:
    ratings - an array of String, each string representing a rating value (int) to be searched for
    Since:
    jcms-2.1

    getIntRatings

    public int[] getIntRatings()
    Retrieves the current rating values to be searched by this query.

    Returns:
    an array of int, each int is a rating value to be searched for
    Since:
    jcms-2.1

    getPstatus

    public String[] getPstatus()
    Retrieves the pstatus values to be searched by this query.

    This method returns the original value defined with the setter setPstatus(String...), use getIntPstatus() to retrieve the resolved pstatus values as an int array.

    Returns:
    an array of String, each string representing a pstatus value (int) to be searched for
    Since:
    jcms-2.1
    See Also:
    getIntPstatus()

    setPstatus

    public void setPstatus(String... pstatus)
    Sets the pstatus values to be searched by this query.

    Parameters:
    pstatus - an array of String, each string representing a pstatus value (int) to be searched for empty values in the array are ignored, if given array is null, pstatus search is reset.
    Since:
    jcms-2.1

    getIntPstatus

    public int[] getIntPstatus()
    Retrieves the current pstatus values to be searched by this query.

    Returns:
    an array of int, each int is a pstatus value to be searched for
    Since:
    jcms-2.1

    getCheckPstatus

    public boolean getCheckPstatus()

    setCheckPstatus

    public void setCheckPstatus(boolean v)

    setLangs

    public void setLangs(String... langArray)
    The language(s) in which publications must have been translated to be part of the results.

    A publication is considered translated in a language according to rules defines by Publication.checkLang(String), ie if the title or the abstract have been specified in the language.

    Default behavior is to search for all content, without restriction on the translated language.

    Not to be confused with #setContentLangs(String...)

    Parameters:
    langArray - an array containing ISO-639 language code and/or "user" value which is replaced with the current user lang as retieved by JcmsContext.getUserLang().

    getLangs

    public String[] getLangs()
    Retrieve the language in which publications must have been translated to be part of the results.

    If the "user" value was specified in setLangs(String...) this method will return the user language resolved at the time of the setter invocation.

    Returns:
    an array containing ISO-639 language code, null if default behavior was applied

    getReplaceFileDoc

    public boolean getReplaceFileDoc()

    setReplaceFileDoc

    public void setReplaceFileDoc(boolean v)

    getUnresolvedLangs

    public String[] getUnresolvedLangs()

    getSearchedFields

    public String[] getSearchedFields()
    Retrieves the lucene fields in which the text search is being performed for publications.

    Returns:
    an array of lucene field name in which to do the text search. (if null or empty default behavior is used)

    setSearchedFields

    public void setSearchedFields(String... searchedFields)
    Defines the (lucene) publications fields in which to perform the text search.

    Parameters:
    searchedFields - an array of lucene field name in which to do the text search. if null or empty will use default behavior.

    setAbility

    public void setAbility(String ability)
    Sets the portal element's ability to match when PortalElement are found.

    Parameters:
    ability - an ability choosen from values returned by PortalElement.getAllAbilities(), or "noabilities" for portlet without any ability, or "hasabilities" for portlet with any ability.

    getAbility

    public String getAbility()
    Retrieves the current the portal element's ability defined for this QueryHandler.

    Returns:
    the ability defined for this query.

    getStart

    public int getStart()

    setStart

    public void setStart(int start)

    getPageSize

    public int getPageSize()

    setPageSize

    public void setPageSize(int pageSize)

    getPagerAll

    public boolean getPagerAll()

    setPagerAll

    public void setPagerAll(boolean pagerAll)

    getHistoryList

    public List<String> getHistoryList()
    Not set : - before the query method has been called. - for internal queryHandlers used for refinement in QueryManager.query processing.

    Returns:
    the list of the descriptions of the current query and the query recursively in "hist" request param.

    setHistoryList

    public void setHistoryList(List<String> historyList)
    Set the list of descriptions of the query and the query recursively in "hist" request param.

    Parameters:
    historyList -

    setDocumentKinds

    public void setDocumentKinds(String... kinds)
    Set the kind of document to match for this QueryHandler

    Parameters:
    kinds - an array of document kind (e.g "pdf", "image", "spreadsheet", ...)
    Since:
    jcms-6.1

    getDocumentKinds

    public String[] getDocumentKinds()
    Retrieve the kind of document defined for this QueryHandler

    Returns:
    a set of content type, never return null
    Since:
    jcms-6.1

    getDocumentKindsGroupMap

    public static Map<String,String> getDocumentKindsGroupMap(String userLang)
    Retrieve a map of all document kind group defined in properties.

    Parameters:
    userLang - the ISO-639 language code in which to retrieve labels
    Returns:
    a Map of group kind name (e.g. "office", "media", "misc") to document kind group label (e.g "Office documents", "Medias", "Other", ...)
    Since:
    jcms-6.1

    getDocumentKindsMap

    public static Map<String,String> getDocumentKindsMap(String userLang,
                                                         String kindGroup)
    Retrieve a map of all document kind for the specified kind group.

    Parameters:
    userLang - the ISO-639 language code in which to retrieve labels
    kindGroup - document kind group as retrieve in key of map returned by getDocumentKindsGroupMap(String)
    Returns:
    a Map of kind name (e.g. "spreasheet", "wordprocessing", ...) to document kind label (e.g "Spreadsheet", "Word processing", ...)
    Since:
    jcms-6.1

    getContentTypesFromDocumentKind

    public static List<String> getContentTypesFromDocumentKind(String kind)
    Retrieve the content type to use for the specified document kind

    Parameters:
    kind - a document kind, as retrieved by getDocumentKindsMap(String, String)
    Returns:
    an list of content types
    Since:
    jcms-6.1

    isHybridSearch

    public boolean isHybridSearch()
    Returns true if this is an hybrid search (i.e. JStore and JcmsDB).

    Returns:
    true if this is an hybrid search (i.e. JStore and JcmsDB).
    Since:
    jcms-6.2.0

    getTypesCommonSuperClass

    public static Class<? extends Publication> getTypesCommonSuperClass(QueryHandler... queryHandlers)
    Retrieve the common super class of types specified in the QueryHandler.

    Eg :

      assertEquals(Publication.class, QueryHandler.getTypesCommonSuperClass((QueryHandler[]) null));
      assertEquals(Article.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=Article")));
      assertEquals(Content.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=Article&types=SmallNews")));
      assertEquals(AbstractPortletSkinable.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=PortletJsp&types=PortletQueryForeachDetail")));
      assertEquals(Publication.class, QueryHandler.getTypesCommonSuperClass(new QueryHandler("types=Article&types=PortletJsp")));
     

    Parameters:
    queryHandlers - one or several QueryHandler which will be used to extract the common super class of the specified types parameter
    Returns:
    a Class, never return null (default to Publication.class in case class could not be found )
    Since:
    jcms-7.1.0


    Copyright © 2001-2010 Jalios SA. All Rights Reserved.