Class XWikiCacheStore
- java.lang.Object
-
- com.xpn.xwiki.internal.store.AbstractXWikiStore
-
- com.xpn.xwiki.store.XWikiCacheStore
-
- All Implemented Interfaces:
XWikiCacheStoreInterface
,XWikiStoreInterface
,org.xwiki.component.phase.Initializable
,org.xwiki.observation.EventListener
@Component(roles=XWikiStoreInterface.class) @Named("cache") @InstantiationStrategy(PER_LOOKUP) public class XWikiCacheStore extends com.xpn.xwiki.internal.store.AbstractXWikiStore implements XWikiCacheStoreInterface, org.xwiki.observation.EventListener, org.xwiki.component.phase.Initializable
A proxy store implementation that caches Documents when they are first fetched and subsequently return them from a cache. It delegates all write and search operations to an underlying store without doing any caching on them.- Version:
- $Id: a2df22cd81c519232323865b54fb39d7f3eb585e $
-
-
Constructor Summary
Constructors Constructor Description XWikiCacheStore()
Default constructor generally used by the Component Manager.XWikiCacheStore(XWikiStoreInterface store, XWikiContext context)
Deprecated.since 10.2 and 9.11.4, should be used as a component instead
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
cleanUp(XWikiContext context)
int
countDocuments(String wheresql, XWikiContext context)
API allowing to count the total number of documents that would be returned by a query.int
countDocuments(String parametrizedSqlClause, List<?> parameterValues, XWikiContext context)
API allowing to count the total number of documents that would be returned by a parameterized query.void
createWiki(String wikiName, XWikiContext context)
Allows to create a new wiki database and initialize the default tables.void
deleteLinks(long docId, XWikiContext context, boolean bTransaction)
Deprecated.void
deleteLock(XWikiLock lock, XWikiContext context, boolean bTransaction)
void
deleteWiki(String wikiName, XWikiContext context)
Delete a wiki database.void
deleteXWikiDoc(XWikiDocument doc, XWikiContext inputxcontext)
boolean
exists(XWikiDocument doc, XWikiContext inputxcontext)
void
flushCache()
org.xwiki.cache.Cache<XWikiDocument>
getCache()
List<String>
getClassList(XWikiContext context)
List<String>
getCustomMappingPropertyList(BaseClass bclass)
List<Event>
getEvents()
String
getKey(XWikiDocument doc)
Deprecated.since 4.0M1, useXWikiDocument.getKey()
String
getKey(XWikiDocument doc, XWikiContext context)
String
getKey(String fullName, String language, XWikiContext context)
Deprecated.since 4.0M1, useXWikiDocument.getKey()
String
getKey(String wiki, String fullName, String language)
Deprecated.since 4.0M1, useXWikiDocument.getKey()
int
getLimitSize(XWikiContext context, Class<?> entityType, String propertyName)
Get the limit size of a property.org.xwiki.cache.Cache<Integer>
getLimitSizePropertyCache()
String
getName()
org.xwiki.cache.Cache<Boolean>
getPageExistCache()
QueryManager
getQueryManager()
XWikiStoreInterface
getStore()
List<String>
getTranslationList(XWikiDocument doc, XWikiContext context)
void
initCache(int capacity, int pageExistCacheCapacity, XWikiContext context)
Deprecated.void
initCache(XWikiContext context)
Deprecated.void
initialize()
boolean
injectCustomMapping(BaseClass doc1class, XWikiContext context)
boolean
injectCustomMappings(XWikiDocument doc, XWikiContext context)
void
injectCustomMappings(XWikiContext context)
void
injectUpdatedCustomMappings(XWikiContext context)
boolean
isCustomMappingValid(BaseClass bclass, String custommapping1, XWikiContext context)
boolean
isWikiNameAvailable(String wikiName, XWikiContext context)
Indicate if the provided wiki name could be used to create a new wiki.List<String>
loadBacklinks(String fullName, XWikiContext context, boolean bTransaction)
Deprecated.List<DocumentReference>
loadBacklinks(AttachmentReference attachmentReference, boolean bTransaction, XWikiContext context)
Deprecated.List<DocumentReference>
loadBacklinks(DocumentReference documentReference, boolean bTransaction, XWikiContext context)
Deprecated.List<XWikiLink>
loadLinks(long docId, XWikiContext context, boolean bTransaction)
Deprecated.XWikiLock
loadLock(long docId, XWikiContext context, boolean bTransaction)
XWikiDocument
loadXWikiDoc(XWikiDocument doc, XWikiContext inputxcontext)
void
onEvent(Event event, Object source, Object data)
void
renameXWikiDoc(XWikiDocument doc, DocumentReference newReference, XWikiContext inputxcontext)
Atomic operation for renaming a document.void
saveLinks(XWikiDocument doc, XWikiContext context, boolean bTransaction)
Deprecated.void
saveLock(XWikiLock lock, XWikiContext context, boolean bTransaction)
void
saveXWikiDoc(XWikiDocument doc, XWikiContext context)
void
saveXWikiDoc(XWikiDocument doc, XWikiContext inputxcontext, boolean bTransaction)
<T> List<T>
search(String sql, int nb, int start, XWikiContext context)
Execute a reading request and return result.<T> List<T>
search(String sql, int nb, int start, Object[][] whereParams, XWikiContext context)
Execute a reading request and return result.<T> List<T>
search(String sql, int nb, int start, Object[][] whereParams, List<?> parameterValues, XWikiContext context)
Execute a reading request with parameters and return result.<T> List<T>
search(String sql, int nb, int start, List<?> parameterValues, XWikiContext context)
Execute a reading request with parameters and return result.List<DocumentReference>
searchDocumentReferences(String wheresql, int nb, int start, XWikiContext context)
List<DocumentReference>
searchDocumentReferences(String wheresql, int nb, int start, String selectColumns, XWikiContext context)
List<DocumentReference>
searchDocumentReferences(String parametrizedSqlClause, int nb, int start, List<?> parameterValues, XWikiContext context)
Search documents by passing HQL where clause values as parameters.List<DocumentReference>
searchDocumentReferences(String wheresql, XWikiContext context)
List<DocumentReference>
searchDocumentReferences(String parametrizedSqlClause, List<?> parameterValues, XWikiContext context)
Same asXWikiStoreInterface.searchDocumentReferences(String, int, int, List, XWikiContext)
but returns all rows.List<XWikiDocument>
searchDocuments(String wheresql, boolean distinctbyname, boolean customMapping, boolean checkRight, int nb, int start, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, boolean distinctbylanguage, boolean customMapping, boolean checkRight, int nb, int start, List<?> parameterValues, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, boolean distinctbyname, boolean customMapping, int nb, int start, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, boolean distinctbylanguage, boolean customMapping, int nb, int start, List<?> parameterValues, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, boolean distinctbyname, boolean customMapping, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, boolean distinctbyname, int nb, int start, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, boolean distinctbylanguage, int nb, int start, List<?> parameterValues, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, boolean distinctbyname, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, int nb, int start, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, int nb, int start, List<?> parameterValues, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, XWikiContext context)
Search documents in the storing system.List<XWikiDocument>
searchDocuments(String wheresql, List<?> parameterValues, XWikiContext context)
Search documents in the storing system.List<String>
searchDocumentsNames(String wheresql, int nb, int start, XWikiContext context)
List<String>
searchDocumentsNames(String wheresql, int nb, int start, String selectColumns, XWikiContext context)
List<String>
searchDocumentsNames(String parametrizedSqlClause, int nb, int start, List<?> parameterValues, XWikiContext context)
List<String>
searchDocumentsNames(String wheresql, XWikiContext context)
List<String>
searchDocumentsNames(String parametrizedSqlClause, List<?> parameterValues, XWikiContext context)
void
setCache(org.xwiki.cache.Cache<XWikiDocument> cache)
void
setPageExistCache(org.xwiki.cache.Cache<Boolean> pageExistCache)
void
setStore(XWikiStoreInterface store)
-
Methods inherited from class com.xpn.xwiki.internal.store.AbstractXWikiStore
getExecutionXContext, restoreExecutionXContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.xpn.xwiki.store.XWikiStoreInterface
injectCustomMapping, isCustomMappingValid
-
-
-
-
Constructor Detail
-
XWikiCacheStore
public XWikiCacheStore()
Default constructor generally used by the Component Manager.
-
XWikiCacheStore
public XWikiCacheStore(XWikiStoreInterface store, XWikiContext context) throws XWikiException
Deprecated.since 10.2 and 9.11.4, should be used as a component instead- Throws:
XWikiException
-
-
Method Detail
-
initialize
public void initialize() throws org.xwiki.component.phase.InitializationException
- Specified by:
initialize
in interfaceorg.xwiki.component.phase.Initializable
- Throws:
org.xwiki.component.phase.InitializationException
-
getName
public String getName()
- Specified by:
getName
in interfaceorg.xwiki.observation.EventListener
-
getEvents
public List<Event> getEvents()
- Specified by:
getEvents
in interfaceorg.xwiki.observation.EventListener
-
initCache
@Deprecated public void initCache(XWikiContext context) throws XWikiException
Deprecated.- Throws:
XWikiException
-
initCache
@Deprecated public void initCache(int capacity, int pageExistCacheCapacity, XWikiContext context) throws XWikiException
Deprecated.- Specified by:
initCache
in interfaceXWikiCacheStoreInterface
- Throws:
XWikiException
-
getStore
public XWikiStoreInterface getStore()
- Specified by:
getStore
in interfaceXWikiCacheStoreInterface
-
setStore
public void setStore(XWikiStoreInterface store)
- Specified by:
setStore
in interfaceXWikiCacheStoreInterface
-
saveXWikiDoc
public void saveXWikiDoc(XWikiDocument doc, XWikiContext context) throws XWikiException
- Specified by:
saveXWikiDoc
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
renameXWikiDoc
public void renameXWikiDoc(XWikiDocument doc, DocumentReference newReference, XWikiContext inputxcontext) throws XWikiException
Description copied from interface:XWikiStoreInterface
Atomic operation for renaming a document. This operation will rename the document in DB by performing updates in all tables the document name is used.- Specified by:
renameXWikiDoc
in interfaceXWikiStoreInterface
- Parameters:
doc
- the actual document instance to rename.newReference
- the new reference to use for renaming.inputxcontext
- the current context.- Throws:
XWikiException
- in case of problem during the rename.
-
saveXWikiDoc
public void saveXWikiDoc(XWikiDocument doc, XWikiContext inputxcontext, boolean bTransaction) throws XWikiException
- Specified by:
saveXWikiDoc
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
flushCache
public void flushCache()
- Specified by:
flushCache
in interfaceXWikiCacheStoreInterface
-
onEvent
public void onEvent(Event event, Object source, Object data)
- Specified by:
onEvent
in interfaceorg.xwiki.observation.EventListener
-
getKey
@Deprecated public String getKey(XWikiDocument doc)
Deprecated.since 4.0M1, useXWikiDocument.getKey()
-
getKey
public String getKey(XWikiDocument doc, XWikiContext context)
-
getKey
@Deprecated public String getKey(String fullName, String language, XWikiContext context)
Deprecated.since 4.0M1, useXWikiDocument.getKey()
-
getKey
@Deprecated public String getKey(String wiki, String fullName, String language)
Deprecated.since 4.0M1, useXWikiDocument.getKey()
-
loadXWikiDoc
public XWikiDocument loadXWikiDoc(XWikiDocument doc, XWikiContext inputxcontext) throws XWikiException
- Specified by:
loadXWikiDoc
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
deleteXWikiDoc
public void deleteXWikiDoc(XWikiDocument doc, XWikiContext inputxcontext) throws XWikiException
- Specified by:
deleteXWikiDoc
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
getClassList
public List<String> getClassList(XWikiContext context) throws XWikiException
- Specified by:
getClassList
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
countDocuments
public int countDocuments(String wheresql, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
API allowing to count the total number of documents that would be returned by a query.- Specified by:
countDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- Query to use, similar to the ones accepted byXWikiStoreInterface.searchDocuments(String, XWikiContext)
. It should not containorder by
orgroup
clauses, since this kind of queries are not portable.context
- The current request context.- Returns:
- The number of documents that matched the query.
- Throws:
XWikiException
- if there was a problem executing the query.
-
searchDocumentReferences
public List<DocumentReference> searchDocumentReferences(String wheresql, XWikiContext context) throws XWikiException
- Specified by:
searchDocumentReferences
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
searchDocumentsNames
public List<String> searchDocumentsNames(String wheresql, XWikiContext context) throws XWikiException
- Specified by:
searchDocumentsNames
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
searchDocumentReferences
public List<DocumentReference> searchDocumentReferences(String wheresql, int nb, int start, XWikiContext context) throws XWikiException
- Specified by:
searchDocumentReferences
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
searchDocumentsNames
public List<String> searchDocumentsNames(String wheresql, int nb, int start, XWikiContext context) throws XWikiException
- Specified by:
searchDocumentsNames
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
searchDocumentReferences
public List<DocumentReference> searchDocumentReferences(String wheresql, int nb, int start, String selectColumns, XWikiContext context) throws XWikiException
- Specified by:
searchDocumentReferences
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
searchDocumentsNames
public List<String> searchDocumentsNames(String wheresql, int nb, int start, String selectColumns, XWikiContext context) throws XWikiException
- Specified by:
searchDocumentsNames
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
searchDocumentReferences
public List<DocumentReference> searchDocumentReferences(String parametrizedSqlClause, int nb, int start, List<?> parameterValues, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which will automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the other similar methods where the values are passed inside the where clause and for which you'll need to do the encoding/escaping yourself before calling them.Example:
#set($orphans = $xwiki.searchDocuments(" where doc.fullName <> ?1 and (doc.parent = ?2 or " + "(doc.parent = ?3 and doc.space = ?4))", ["${doc.fullName}as", ${doc.fullName}, ${doc.name}, ${doc.space}]))
- Specified by:
searchDocumentReferences
in interfaceXWikiStoreInterface
- Parameters:
parametrizedSqlClause
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
nb
- the number of rows to return. If 0 then all rows are returnedstart
- the number of rows to skip. If 0 don't skip any rowparameterValues
- the where clause values that replace the question marks (?)context
- the XWiki context required for getting information about the execution context- Returns:
- a list of document references
- Throws:
XWikiException
- in case of error while performing the query
-
searchDocumentsNames
public List<String> searchDocumentsNames(String parametrizedSqlClause, int nb, int start, List<?> parameterValues, XWikiContext context) throws XWikiException
- Specified by:
searchDocumentsNames
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
searchDocumentReferences
public List<DocumentReference> searchDocumentReferences(String parametrizedSqlClause, List<?> parameterValues, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Same asXWikiStoreInterface.searchDocumentReferences(String, int, int, List, XWikiContext)
but returns all rows.- Specified by:
searchDocumentReferences
in interfaceXWikiStoreInterface
- Throws:
XWikiException
- See Also:
XWikiStoreInterface.searchDocumentReferences(String, int, int, java.util.List, com.xpn.xwiki.XWikiContext)
-
searchDocumentsNames
public List<String> searchDocumentsNames(String parametrizedSqlClause, List<?> parameterValues, XWikiContext context) throws XWikiException
- Specified by:
searchDocumentsNames
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
isCustomMappingValid
public boolean isCustomMappingValid(BaseClass bclass, String custommapping1, XWikiContext context) throws XWikiException
- Specified by:
isCustomMappingValid
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
injectCustomMapping
public boolean injectCustomMapping(BaseClass doc1class, XWikiContext context) throws XWikiException
- Specified by:
injectCustomMapping
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
injectCustomMappings
public boolean injectCustomMappings(XWikiDocument doc, XWikiContext context) throws XWikiException
- Specified by:
injectCustomMappings
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbyname, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
distinctbyname
- when a document has multiple version for each language it is returned as one document a language.context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbyname, boolean customMapping, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
distinctbyname
- when a document has multiple version for each language it is returned as one document a language.customMapping
- inject custom mapping in session.context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbyname, int nb, int start, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
distinctbyname
- when a document has multiple version for each language it is returned as one document a language.nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbyname, boolean customMapping, int nb, int start, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
distinctbyname
- when a document has multiple version for each language it is returned as one document a language.customMapping
- inject custom mapping in session.nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, int nb, int start, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbyname, boolean customMapping, boolean checkRight, int nb, int start, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
distinctbyname
- when a document has multiple version for each language it is returned as one document a language.customMapping
- inject custom mapping in session.checkRight
- if true check for each found document if context's user has "view" rights for it.nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, int nb, int start, List<?> parameterValues, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
distinctbylanguage
- when a document has multiple version for each language it is returned as one document a language.nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.parameterValues
- the where clause values that replace the question marks (?).context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, List<?> parameterValues, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which will automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the other similar methods where the values are passed inside the where clause and for which you'll need to do the encoding/escpaing yourself before calling them.
- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
parameterValues
- the where clause values that replace the question marks (?).context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, boolean customMapping, int nb, int start, List<?> parameterValues, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which will automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the other similar methods where the values are passed inside the where clause and for which you'll need to do the encoding/escpaing yourself before calling them.
- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
distinctbylanguage
- when a document has multiple version for each language it is returned as one document a language.customMapping
- inject custom mapping in session.nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.parameterValues
- the where clause values that replace the question marks (?).context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, int nb, int start, List<?> parameterValues, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which will automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the other similar methods where the values are passed inside the where clause and for which you'll need to do the encoding/escpaing yourself before calling them.
- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.parameterValues
- the where clause values that replace the question marks (?).context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
searchDocuments
public List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, boolean customMapping, boolean checkRight, int nb, int start, List<?> parameterValues, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Search documents in the storing system.Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which will automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the other similar methods where the values are passed inside the where clause and for which you'll need to do the encoding/escpaing yourself before calling them.
- Specified by:
searchDocuments
in interfaceXWikiStoreInterface
- Parameters:
wheresql
- the HQL where clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
distinctbylanguage
- when a document has multiple version for each language it is returned as one document a language.customMapping
- inject custom mapping in session.checkRight
- if true check for each found document if context's user has "view" rights for it.nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.parameterValues
- the where clause values that replace the question marks (?).context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
countDocuments
public int countDocuments(String parametrizedSqlClause, List<?> parameterValues, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
API allowing to count the total number of documents that would be returned by a parameterized query.- Specified by:
countDocuments
in interfaceXWikiStoreInterface
- Parameters:
parametrizedSqlClause
- Parameterized query to use, similar to the ones accepted byXWikiStoreInterface.searchDocuments(String, List, XWikiContext)
. It should not containorder by
orgroup
clauses, since this kind of queries are not portable.parameterValues
- The parameter values that replace the question marks.context
- The current request context.- Returns:
- The number of documents that matched the query.
- Throws:
XWikiException
- if there was a problem executing the query.
-
loadLock
public XWikiLock loadLock(long docId, XWikiContext context, boolean bTransaction) throws XWikiException
- Specified by:
loadLock
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
saveLock
public void saveLock(XWikiLock lock, XWikiContext context, boolean bTransaction) throws XWikiException
- Specified by:
saveLock
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
deleteLock
public void deleteLock(XWikiLock lock, XWikiContext context, boolean bTransaction) throws XWikiException
- Specified by:
deleteLock
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
loadLinks
@Deprecated(since="14.8RC1") public List<XWikiLink> loadLinks(long docId, XWikiContext context, boolean bTransaction) throws XWikiException
Deprecated.- Specified by:
loadLinks
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
loadBacklinks
@Deprecated(since="14.8RC1") public List<DocumentReference> loadBacklinks(DocumentReference documentReference, boolean bTransaction, XWikiContext context) throws XWikiException
Deprecated.Description copied from interface:XWikiStoreInterface
Returns the backlinks for the given document reference.- Specified by:
loadBacklinks
in interfaceXWikiStoreInterface
- Parameters:
documentReference
- the document reference to search backlinks forbTransaction
-true
if a transaction must be createcontext
- the current context- Throws:
XWikiException
-
loadBacklinks
@Deprecated(since="14.8RC1") public List<DocumentReference> loadBacklinks(AttachmentReference attachmentReference, boolean bTransaction, XWikiContext context) throws XWikiException
Deprecated.Description copied from interface:XWikiStoreInterface
Returns the backlinks for the given attachment reference.- Specified by:
loadBacklinks
in interfaceXWikiStoreInterface
- Parameters:
attachmentReference
- the attachment reference to search backlinks forbTransaction
-true
if a transaction must be createcontext
- the current context- Throws:
XWikiException
-
loadBacklinks
@Deprecated(since="2.2M2") public List<String> loadBacklinks(String fullName, XWikiContext context, boolean bTransaction) throws XWikiException
Deprecated.- Specified by:
loadBacklinks
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
saveLinks
@Deprecated(since="14.8RC1") public void saveLinks(XWikiDocument doc, XWikiContext context, boolean bTransaction) throws XWikiException
Deprecated.- Specified by:
saveLinks
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
deleteLinks
@Deprecated(since="14.8RC1") public void deleteLinks(long docId, XWikiContext context, boolean bTransaction) throws XWikiException
Deprecated.- Specified by:
deleteLinks
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
search
public <T> List<T> search(String sql, int nb, int start, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Execute a reading request and return result.- Specified by:
search
in interfaceXWikiStoreInterface
- Parameters:
sql
- the HQL request clause. For example:where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
search
public <T> List<T> search(String sql, int nb, int start, Object[][] whereParams, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Execute a reading request and return result.- Specified by:
search
in interfaceXWikiStoreInterface
- Parameters:
sql
- the HQL request.nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.whereParams
- if not null add tosql
a where clause based on a table of table containing field name, field value and compared symbol (=
,>
, etc.).context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
search
public <T> List<T> search(String sql, int nb, int start, List<?> parameterValues, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Execute a reading request with parameters and return result.Execute query by passing HQL request values as parameters. This allows generating a Named HQL query which will automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the other similar methods where the values are passed inside the where clause and for which you'll need to do the encoding/escaping yourself before calling them.
- Specified by:
search
in interfaceXWikiStoreInterface
- Parameters:
sql
- the HQL request.nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.parameterValues
- the where clause values that replace the question marks (?).context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
search
public <T> List<T> search(String sql, int nb, int start, Object[][] whereParams, List<?> parameterValues, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Execute a reading request with parameters and return result.Execute query by passing HQL request values as parameters. This allows generating a Named HQL query which will automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the other similar methods where the values are passed inside the where clause and for which you'll need to do the encoding/escaping yourself before calling them.
- Specified by:
search
in interfaceXWikiStoreInterface
- Parameters:
sql
- the HQL request.nb
- the number of rows to return. If 0 then all rows are returned.start
- the number of rows to skip. If 0 don't skip any row.whereParams
- if not null add tosql
a where clause based on a table of table containing field name, field value and compared symbol (=
,>
, etc.).parameterValues
- the where clause values that replace the question marks (?).context
- the XWiki context required for getting information about the execution context.- Returns:
- a list of XWikiDocument.
- Throws:
XWikiException
- in case of error while performing the query.
-
cleanUp
public void cleanUp(XWikiContext context)
- Specified by:
cleanUp
in interfaceXWikiStoreInterface
-
isWikiNameAvailable
public boolean isWikiNameAvailable(String wikiName, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Indicate if the provided wiki name could be used to create a new wiki.- Specified by:
isWikiNameAvailable
in interfaceXWikiStoreInterface
- Parameters:
wikiName
- the name of the wiki.context
- the XWiki context.- Returns:
- true if the name is already used, false otherwise.
- Throws:
XWikiException
- error when looking if wiki name already used.
-
createWiki
public void createWiki(String wikiName, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Allows to create a new wiki database and initialize the default tables.- Specified by:
createWiki
in interfaceXWikiStoreInterface
- Parameters:
wikiName
- the name of the new wiki.context
- the XWiki context.- Throws:
XWikiException
- error when creating new wiki.
-
deleteWiki
public void deleteWiki(String wikiName, XWikiContext context) throws XWikiException
Description copied from interface:XWikiStoreInterface
Delete a wiki database.- Specified by:
deleteWiki
in interfaceXWikiStoreInterface
- Parameters:
wikiName
- the name of the wiki.context
- the XWiki context.- Throws:
XWikiException
- error when deleting wiki database.
-
exists
public boolean exists(XWikiDocument doc, XWikiContext inputxcontext) throws XWikiException
- Specified by:
exists
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
getCache
public org.xwiki.cache.Cache<XWikiDocument> getCache()
-
setCache
public void setCache(org.xwiki.cache.Cache<XWikiDocument> cache)
-
getPageExistCache
public org.xwiki.cache.Cache<Boolean> getPageExistCache()
-
setPageExistCache
public void setPageExistCache(org.xwiki.cache.Cache<Boolean> pageExistCache)
-
getLimitSizePropertyCache
public org.xwiki.cache.Cache<Integer> getLimitSizePropertyCache()
- Returns:
- the cache that handle the limit size properties.
- Since:
- 11.4RC1
-
getCustomMappingPropertyList
public List<String> getCustomMappingPropertyList(BaseClass bclass)
- Specified by:
getCustomMappingPropertyList
in interfaceXWikiStoreInterface
-
injectCustomMappings
public void injectCustomMappings(XWikiContext context) throws XWikiException
- Specified by:
injectCustomMappings
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
injectUpdatedCustomMappings
public void injectUpdatedCustomMappings(XWikiContext context) throws XWikiException
- Specified by:
injectUpdatedCustomMappings
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
getTranslationList
public List<String> getTranslationList(XWikiDocument doc, XWikiContext context) throws XWikiException
- Specified by:
getTranslationList
in interfaceXWikiStoreInterface
- Throws:
XWikiException
-
getQueryManager
public QueryManager getQueryManager()
- Specified by:
getQueryManager
in interfaceXWikiStoreInterface
- Returns:
- QueryManager used for creating queries to store. Use QueryManager instead of #search* methods because it is more abstract from store implementation and support multiple query languages.
-
getLimitSize
public int getLimitSize(XWikiContext context, Class<?> entityType, String propertyName)
Description copied from interface:XWikiStoreInterface
Get the limit size of a property.- Specified by:
getLimitSize
in interfaceXWikiStoreInterface
- Parameters:
context
- the context of the wiki to retrieve the propertyentityType
- the entityType where the property is located.propertyName
- the property on which we want the limit size.- Returns:
- an integer representing the limit size.
-
-