| Class | Line # | Actions | |||||
|---|---|---|---|---|---|---|---|
| XWikiStoreInterface | 36 | 0 | - | 0 | 0 |
| 1 | /* | |
| 2 | * See the NOTICE file distributed with this work for additional | |
| 3 | * information regarding copyright ownership. | |
| 4 | * | |
| 5 | * This is free software; you can redistribute it and/or modify it | |
| 6 | * under the terms of the GNU Lesser General Public License as | |
| 7 | * published by the Free Software Foundation; either version 2.1 of | |
| 8 | * the License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This software is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | * Lesser General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU Lesser General Public | |
| 16 | * License along with this software; if not, write to the Free | |
| 17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
| 18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
| 19 | */ | |
| 20 | package com.xpn.xwiki.store; | |
| 21 | ||
| 22 | import java.util.List; | |
| 23 | ||
| 24 | import org.xwiki.component.annotation.Role; | |
| 25 | import org.xwiki.model.reference.DocumentReference; | |
| 26 | import org.xwiki.query.QueryManager; | |
| 27 | ||
| 28 | import com.xpn.xwiki.XWikiContext; | |
| 29 | import com.xpn.xwiki.XWikiException; | |
| 30 | import com.xpn.xwiki.doc.XWikiDocument; | |
| 31 | import com.xpn.xwiki.doc.XWikiLink; | |
| 32 | import com.xpn.xwiki.doc.XWikiLock; | |
| 33 | import com.xpn.xwiki.objects.classes.BaseClass; | |
| 34 | ||
| 35 | @Role | |
| 36 | public interface XWikiStoreInterface | |
| 37 | { | |
| 38 | void saveXWikiDoc(XWikiDocument doc, XWikiContext context) throws XWikiException; | |
| 39 | ||
| 40 | void saveXWikiDoc(XWikiDocument doc, XWikiContext context, boolean bTransaction) throws XWikiException; | |
| 41 | ||
| 42 | XWikiDocument loadXWikiDoc(XWikiDocument doc, XWikiContext context) throws XWikiException; | |
| 43 | ||
| 44 | void deleteXWikiDoc(XWikiDocument doc, XWikiContext context) throws XWikiException; | |
| 45 | ||
| 46 | List<String> getClassList(XWikiContext context) throws XWikiException; | |
| 47 | ||
| 48 | /** | |
| 49 | * API allowing to count the total number of documents that would be returned by a query. | |
| 50 | * | |
| 51 | * @param wheresql Query to use, similar to the ones accepted by {@link #searchDocuments(String, XWikiContext)}. It | |
| 52 | * should not contain {@code order by} or {@code group} clauses, since this kind of queries are | |
| 53 | * not portable. | |
| 54 | * @param context The current request context. | |
| 55 | * @return The number of documents that matched the query. | |
| 56 | * @throws XWikiException if there was a problem executing the query. | |
| 57 | */ | |
| 58 | int countDocuments(String wheresql, XWikiContext context) throws XWikiException; | |
| 59 | ||
| 60 | /** | |
| 61 | * @since 2.2M2 | |
| 62 | */ | |
| 63 | List<DocumentReference> searchDocumentReferences(String wheresql, XWikiContext context) throws XWikiException; | |
| 64 | ||
| 65 | /** | |
| 66 | * @deprecated since 2.2M2 use {@link #searchDocumentReferences(String, com.xpn.xwiki.XWikiContext)} | |
| 67 | */ | |
| 68 | @Deprecated | |
| 69 | List<String> searchDocumentsNames(String wheresql, XWikiContext context) throws XWikiException; | |
| 70 | ||
| 71 | /** | |
| 72 | * @since 2.2M2 | |
| 73 | */ | |
| 74 | List<DocumentReference> searchDocumentReferences(String wheresql, int nb, int start, XWikiContext context) | |
| 75 | throws XWikiException; | |
| 76 | ||
| 77 | /** | |
| 78 | * @deprecated since 2.2M2 use {@link #searchDocumentReferences(String, int, int, com.xpn.xwiki.XWikiContext)} | |
| 79 | */ | |
| 80 | @Deprecated | |
| 81 | List<String> searchDocumentsNames(String wheresql, int nb, int start, XWikiContext context) throws XWikiException; | |
| 82 | ||
| 83 | /** | |
| 84 | * @since 2.2M2 | |
| 85 | */ | |
| 86 | List<DocumentReference> searchDocumentReferences(String wheresql, int nb, int start, String selectColumns, | |
| 87 | XWikiContext context) throws XWikiException; | |
| 88 | ||
| 89 | /** | |
| 90 | * @deprecated since 2.2M2 use {@link #searchDocumentReferences(String, int, int, String, XWikiContext)} | |
| 91 | */ | |
| 92 | @Deprecated | |
| 93 | List<String> searchDocumentsNames(String wheresql, int nb, int start, String selectColumns, XWikiContext context) | |
| 94 | throws XWikiException; | |
| 95 | ||
| 96 | /** | |
| 97 | * Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which | |
| 98 | * will automatically encode the passed values (like escaping single quotes). This API is recommended to be used | |
| 99 | * over the other similar methods where the values are passed inside the where clause and for which you'll need to | |
| 100 | * do the encoding/escaping yourself before calling them. | |
| 101 | * <p> | |
| 102 | * Example: | |
| 103 | * <pre>{@code | |
| 104 | * #set($orphans = $xwiki.searchDocuments(" where doc.fullName <> ? and (doc.parent = ? or " | |
| 105 | * + "(doc.parent = ? and doc.space = ?))", | |
| 106 | * ["${doc.fullName}as", ${doc.fullName}, ${doc.name}, ${doc.space}])) | |
| 107 | * }</pre> | |
| 108 | * | |
| 109 | * @param parametrizedSqlClause the HQL where clause. For example: {@code where doc.fullName | |
| 110 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 111 | * @param nb the number of rows to return. If 0 then all rows are returned | |
| 112 | * @param start the number of rows to skip. If 0 don't skip any row | |
| 113 | * @param parameterValues the where clause values that replace the question marks (?) | |
| 114 | * @param context the XWiki context required for getting information about the execution context | |
| 115 | * @return a list of document references | |
| 116 | * @throws XWikiException in case of error while performing the query | |
| 117 | * @since 2.2M1 | |
| 118 | */ | |
| 119 | List<DocumentReference> searchDocumentReferences(String parametrizedSqlClause, int nb, int start, | |
| 120 | List<?> parameterValues, XWikiContext context) throws XWikiException; | |
| 121 | ||
| 122 | /** | |
| 123 | * @deprecated since 2.2M2 use {@link #searchDocumentReferences(String, int, int, List, XWikiContext)} | |
| 124 | */ | |
| 125 | @Deprecated | |
| 126 | List<String> searchDocumentsNames(String parametrizedSqlClause, int nb, int start, List<?> parameterValues, | |
| 127 | XWikiContext context) throws XWikiException; | |
| 128 | ||
| 129 | /** | |
| 130 | * Same as {@link #searchDocumentReferences(String, int, int, List, XWikiContext)} but returns all rows. | |
| 131 | * | |
| 132 | * @see #searchDocumentReferences(String, int, int, java.util.List, com.xpn.xwiki.XWikiContext) | |
| 133 | * @since 2.2M2 | |
| 134 | */ | |
| 135 | List<DocumentReference> searchDocumentReferences(String parametrizedSqlClause, List<?> parameterValues, | |
| 136 | XWikiContext context) throws XWikiException; | |
| 137 | ||
| 138 | /** | |
| 139 | * @deprecated since 2.2M2 use {@link #searchDocumentReferences(String, List, XWikiContext)} | |
| 140 | */ | |
| 141 | @Deprecated | |
| 142 | List<String> searchDocumentsNames(String parametrizedSqlClause, List<?> parameterValues, XWikiContext context) | |
| 143 | throws XWikiException; | |
| 144 | ||
| 145 | /** | |
| 146 | * API allowing to count the total number of documents that would be returned by a parameterized query. | |
| 147 | * | |
| 148 | * @param parametrizedSqlClause Parameterized query to use, similar to the ones accepted by | |
| 149 | * {@link #searchDocuments(String, List, XWikiContext)}. It should not contain {@code order by} or | |
| 150 | * {@code group} clauses, since this kind of queries are not portable. | |
| 151 | * @param parameterValues The parameter values that replace the question marks. | |
| 152 | * @return The number of documents that matched the query. | |
| 153 | * @param context The current request context. | |
| 154 | * @throws XWikiException if there was a problem executing the query. | |
| 155 | */ | |
| 156 | int countDocuments(String parametrizedSqlClause, List<?> parameterValues, XWikiContext context) | |
| 157 | throws XWikiException; | |
| 158 | ||
| 159 | /** | |
| 160 | * Search documents in the storing system. | |
| 161 | * | |
| 162 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 163 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 164 | * @param distinctbylanguage when a document has multiple version for each language it is returned as one document a | |
| 165 | * language. | |
| 166 | * @param context the XWiki context required for getting information about the execution context. | |
| 167 | * @return a list of XWikiDocument. | |
| 168 | * @throws XWikiException in case of error while performing the query. | |
| 169 | */ | |
| 170 | List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, XWikiContext context) | |
| 171 | throws XWikiException; | |
| 172 | ||
| 173 | /** | |
| 174 | * Search documents in the storing system. | |
| 175 | * | |
| 176 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 177 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 178 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 179 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 180 | * @param context the XWiki context required for getting information about the execution context. | |
| 181 | * @return a list of XWikiDocument. | |
| 182 | * @throws XWikiException in case of error while performing the query. | |
| 183 | */ | |
| 184 | List<XWikiDocument> searchDocuments(String wheresql, int nb, int start, XWikiContext context) throws XWikiException; | |
| 185 | ||
| 186 | /** | |
| 187 | * Search documents in the storing system. | |
| 188 | * | |
| 189 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 190 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 191 | * @param distinctbylanguage when a document has multiple version for each language it is returned as one document a | |
| 192 | * language. | |
| 193 | * @param customMapping inject custom mapping in session. | |
| 194 | * @param context the XWiki context required for getting information about the execution context. | |
| 195 | * @return a list of XWikiDocument. | |
| 196 | * @throws XWikiException in case of error while performing the query. | |
| 197 | */ | |
| 198 | List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, boolean customMapping, | |
| 199 | XWikiContext context) throws XWikiException; | |
| 200 | ||
| 201 | /** | |
| 202 | * Search documents in the storing system. | |
| 203 | * | |
| 204 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 205 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 206 | * @param distinctbylanguage when a document has multiple version for each language it is returned as one document a | |
| 207 | * language. | |
| 208 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 209 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 210 | * @param context the XWiki context required for getting information about the execution context. | |
| 211 | * @return a list of XWikiDocument. | |
| 212 | * @throws XWikiException in case of error while performing the query. | |
| 213 | */ | |
| 214 | List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, int nb, int start, | |
| 215 | XWikiContext context) throws XWikiException; | |
| 216 | ||
| 217 | /** | |
| 218 | * Search documents in the storing system. | |
| 219 | * | |
| 220 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 221 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 222 | * @param distinctbylanguage when a document has multiple version for each language it is returned as one document a | |
| 223 | * language. | |
| 224 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 225 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 226 | * @param parameterValues the where clause values that replace the question marks (?). | |
| 227 | * @param context the XWiki context required for getting information about the execution context. | |
| 228 | * @return a list of XWikiDocument. | |
| 229 | * @throws XWikiException in case of error while performing the query. | |
| 230 | * @since 1.1.2 | |
| 231 | * @since 1.2M2 | |
| 232 | */ | |
| 233 | List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, int nb, int start, | |
| 234 | List<?> parameterValues, XWikiContext context) throws XWikiException; | |
| 235 | ||
| 236 | /** | |
| 237 | * Search documents in the storing system. | |
| 238 | * | |
| 239 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 240 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 241 | * @param distinctbylanguage when a document has multiple version for each language it is returned as one document a | |
| 242 | * language. | |
| 243 | * @param customMapping inject custom mapping in session. | |
| 244 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 245 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 246 | * @param context the XWiki context required for getting information about the execution context. | |
| 247 | * @return a list of XWikiDocument. | |
| 248 | * @throws XWikiException in case of error while performing the query. | |
| 249 | */ | |
| 250 | List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, boolean customMapping, int nb, | |
| 251 | int start, XWikiContext context) throws XWikiException; | |
| 252 | ||
| 253 | /** | |
| 254 | * Search documents in the storing system. | |
| 255 | * | |
| 256 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 257 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 258 | * @param context the XWiki context required for getting information about the execution context. | |
| 259 | * @return a list of XWikiDocument. | |
| 260 | * @throws XWikiException in case of error while performing the query. | |
| 261 | */ | |
| 262 | List<XWikiDocument> searchDocuments(String wheresql, XWikiContext context) throws XWikiException; | |
| 263 | ||
| 264 | /** | |
| 265 | * Search documents in the storing system. | |
| 266 | * | |
| 267 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 268 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 269 | * @param distinctbylanguage when a document has multiple version for each language it is returned as one document a | |
| 270 | * language. | |
| 271 | * @param customMapping inject custom mapping in session. | |
| 272 | * @param checkRight if true check for each found document if context's user has "view" rights for it. | |
| 273 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 274 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 275 | * @param context the XWiki context required for getting information about the execution context. | |
| 276 | * @return a list of XWikiDocument. | |
| 277 | * @throws XWikiException in case of error while performing the query. | |
| 278 | */ | |
| 279 | List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, boolean customMapping, | |
| 280 | boolean checkRight, int nb, int start, XWikiContext context) throws XWikiException; | |
| 281 | ||
| 282 | /** | |
| 283 | * Search documents in the storing system. | |
| 284 | * <p> | |
| 285 | * Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which | |
| 286 | * will automatically encode the passed values (like escaping single quotes). This API is recommended to be used | |
| 287 | * over the other similar methods where the values are passed inside the where clause and for which you'll need to | |
| 288 | * do the encoding/escpaing yourself before calling them. | |
| 289 | * | |
| 290 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 291 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 292 | * @param parameterValues the where clause values that replace the question marks (?). | |
| 293 | * @param context the XWiki context required for getting information about the execution context. | |
| 294 | * @return a list of XWikiDocument. | |
| 295 | * @throws XWikiException in case of error while performing the query. | |
| 296 | * @since 1.1.2 | |
| 297 | * @since 1.2M2 | |
| 298 | */ | |
| 299 | List<XWikiDocument> searchDocuments(String wheresql, List<?> parameterValues, XWikiContext context) | |
| 300 | throws XWikiException; | |
| 301 | ||
| 302 | /** | |
| 303 | * Search documents in the storing system. | |
| 304 | * <p> | |
| 305 | * Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which | |
| 306 | * will automatically encode the passed values (like escaping single quotes). This API is recommended to be used | |
| 307 | * over the other similar methods where the values are passed inside the where clause and for which you'll need to | |
| 308 | * do the encoding/escpaing yourself before calling them. | |
| 309 | * | |
| 310 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 311 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 312 | * @param distinctbylanguage when a document has multiple version for each language it is returned as one document a | |
| 313 | * language. | |
| 314 | * @param customMapping inject custom mapping in session. | |
| 315 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 316 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 317 | * @param parameterValues the where clause values that replace the question marks (?). | |
| 318 | * @param context the XWiki context required for getting information about the execution context. | |
| 319 | * @return a list of XWikiDocument. | |
| 320 | * @throws XWikiException in case of error while performing the query. | |
| 321 | * @since 1.1.2 | |
| 322 | * @since 1.2M2 | |
| 323 | */ | |
| 324 | List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, boolean customMapping, int nb, | |
| 325 | int start, List<?> parameterValues, XWikiContext context) throws XWikiException; | |
| 326 | ||
| 327 | /** | |
| 328 | * Search documents in the storing system. | |
| 329 | * <p> | |
| 330 | * Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which | |
| 331 | * will automatically encode the passed values (like escaping single quotes). This API is recommended to be used | |
| 332 | * over the other similar methods where the values are passed inside the where clause and for which you'll need to | |
| 333 | * do the encoding/escpaing yourself before calling them. | |
| 334 | * | |
| 335 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 336 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 337 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 338 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 339 | * @param parameterValues the where clause values that replace the question marks (?). | |
| 340 | * @param context the XWiki context required for getting information about the execution context. | |
| 341 | * @return a list of XWikiDocument. | |
| 342 | * @throws XWikiException in case of error while performing the query. | |
| 343 | * @since 1.1.2 | |
| 344 | * @since 1.2M2 | |
| 345 | */ | |
| 346 | List<XWikiDocument> searchDocuments(String wheresql, int nb, int start, List<?> parameterValues, | |
| 347 | XWikiContext context) throws XWikiException; | |
| 348 | ||
| 349 | /** | |
| 350 | * Search documents in the storing system. | |
| 351 | * <p> | |
| 352 | * Search documents by passing HQL where clause values as parameters. This allows generating a Named HQL query which | |
| 353 | * will automatically encode the passed values (like escaping single quotes). This API is recommended to be used | |
| 354 | * over the other similar methods where the values are passed inside the where clause and for which you'll need to | |
| 355 | * do the encoding/escpaing yourself before calling them. | |
| 356 | * | |
| 357 | * @param wheresql the HQL where clause. For example: {@code where doc.fullName | |
| 358 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 359 | * @param distinctbylanguage when a document has multiple version for each language it is returned as one document a | |
| 360 | * language. | |
| 361 | * @param customMapping inject custom mapping in session. | |
| 362 | * @param checkRight if true check for each found document if context's user has "view" rights for it. | |
| 363 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 364 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 365 | * @param parameterValues the where clause values that replace the question marks (?). | |
| 366 | * @param context the XWiki context required for getting information about the execution context. | |
| 367 | * @return a list of XWikiDocument. | |
| 368 | * @throws XWikiException in case of error while performing the query. | |
| 369 | * @since 1.1.2 | |
| 370 | * @since 1.2M2 | |
| 371 | */ | |
| 372 | List<XWikiDocument> searchDocuments(String wheresql, boolean distinctbylanguage, boolean customMapping, | |
| 373 | boolean checkRight, int nb, int start, List<?> parameterValues, XWikiContext context) throws XWikiException; | |
| 374 | ||
| 375 | XWikiLock loadLock(long docId, XWikiContext context, boolean bTransaction) throws XWikiException; | |
| 376 | ||
| 377 | void saveLock(XWikiLock lock, XWikiContext context, boolean bTransaction) throws XWikiException; | |
| 378 | ||
| 379 | void deleteLock(XWikiLock lock, XWikiContext context, boolean bTransaction) throws XWikiException; | |
| 380 | ||
| 381 | List<XWikiLink> loadLinks(long docId, XWikiContext context, boolean bTransaction) throws XWikiException; | |
| 382 | ||
| 383 | /** | |
| 384 | * @since 2.2M2 | |
| 385 | */ | |
| 386 | List<DocumentReference> loadBacklinks(DocumentReference documentReference, boolean bTransaction, | |
| 387 | XWikiContext context) throws XWikiException; | |
| 388 | ||
| 389 | /** | |
| 390 | * @deprecated since 2.2M2 use {@link #loadBacklinks(DocumentReference, boolean, XWikiContext)} | |
| 391 | */ | |
| 392 | @Deprecated | |
| 393 | List<String> loadBacklinks(String fullName, XWikiContext context, boolean bTransaction) throws XWikiException; | |
| 394 | ||
| 395 | void saveLinks(XWikiDocument doc, XWikiContext context, boolean bTransaction) throws XWikiException; | |
| 396 | ||
| 397 | void deleteLinks(long docId, XWikiContext context, boolean bTransaction) throws XWikiException; | |
| 398 | ||
| 399 | /** | |
| 400 | * Execute a reading request and return result. | |
| 401 | * | |
| 402 | * @param sql the HQL request clause. For example: {@code where doc.fullName | |
| 403 | * <> ? and (doc.parent = ? or (doc.parent = ? and doc.space = ?))} | |
| 404 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 405 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 406 | * @param context the XWiki context required for getting information about the execution context. | |
| 407 | * @return a list of XWikiDocument. | |
| 408 | * @throws XWikiException in case of error while performing the query. | |
| 409 | */ | |
| 410 | <T> List<T> search(String sql, int nb, int start, XWikiContext context) throws XWikiException; | |
| 411 | ||
| 412 | /** | |
| 413 | * Execute a reading request with parameters and return result. | |
| 414 | * <p> | |
| 415 | * Execute query by passing HQL request values as parameters. This allows generating a Named HQL query which will | |
| 416 | * automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the | |
| 417 | * other similar methods where the values are passed inside the where clause and for which you'll need to do the | |
| 418 | * encoding/escaping yourself before calling them. | |
| 419 | * | |
| 420 | * @param sql the HQL request. | |
| 421 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 422 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 423 | * @param parameterValues the where clause values that replace the question marks (?). | |
| 424 | * @param context the XWiki context required for getting information about the execution context. | |
| 425 | * @return a list of XWikiDocument. | |
| 426 | * @throws XWikiException in case of error while performing the query. | |
| 427 | * @since 1.1.2 | |
| 428 | * @since 1.2M2 | |
| 429 | */ | |
| 430 | <T> List<T> search(String sql, int nb, int start, List<?> parameterValues, XWikiContext context) | |
| 431 | throws XWikiException; | |
| 432 | ||
| 433 | /** | |
| 434 | * Execute a reading request and return result. | |
| 435 | * | |
| 436 | * @param sql the HQL request. | |
| 437 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 438 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 439 | * @param whereParams if not null add to {@code sql} a where clause based on a table of table containing field | |
| 440 | * name, field value and compared symbol ({@code =}, {@code >}, etc.). | |
| 441 | * @param context the XWiki context required for getting information about the execution context. | |
| 442 | * @return a list of XWikiDocument. | |
| 443 | * @throws XWikiException in case of error while performing the query. | |
| 444 | */ | |
| 445 | <T> List<T> search(String sql, int nb, int start, Object[][] whereParams, XWikiContext context) | |
| 446 | throws XWikiException; | |
| 447 | ||
| 448 | /** | |
| 449 | * Execute a reading request with parameters and return result. | |
| 450 | * <p> | |
| 451 | * Execute query by passing HQL request values as parameters. This allows generating a Named HQL query which will | |
| 452 | * automatically encode the passed values (like escaping single quotes). This API is recommended to be used over the | |
| 453 | * other similar methods where the values are passed inside the where clause and for which you'll need to do the | |
| 454 | * encoding/escaping yourself before calling them. | |
| 455 | * | |
| 456 | * @param sql the HQL request. | |
| 457 | * @param nb the number of rows to return. If 0 then all rows are returned. | |
| 458 | * @param start the number of rows to skip. If 0 don't skip any row. | |
| 459 | * @param whereParams if not null add to {@code sql} a where clause based on a table of table containing field | |
| 460 | * name, field value and compared symbol ({@code =}, {@code >}, etc.). | |
| 461 | * @param parameterValues the where clause values that replace the question marks (?). | |
| 462 | * @param context the XWiki context required for getting information about the execution context. | |
| 463 | * @return a list of XWikiDocument. | |
| 464 | * @throws XWikiException in case of error while performing the query. | |
| 465 | * @since 1.1.2 | |
| 466 | * @since 1.2M2 | |
| 467 | */ | |
| 468 | <T> List<T> search(String sql, int nb, int start, Object[][] whereParams, List<?> parameterValues, | |
| 469 | XWikiContext context) throws XWikiException; | |
| 470 | ||
| 471 | void cleanUp(XWikiContext context); | |
| 472 | ||
| 473 | /** | |
| 474 | * Indicate if the provided wiki name could be used to create a new wiki. | |
| 475 | * | |
| 476 | * @param wikiName the name of the wiki. | |
| 477 | * @param context the XWiki context. | |
| 478 | * @return true if the name is already used, false otherwise. | |
| 479 | * @throws XWikiException error when looking if wiki name already used. | |
| 480 | */ | |
| 481 | boolean isWikiNameAvailable(String wikiName, XWikiContext context) throws XWikiException; | |
| 482 | ||
| 483 | /** | |
| 484 | * Allows to create a new wiki database and initialize the default tables. | |
| 485 | * | |
| 486 | * @param wikiName the name of the new wiki. | |
| 487 | * @param context the XWiki context. | |
| 488 | * @throws XWikiException error when creating new wiki. | |
| 489 | */ | |
| 490 | void createWiki(String wikiName, XWikiContext context) throws XWikiException; | |
| 491 | ||
| 492 | /** | |
| 493 | * Delete a wiki database. | |
| 494 | * | |
| 495 | * @param wikiName the name of the wiki. | |
| 496 | * @param context the XWiki context. | |
| 497 | * @throws XWikiException error when deleting wiki database. | |
| 498 | */ | |
| 499 | void deleteWiki(String wikiName, XWikiContext context) throws XWikiException; | |
| 500 | ||
| 501 | boolean exists(XWikiDocument doc, XWikiContext context) throws XWikiException; | |
| 502 | ||
| 503 | boolean isCustomMappingValid(BaseClass bclass, String custommapping1, XWikiContext context) throws XWikiException; | |
| 504 | ||
| 505 | boolean injectCustomMapping(BaseClass doc1class, XWikiContext xWikiContext) throws XWikiException; | |
| 506 | ||
| 507 | boolean injectCustomMappings(XWikiDocument doc, XWikiContext context) throws XWikiException; | |
| 508 | ||
| 509 | List<String> getCustomMappingPropertyList(BaseClass bclass); | |
| 510 | ||
| 511 | void injectCustomMappings(XWikiContext context) throws XWikiException; | |
| 512 | ||
| 513 | void injectUpdatedCustomMappings(XWikiContext context) throws XWikiException; | |
| 514 | ||
| 515 | List<String> getTranslationList(XWikiDocument doc, XWikiContext context) throws XWikiException; | |
| 516 | ||
| 517 | /** | |
| 518 | * @return QueryManager used for creating queries to store. Use QueryManager instead of #search* methods because it | |
| 519 | * is more abstract from store implementation and support multiple query languages. | |
| 520 | */ | |
| 521 | QueryManager getQueryManager(); | |
| 522 | } |