com.flexive.shared.search
Class FxSQLSearchParams

java.lang.Object
  extended by com.flexive.shared.search.FxSQLSearchParams
All Implemented Interfaces:
java.io.Serializable

public class FxSQLSearchParams
extends java.lang.Object
implements java.io.Serializable

Search parameters

Author:
Gregor Schober (gregor.schober@flexive.com), UCS - unique computing solutions gmbh (http://www.ucs.at)
See Also:
Serialized Form

Nested Class Summary
static class FxSQLSearchParams.BriefcaseCreationData
          Envelope to carry data needed for a briefcase creation.
static class FxSQLSearchParams.CacheMode
          The cache modes of the search.
 
Constructor Summary
  FxSQLSearchParams()
          Constructor.
protected FxSQLSearchParams(FxSQLSearchParams other)
          Copy constructor.
 
Method Summary
 FxSQLSearchParams copy()
           
 FxSQLSearchParams.BriefcaseCreationData getBriefcaseCreationData()
           
 FxSQLSearchParams.CacheMode getCacheMode()
          Returns the cache mode.
 java.util.List<java.lang.Long> getHintTypes()
           
 int getQueryTimeout()
          Returns the query timeout in seconds.
 java.util.List<FxLanguage> getResultLanguages()
          Gets the languages that the resultset will contain.
 FxTreeMode getTreeMode()
           
 long getTreeRootId()
           
 boolean getWillCreateBriefcase()
          Retuns true if the query will create a briefcase with the found objects.
 boolean isHintIgnoreXPath()
           
 boolean isHintNoResultInfo()
           
 boolean isHintSelectData()
           
 boolean isNoInternalSort()
           
 FxSQLSearchParams saveResultInBriefcase(java.lang.String name, java.lang.String description, ACL acl)
          Saves the result of the query in a new briefcase.
 FxSQLSearchParams saveResultInBriefcase(java.lang.String name, java.lang.String description, java.lang.Long aclId)
          Saves the result of the query in a new briefcase.
 FxSQLSearchParams setCacheMode(FxSQLSearchParams.CacheMode mode)
          Sets the caching mode for the search.
 void setHintIgnoreXPath(boolean hintIgnoreXPath)
          Indicate that the caller does not need the XPaths of the values returned by the search result.
 void setHintNoResultInfo(boolean hintNoResultInfo)
          Disable the retrieval of result information such as the total row count or the found content types.
 void setHintSelectData(boolean hintSelectData)
          Select the "data" field of FxValues.
 void setHintTypes(java.util.List<java.lang.Long> hintTypes)
          Set the list of types the caller expects this query to return.
 void setNoInternalSort(boolean noInternalSort)
          Disable the default internal sort order when no "order by" clause was specified.
 FxSQLSearchParams setQueryTimeout(int value)
          Sets the query timeout on the database.
 FxSQLSearchParams setResultLanguages(java.util.List<FxLanguage> languages)
          Sets the languages that the resultset should contain.
 void setTreeMode(FxTreeMode treeMode)
          Set the tree for tree queries (edit or live).
 void setTreeRootId(long treeRootId)
          When using @node_position, you may need to specify the tree node where the node position should be calculated from if the same content is used in multiple subtrees.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FxSQLSearchParams

public FxSQLSearchParams()
Constructor.


FxSQLSearchParams

protected FxSQLSearchParams(FxSQLSearchParams other)
Copy constructor.

Parameters:
other - the instance to be copied
Since:
3.1.6
Method Detail

copy

public FxSQLSearchParams copy()
Returns:
an independent copy of this parameter set

setCacheMode

public FxSQLSearchParams setCacheMode(FxSQLSearchParams.CacheMode mode)
Sets the caching mode for the search.

Parameters:
mode - the cache mode to use
CacheMode.ON: read from the cache if possible and write result to the cache
CacheMode.OFF: do not read or write the cache
CacheMode.READ_ONLY: read from the cache, but do not write to it
if null is specified CacheMode.READ_ONLY will be used.
Returns:
this

getCacheMode

public FxSQLSearchParams.CacheMode getCacheMode()
Returns the cache mode.

Returns:
the cache mode.

setResultLanguages

public FxSQLSearchParams setResultLanguages(java.util.List<FxLanguage> languages)
Sets the languages that the resultset should contain.

Warning: selecting more than one language is not supported (as of flexive 3.1.6).

Parameters:
languages - the languages, if null or a empty array is specified the default language of the calling user will be used.
Returns:
this

getResultLanguages

public java.util.List<FxLanguage> getResultLanguages()
Gets the languages that the resultset will contain.

Returns:
the languages

saveResultInBriefcase

public FxSQLSearchParams saveResultInBriefcase(java.lang.String name,
                                               java.lang.String description,
                                               java.lang.Long aclId)
Saves the result of the query in a new briefcase.

Parameters:
name - the name of the briefcase to create
description - the description of the briefcase
aclId - null if the briefcase is not shared, or a ACL to grant permissions to other users
Returns:
this

saveResultInBriefcase

public FxSQLSearchParams saveResultInBriefcase(java.lang.String name,
                                               java.lang.String description,
                                               ACL acl)
Saves the result of the query in a new briefcase.

Parameters:
name - the name of the briefcase to create
description - the description of the briefcase
acl - null if the briefcase is not shared, or a ACL to grant permissions to other users
Returns:
this

getWillCreateBriefcase

public boolean getWillCreateBriefcase()
Retuns true if the query will create a briefcase with the found objects.

Returns:
true if the query will create a briefcase with the found objects.

getBriefcaseCreationData

public FxSQLSearchParams.BriefcaseCreationData getBriefcaseCreationData()

setQueryTimeout

public FxSQLSearchParams setQueryTimeout(int value)
Sets the query timeout on the database.

Parameters:
value - in seconds, zero means unlimited
Returns:
this

getQueryTimeout

public int getQueryTimeout()
Returns the query timeout in seconds.

Returns:
the query timeout

getHintTypes

public java.util.List<java.lang.Long> getHintTypes()
Returns:
the list of types the caller expects this query to return.
Since:
3.1.6

setHintTypes

public void setHintTypes(java.util.List<java.lang.Long> hintTypes)
Set the list of types the caller expects this query to return. This allows optimizations for security filters, since FxSQL queries always operate on the flat virtual table defined by all types.

Use with care! When the result contains a type that is not covered by this list, security restrictions may not be applied to the type.

Parameters:
hintTypes - the list of types the query may return
Since:
3.1.6

isHintIgnoreXPath

public boolean isHintIgnoreXPath()
Returns:
whether the XPath for result values is needed by the caller
Since:
3.1.6

setHintIgnoreXPath

public void setHintIgnoreXPath(boolean hintIgnoreXPath)
Indicate that the caller does not need the XPaths of the values returned by the search result. XPaths may be selected if they are necessary for checking property permissions, regardless.

Parameters:
hintIgnoreXPath - if the result values can ignore the XPath property
Since:
3.1.6

isHintNoResultInfo

public boolean isHintNoResultInfo()
Returns:
when true, indicates that the caller does not need 'global' information about the result set such as the total row count or the found content types
Since:
3.2.0

setHintNoResultInfo

public void setHintNoResultInfo(boolean hintNoResultInfo)
Disable the retrieval of result information such as the total row count or the found content types. This allows the query engine to perform the entire query in one pass instead of populating a temporary table first.

Parameters:
hintNoResultInfo - when true, no result information will be available in the FxResultSet
Since:
3.2.0

isNoInternalSort

public boolean isNoInternalSort()
Returns:
when true and no "order by" clause was specified, disable the internal default sort by content ID and version.
Since:
3.2.0

setNoInternalSort

public void setNoInternalSort(boolean noInternalSort)
Disable the default internal sort order when no "order by" clause was specified. Note that when no order by clause was specified in the query and this setting is true, paging will be disabled as the sort order would be undefined (and, depending on the DB, not repeatable across multiple queries).

Parameters:
noInternalSort - to disable the internal default sorting
Since:
3.2.0

isHintSelectData

public boolean isHintSelectData()
Returns:
when true, the "data" field of FxValues will be included in the search result. Disabled by default for performance reasons.
Since:
3.2.0
See Also:
FxValue.getValueData()

setHintSelectData

public void setHintSelectData(boolean hintSelectData)
Select the "data" field of FxValues.

Parameters:
hintSelectData - true to select the data of FxValues
Since:
3.2.0
See Also:
FxValue.getValueData()

getTreeRootId

public long getTreeRootId()
Returns:
the node ID which should be used as the root node for calculating @node_position
Since:
3.2.0

setTreeRootId

public void setTreeRootId(long treeRootId)
When using @node_position, you may need to specify the tree node where the node position should be calculated from if the same content is used in multiple subtrees.

Parameters:
treeRootId - the node ID which should be used as the root node for calculating @node_position
Since:
3.2.0
See Also:
FX-718

getTreeMode

public FxTreeMode getTreeMode()
Returns:
the tree mode for all tree queries (edit or live)
Since:
3.2.0

setTreeMode

public void setTreeMode(FxTreeMode treeMode)
Set the tree for tree queries (edit or live).

Parameters:
treeMode - the tree mode
Since:
3.2.0