Interface XWikiStoreInterface

    • Method Detail

      • renameXWikiDoc

        default void renameXWikiDoc​(XWikiDocument doc,
                                    DocumentReference newReference,
                                    XWikiContext context)
                             throws XWikiException
        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.
        Parameters:
        doc - the actual document instance to rename.
        newReference - the new reference to use for renaming.
        context - the current context.
        Throws:
        XWikiException - in case of problem during the rename.
        Since:
        12.5RC1
      • countDocuments

        int countDocuments​(String wheresql,
                           XWikiContext context)
                    throws XWikiException
        API allowing to count the total number of documents that would be returned by a query.
        Parameters:
        wheresql - Query to use, similar to the ones accepted by searchDocuments(String, XWikiContext). It should not contain order by or group 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

        List<DocumentReference> searchDocumentReferences​(String parametrizedSqlClause,
                                                         int nb,
                                                         int start,
                                                         List<?> parameterValues,
                                                         XWikiContext context)
                                                  throws XWikiException
        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}]))
         
         
        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 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 document references
        Throws:
        XWikiException - in case of error while performing the query
        Since:
        2.2M1
      • countDocuments

        int countDocuments​(String parametrizedSqlClause,
                           List<?> parameterValues,
                           XWikiContext context)
                    throws XWikiException
        API allowing to count the total number of documents that would be returned by a parameterized query.
        Parameters:
        parametrizedSqlClause - Parameterized query to use, similar to the ones accepted by searchDocuments(String, List, XWikiContext). It should not contain order by or group 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.
      • searchDocuments

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            boolean distinctbylanguage,
                                            XWikiContext context)
                                     throws XWikiException
        Search documents in the storing system.
        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.
        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

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            int nb,
                                            int start,
                                            XWikiContext context)
                                     throws XWikiException
        Search documents in the storing system.
        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

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            boolean distinctbylanguage,
                                            boolean customMapping,
                                            XWikiContext context)
                                     throws XWikiException
        Search documents in the storing system.
        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.
        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

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            boolean distinctbylanguage,
                                            int nb,
                                            int start,
                                            XWikiContext context)
                                     throws XWikiException
        Search documents in the storing system.
        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.
        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

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            boolean distinctbylanguage,
                                            int nb,
                                            int start,
                                            List<?> parameterValues,
                                            XWikiContext context)
                                     throws XWikiException
        Search documents in the storing system.
        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.
        Since:
        1.1.2, 1.2M2
      • searchDocuments

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            boolean distinctbylanguage,
                                            boolean customMapping,
                                            int nb,
                                            int start,
                                            XWikiContext context)
                                     throws XWikiException
        Search documents in the storing system.
        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.
        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

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            XWikiContext context)
                                     throws XWikiException
        Search documents in the storing system.
        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

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            boolean distinctbylanguage,
                                            boolean customMapping,
                                            boolean checkRight,
                                            int nb,
                                            int start,
                                            XWikiContext context)
                                     throws XWikiException
        Search documents in the storing system.
        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.
        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

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            List<?> parameterValues,
                                            XWikiContext context)
                                     throws XWikiException
        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.

        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.
        Since:
        1.1.2, 1.2M2
      • searchDocuments

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            boolean distinctbylanguage,
                                            boolean customMapping,
                                            int nb,
                                            int start,
                                            List<?> parameterValues,
                                            XWikiContext context)
                                     throws XWikiException
        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.

        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.
        Since:
        1.1.2, 1.2M2
      • searchDocuments

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            int nb,
                                            int start,
                                            List<?> parameterValues,
                                            XWikiContext context)
                                     throws XWikiException
        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.

        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.
        Since:
        1.1.2, 1.2M2
      • searchDocuments

        List<XWikiDocument> searchDocuments​(String wheresql,
                                            boolean distinctbylanguage,
                                            boolean customMapping,
                                            boolean checkRight,
                                            int nb,
                                            int start,
                                            List<?> parameterValues,
                                            XWikiContext context)
                                     throws XWikiException
        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.

        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.
        Since:
        1.1.2, 1.2M2
      • search

        <T> List<T> search​(String sql,
                           int nb,
                           int start,
                           XWikiContext context)
                    throws XWikiException
        Execute a reading request and return result.
        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

        <T> List<T> search​(String sql,
                           int nb,
                           int start,
                           List<?> parameterValues,
                           XWikiContext context)
                    throws XWikiException
        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.

        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.
        Since:
        1.1.2, 1.2M2
      • search

        <T> List<T> search​(String sql,
                           int nb,
                           int start,
                           Object[][] whereParams,
                           XWikiContext context)
                    throws XWikiException
        Execute a reading request and return result.
        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 to sql 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

        <T> List<T> search​(String sql,
                           int nb,
                           int start,
                           Object[][] whereParams,
                           List<?> parameterValues,
                           XWikiContext context)
                    throws XWikiException
        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.

        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 to sql 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.
        Since:
        1.1.2, 1.2M2
      • isWikiNameAvailable

        boolean isWikiNameAvailable​(String wikiName,
                                    XWikiContext context)
                             throws XWikiException
        Indicate if the provided wiki name could be used to create a new wiki.
        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

        void createWiki​(String wikiName,
                        XWikiContext context)
                 throws XWikiException
        Allows to create a new wiki database and initialize the default tables.
        Parameters:
        wikiName - the name of the new wiki.
        context - the XWiki context.
        Throws:
        XWikiException - error when creating new wiki.
      • deleteWiki

        void deleteWiki​(String wikiName,
                        XWikiContext context)
                 throws XWikiException
        Delete a wiki database.
        Parameters:
        wikiName - the name of the wiki.
        context - the XWiki context.
        Throws:
        XWikiException - error when deleting wiki database.
      • isCustomMappingValid

        default boolean isCustomMappingValid​(BaseClass bclass,
                                             String custommapping1)
        Since:
        11.5RC1
      • getCustomMappingPropertyList

        List<String> getCustomMappingPropertyList​(BaseClass bclass)
      • getQueryManager

        QueryManager getQueryManager()
        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

        int getLimitSize​(XWikiContext context,
                         Class<?> entityType,
                         String property)
        Get the limit size of a property.
        Parameters:
        entityType - the entityType where the property is located.
        property - the property on which we want the limit size.
        context - the context of the wiki to retrieve the property
        Returns:
        an integer representing the limit size.
        Since:
        11.4RC1