Class PublicationCriteria
- All Implemented Interfaces:
DBConstants,JaliosConstants
- Since:
- jcms-6.0.0
- Author:
- Olivier Dedieu
-
Field Summary
Fields inherited from interface com.jalios.jcms.db.DBConstants
ALL_CATEGORIES_SET_FIELD, ATTACH_WS_SET_FIELD, AUTH_GRP_SET_FIELD, AUTH_MBR_SET_FIELD, AUTHOR_ID_FIELD, CATEGORIES_SET_FIELD, CDATE_FIELD, CHANNEL_JCMSDB_PROP, CLASSIFICATION_LEVEL_FIELD, DBDATA_URID, EXTENDED_READ_RIGHTS, HAS_ATTACH_WS_FIELD, HAS_NO_READ_RIGHTS, HIBERNATE_MAPPING_ADATE, HIBERNATE_MAPPING_AUTHOR, HIBERNATE_MAPPING_CDATE, HIBERNATE_MAPPING_EDATE, HIBERNATE_MAPPING_HAS_ATTACH_WS, HIBERNATE_MAPPING_HASNOREADRIGHTS, HIBERNATE_MAPPING_MAININSTANCE_ID, HIBERNATE_MAPPING_MAJORVERSION, HIBERNATE_MAPPING_MDATE, HIBERNATE_MAPPING_MERGE_DATE, HIBERNATE_MAPPING_MERGE_ID, HIBERNATE_MAPPING_MINORVERSION, HIBERNATE_MAPPING_OPAUTHOR, HIBERNATE_MAPPING_PDATE, HIBERNATE_MAPPING_PSTATUS, HIBERNATE_MAPPING_READ_ACK, HIBERNATE_MAPPING_READERCOUNT, HIBERNATE_MAPPING_RESTRICTIVE_UPDATE_RIGHTS, HIBERNATE_MAPPING_TITLE, HIBERNATE_MAPPING_TRACKED, HIBERNATE_MAPPING_UDATE, HIBERNATE_MAPPING_VOTECOUNT, HIBERNATE_MAPPING_VOTESCORE, HIBERNATE_MAPPING_WORKFLOW_ID, HIBERNATE_MAPPING_WORKSPACE_ID, MAX_HIBERNATE_MAPPING_PUBLICATION, MDATE_FIELD, OPAUTHOR_ID_FIELD, PSTATUS_FIELD, ROW_ID_FIELD, SCROLL_FETCH_SIZE, WORKFLOW_ID_FIELD, WORKSPACE_ID_FIELDFields 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
ConstructorsConstructorDescriptionPublicationCriteria(Class<? extends Publication> clazz) PublicationCriteria(Class<? extends Publication> clazz, QueryHandler qh) -
Method Summary
Modifier and TypeMethodDescriptionorg.hibernate.CriteriabuildCriteria(boolean count) Build an hibernate Criteria object from all settings specified in this PublicationCriteria.booleanReturns true if the given publication matches the required categories (must be called if isPartialCategoryRestriction()).booleanIndicates HOW read rights controls are being verified.protected voidRetrieve the author id publication MUST match to be found.String[]Retrieve the authors ids that publication MUST match to be found.String[]Retrieve the authors ids that publication MUST NOT match to be found.Retrieve begin date to use during search.Retrieve the date field used for date filtering.Retrieve end date to use during search.intintRetrieve the member being used for read right control (aka logged member).Returns the merge comparator used to sort hybrid search.String[]Retrieve the op authors ids that publication MUST match to be found.getOrder()Retrieve field name used for sorting.int[]Retrieve the pstatus publication must match or not match to be found.Class<? extends Publication> getText()Retrieve text publication must contain to be found.Use insteadgetWorkspaceIdSet().booleanChecks ordering arrangement.booleanbooleanRetrieve boolean indicating how pstatus specified insetPstatusArray(int...)must be used.booleanReturns true if the category restriction is partial.booleanbooleanbooleanReturns true if the text parameter has been setup.intsetAscendingOrder(boolean ascendingOrder) Set the arrangement, ascending or descending, to used to use during ordering.Set the author of publication to found.setAuthorId(String authorId) Set the author id publication MUST match to be found.setAuthorIds(String... mbrIds) Set the authors of publication to found.setAuthorIdsOff(String... mbrIds) Set the authors ids that publication MUST NOT match to be found.setBeginDate(Date beginDate) Set the date to use as lower value accepted for date search.voidsetCategorySet(Set<Category> catSet) Set the category to use for filteringvoidsetCatMode(String catMode) Define the mode to use when dealing with categories.voidsetCheckReadRights(boolean checkReadRights) Set HOW read rights are performed (not if they are performed or not, because they always are).voidsetCriteriaAlias(String criteriaAlias) Add an alias on theCriteriasetCustomCriterion(org.hibernate.criterion.Criterion customCriterion) Set additionnal Hibernate criterion to use during querysetDateType(String dateType) Set the date field used for date filtering.setDocumentKinds(String... kinds) Set the kind of document to match.setEndDate(Date endDate) Set the date to use as upper value accepted for date search.voidsetExactCat(boolean exactMode) Set the filter mode to apply when searching in categories.voidsetFilterOnMemberWorkspaces(boolean filterOnMemberWorkspaces) setFirstResult(int firstResult) voidsetHybridSearch(boolean isHybridSearch) Set whether this PublicationCriteria was used as part of an hybrid search (both JStore and JcmsDB) or JcmsDB only.setIncludePstatus(boolean includePstatus) Set how pstatus specified insetPstatusArray(int...)must be used.setMaxResults(int maxResults) voidSet the Member to use for read right control (aka logged member).setMergeComparator(Comparator mergeComparator) Set the merge comparator to be used to sort hybrid search (and set the isHybridSearch flag)setOpAuthor(Member opAuthor) Set the op author of publication to found.setOpAuthorId(String opAuthorId) Set the op author id publication MUST match to be found.setOpAuthorIds(String... mbrIds) Set the op authors of publication to found.Set the field name to use for sorting.setPstatusArray(int... pstatusArray) Set the pstatus publication must match or not match to be found.setPubClass(Class<? extends Publication> clazz) setRowIdSet(Set<Long> rowIdSet) setSearchInAttachWS(boolean searchInAttachWS) setSearchInTrash(boolean searchInTrash) Set wether to search trashed publication (true) or not (false).Set the text to look for in publication.setWorkspace(Workspace workspace) Use insteadsetWorkspaceIdSet(Collection).setWorkspaceId(String workspaceId) Use insteadsetWorkspaceIdSet(Collection).voidsetWorkspaceIdSet(Collection<String> wsIds) toString()
-
Constructor Details
-
PublicationCriteria
-
PublicationCriteria
-
-
Method Details
-
toString
-
buildCriteria
public org.hibernate.Criteria buildCriteria(boolean count) Build an hibernate Criteria object from all settings specified in this PublicationCriteria.- Parameters:
count-trueto build a Critera for an efficient counting query (i.e. without sorting),falseto build a Criteria complying with all criterion (ie sort order is applied with proper order by clause)- Returns:
- a new hibernate
Criteriainstance. Warning: may return null !
-
isTextSearch
public boolean isTextSearch()Returns true if the text parameter has been setup.- Returns:
- true if the text parameter has been setup.
- Since:
- jcms-6.0.0
-
getPubClass
-
setPubClass
-
getQueryHandler
-
setQueryHandler
-
getWorkspaceId
Use insteadgetWorkspaceIdSet().- Returns:
- the workspace id to refine on.
-
setWorkspaceId
Use insteadsetWorkspaceIdSet(Collection).- Parameters:
workspaceId- the workspace id to refine on.- Returns:
- the publication criteria.
-
setWorkspace
Use insteadsetWorkspaceIdSet(Collection).- Parameters:
workspace- the workspace to refine on.- Returns:
- the publication criteria.
-
setWorkspaceIdSet
- Parameters:
wsIds- the set of workspace's ids to refine on.- Since:
- jcms-7.1.3, jcms-8.0.0
-
getWorkspaceIdSet
- Returns:
- the workspaceIdSet to refine on.
- Since:
- jcms-7.1.3, jcms-8.0.0
-
getAuthorId
Retrieve the author id publication MUST match to be found. Return an id if and only if one author was specified.- Returns:
- the Member id to use for author refinement, or null if none or several members were specified
-
setAuthorId
Set the author id publication MUST match to be found. Exclusive withsetAuthorIds(String...)andsetAuthor(Member)- Parameters:
authorId- the Member id the authors the publication must match to be found- Returns:
- this PublicationCriteria instance, for method chaining
-
setAuthor
Set the author of publication to found. Exclusive withsetAuthorIds(String...)andsetAuthorId(String)- Parameters:
author- the Member the authors the publication must match to be found- Returns:
- this PublicationCriteria instance, for method chaining
-
getAuthorIds
Retrieve the authors ids that publication MUST match to be found.- Returns:
- an array of member's id.
- Since:
- jcms-9.0.3
-
setAuthorIds
Set the authors of publication to found. Exclusive withsetAuthor(Member)andsetAuthorId(String)- Parameters:
mbrIds- an array of Member's ids defining the authors the publication must match to be found- Returns:
- this PublicationCriteria instance, for method chaining
- Since:
- jcms-9.0.3
-
setOpAuthorId
Set the op author id publication MUST match to be found. Exclusive withsetOpAuthorIds(String...)andsetOpAuthor(Member)- Parameters:
opAuthorId- the Member id the op authors the publication must match to be found- Returns:
- this PublicationCriteria instance, for method chaining
- Since:
- jcms-10.0.5 / JCMS-8387
-
setOpAuthor
Set the op author of publication to found. Exclusive withsetOpAuthorIds(String...)andsetOpAuthorId(String)- Parameters:
opAuthor- the Member the op authors the publication must match to be found- Returns:
- this PublicationCriteria instance, for method chaining
- Since:
- jcms-10.0.5 / JCMS-8387
-
getOpAuthorIds
Retrieve the op authors ids that publication MUST match to be found.- Returns:
- an array of member's id.
- Since:
- jcms-10.0.5 / JCMS-8387
-
setOpAuthorIds
Set the op authors of publication to found. Exclusive withsetOpAuthor(Member)andsetOpAuthorId(String)- Parameters:
mbrIds- an array of Member's ids defining the op authors the publication must match to be found- Returns:
- this PublicationCriteria instance, for method chaining
- Since:
- jcms-10.0.5 / JCMS-8387
-
getAuthorIdsOff
Retrieve the authors ids that publication MUST NOT match to be found.- Returns:
- an array of member's id.
- Since:
- jcms-9.0.3
-
setAuthorIdsOff
Set the authors ids that publication MUST NOT match to be found.- Parameters:
mbrIds- an array of Member's ids defining the authors the publication must NOT match to be found- Returns:
- this PublicationCriteria instance, for method chaining
- Since:
- jcms-9.0.3
-
setFilterOnMemberWorkspaces
public void setFilterOnMemberWorkspaces(boolean filterOnMemberWorkspaces) -
getPstatusArray
public int[] getPstatusArray()Retrieve the pstatus publication must match or not match to be found.- Returns:
- an array of pstatus to use during publication query
- See Also:
-
setPstatusArray
Set the pstatus publication must match or not match to be found.Set
setIncludePstatus(boolean)simultaneously to control how those values are being used.Examples :
To find all publication in the published state :
pubCriteria.setIncludePstatus(true); pubCriteria.setPstatusArray(WorkflowConstants.PUBLISHED_PSTATUS);
To find all publication which are NOT expired :pubCriteria.setIncludePstatus(false); pubCriteria.setPstatusArray(WorkflowConstants.EXPIRED_PSTATUS);
- Parameters:
pstatusArray- one or more workflow pstatus to use in the criterion- Returns:
- this PublicationCriteria instance, for method chaining
- See Also:
-
isIncludePstatus
public boolean isIncludePstatus()Retrieve boolean indicating how pstatus specified insetPstatusArray(int...)must be used.- Returns:
trueif value specified ingetPstatusArray()are required,falseif values are excluded.- See Also:
-
setIncludePstatus
Set how pstatus specified insetPstatusArray(int...)must be used.Default value is
trueif aQueryHandlerwas specified on this PublicationCriteria (through constructor or setter), false otherwise.- Parameters:
includePstatus-trueif value specified ingetPstatusArray()are required ; publication will match only if their pstatus IS one of the specified value,
falseif values are excluded ; publication will match only if their pstatus IS NOT one of the specified value.- Returns:
- this PublicationCriteria instance, for method chaining
- See Also:
-
getText
Retrieve text publication must contain to be found.- Returns:
- any text to look for or null if no text search was specified
-
setText
Set the text to look for in publication.- Parameters:
text- a search string, as supported by lucene full text search.- Returns:
- this PublicationCriteria instance, for method chaining
-
setDocumentKinds
Set the kind of document to match. Setting this value will for a search en DBFileDocument (and subtypes), unless a DBFileDocument class is already being search for.- Parameters:
kinds- an array of document kind (e.g "pdf", "image", "spreadsheet", ...)- Returns:
- this PublicationCriteria for chained invocation
- Since:
- jcms-9.0.3 JCMS-5305
-
getBeginDate
Retrieve begin date to use during search.- Returns:
- a date or null if no begin date was specified
- See Also:
-
setBeginDate
Set the date to use as lower value accepted for date search.Set
setDateType(String)simultaneously to control which date field is being used.- Parameters:
beginDate- the date to use as lower bound- Returns:
- this PublicationCriteria instance, for method chaining
- See Also:
-
getEndDate
Retrieve end date to use during search.- Returns:
- a date or null if no end date was specified
- See Also:
-
setEndDate
Set the date to use as upper value accepted for date search.Set
setDateType(String)simultaneously to control which date field is being used.- Parameters:
endDate- the date to use as upper bound- Returns:
- this PublicationCriteria instance, for method chaining
- See Also:
-
getDateType
Retrieve the date field used for date filtering.- Returns:
- a date field or null if no date type was specified
-
setDateType
Set the date field used for date filtering."cdate"is the default value and fallback if an invalid type is specified.Accepted values are :
"cdate": creation date"mdate": modification date"pdate": publication date"edate": expiration date"adate": archiving date
"udate": last major modification date, for Historized type"uploadDate"and"pdfUploadDate"for sub class of DBFileDocument
- Parameters:
dateType- a date type from accepted values as described above.- Returns:
- this PublicationCriteria instance, for method chaining
- See Also:
-
setRowIdSet
-
setMember
Set the Member to use for read right control (aka logged member).- Parameters:
member- a Member (or null to reset to anonymous)
-
getMember
Retrieve the member being used for read right control (aka logged member).- Returns:
- a Member or null if no author was requested.
-
checkReadRights
public boolean checkReadRights()Indicates HOW read rights controls are being verified.- if
true: controls are partially verified through SQL (to improve performance), the rest during iteration - if
false: controls are entirely performed during iteration
- Returns:
- HOW read rights controls are being verified.
- if
-
setCheckReadRights
public void setCheckReadRights(boolean checkReadRights) Set HOW read rights are performed (not if they are performed or not, because they always are).- Parameters:
checkReadRights- true to use SQL and iteration (if possible), false to use only iteration control- See Also:
-
getFirstResult
public int getFirstResult() -
setFirstResult
-
getMaxResults
public int getMaxResults() -
setMaxResults
-
getOrder
Retrieve field name used for sorting.- Returns:
- a field name or null if default sorting should be applied
-
setOrder
Set the field name to use for sorting.Set
setAscendingOrder(boolean)simultaneously to control which arrangement should be used during ordering.Accepted values includes :
"mdate""cdate""pdate""edate""adate""title""pstatus""readerCount"(or"reader")"voteCount""rowId"(or"id")
- Parameters:
order- a field name- Returns:
- this PublicationCriteria instance, for method chaining
-
isAscendingOrder
public boolean isAscendingOrder()Checks ordering arrangement.- Returns:
- true if ordering is ascending false if ordering is descending.
- See Also:
-
setAscendingOrder
Set the arrangement, ascending or descending, to used to use during ordering.- Parameters:
ascendingOrder-trueto use ascending order,falseto use descending order.- Returns:
- this PublicationCriteria instance, for method chaining
- See Also:
-
setCustomCriterion
Set additionnal Hibernate criterion to use during query- Parameters:
customCriterion- an hibernateCriterionor null to reset value- Returns:
- this PublicationCriteria instance, for method chaining
-
getMergeComparator
Returns the merge comparator used to sort hybrid search. If no comparator has been provided, it is deduced fromgetOrder()andisAscendingOrder().- Returns:
- the merge comparator
- Since:
- jcms-7.0.0
-
setMergeComparator
Set the merge comparator to be used to sort hybrid search (and set the isHybridSearch flag)- Parameters:
mergeComparator- the merge comparator- Returns:
- this PublicationCriteria for chained invocation
- Since:
- jcms-7.0.0
-
isHybridSearch
public boolean isHybridSearch() -
setHybridSearch
public void setHybridSearch(boolean isHybridSearch) Set whether this PublicationCriteria was used as part of an hybrid search (both JStore and JcmsDB) or JcmsDB only.- Parameters:
isHybridSearch-truefor hybrid search, false for JcmsDB search only.- See Also:
-
isPolymorphicQuery
public boolean isPolymorphicQuery() -
isScrollRequired
public boolean isScrollRequired() -
queryCount
public int queryCount() -
isPartialCategoryRestriction
public boolean isPartialCategoryRestriction()Returns true if the category restriction is partial.- Returns:
- true if the category restriction is partial.
- Since:
- jcms-9.0.2
-
checkPublicationCategories
Returns true if the given publication matches the required categories (must be called if isPartialCategoryRestriction()).- Parameters:
pub- the publication- Returns:
- true if the given publication matches the required categories (must be called if isPartialCategoryRestriction()).
- Since:
- jcms-9.0.2
-
getQueryFilterContext
-
clearQueryFilterContext
protected void clearQueryFilterContext() -
setSearchInAttachWS
-
setSearchInTrash
Set wether to search trashed publication (true) or not (false).- Parameters:
searchInTrash- true to searched trashed publication, false to exclude them- Returns:
- this PublicationCriteria instance, for method chaining
- Since:
- jcms-10.0.6 / JCMS-8934
-
getCriteriaAlias
-
setCriteriaAlias
Add an alias on theCriteria- Parameters:
criteriaAlias- The name of the alias
-
setCatMode
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:
catMode- "or" or "and"- Since:
- jcms-10.0.5 / JCMS-8624
-
setExactCat
public void setExactCat(boolean exactMode) Set the filter mode to apply when searching in categories.- true to search publication directly categorized in the specified categories
- false to search publication categorized in the specified in categories and in any of their children
dbpub.search.category.exact.- Parameters:
exactMode- true to request exact mode, false to search in descendants- Since:
- jcms-10.0.5 / JCMS-8624
-
setCategorySet
Set the category to use for filtering- Parameters:
catSet- a Set of Category (may be null or empty to skip category filter)- Since:
- jcms-10.0.5 / JCMS-8624
-