Class XWiki
- java.lang.Object
-
- com.xpn.xwiki.XWiki
-
- All Implemented Interfaces:
org.xwiki.observation.EventListener
@Serializable(false) public class XWiki extends Object implements org.xwiki.observation.EventListener
-
-
Field Summary
Fields Modifier and Type Field Description static String
CACHE_VERSION
Query parameters used to control the browser cache version of a resource.static String
CFG_ENV_NAME
Deprecated.since 6.1M2, useXWikiCfgConfigurationSource.CFG_ENV_NAME
insteadstatic String
CKEY_BASESKIN
static String
CKEY_SKIN
static String
DEFAULT_ENCODING
The default encoding, and the internally used encoding when dealing with byte representation of strings.static String
DEFAULT_HOME_SPACE
Name of the default home space.static String
DEFAULT_MAIN_WIKI
Name of the default wiki.static String
DEFAULT_SKIN
static String
DEFAULT_SPACE_HOMEPAGE
Name of the default space homepage.protected static org.slf4j.Logger
LOGGER
Logging helper object.static String
MACROS_FILE
static String
SYSTEM_SPACE
Name of the default system space.static EntityReference
SYSTEM_SPACE_REFERENCE
Name of the default system space as an EntityReference.
-
Constructor Summary
Constructors Constructor Description XWiki()
This provide a way to create an XWiki object without initializing the whole XWiki (including plugins, storage, etc.).XWiki(XWikiConfig config, XWikiContext context)
Deprecated.since 6.1M3, useXWiki(XWikiContext)
insteadXWiki(XWikiConfig config, XWikiContext context, XWikiEngineContext engine_context, boolean noupdate)
Deprecated.since 6.1M3, useXWiki(XWikiContext, XWikiEngineContext, boolean)
insteadXWiki(XWikiContext context)
Initialize all xwiki subsystems.XWiki(XWikiContext context, XWikiEngineContext engineContext, boolean noupdate)
Initialize all xwiki subsystems.XWiki(InputStream is, XWikiContext context, XWikiEngineContext engine_context)
Deprecated.useXWiki(XWikiContext, XWikiEngineContext, boolean)
insteadXWiki(String xwikicfgpath, XWikiContext context)
Deprecated.useXWiki(XWikiContext)
insteadXWiki(String xwikicfgpath, XWikiContext context, XWikiEngineContext engine_context, boolean noupdate)
Deprecated.useXWiki(XWikiContext, XWikiEngineContext, boolean)
instead
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
addMandatory(XWikiContext context)
String
addTooltip(String html, String message, XWikiContext context)
String
addTooltip(String html, String message, String params, XWikiContext context)
String
addTooltipJS(XWikiContext context)
protected void
addUserToGroup(String userName, String groupName, XWikiContext context)
static Object
callPrivateMethod(Object obj, String methodName)
static Object
callPrivateMethod(Object obj, String methodName, Class<?>[] classes, Object[] args)
boolean
checkAccess(String action, XWikiDocument doc, XWikiContext context)
int
checkActive(XWikiContext context)
Deprecated.since 11.8RC1 prefer usingXWikiUser.isDisabled(XWikiContext)
.int
checkActive(String user, XWikiContext context)
Deprecated.since 11.8RC1 prefer usingXWikiUser.isDisabled(XWikiContext)
.XWikiUser
checkAuth(XWikiContext context)
Authenticate the user from the context and check if the user is disabled or not.void
checkDeletingDocument(DocumentReference userReference, XWikiDocument document, XWikiContext context)
Check if the user is allowed to delete the document.void
checkSavingDocument(DocumentReference userReference, XWikiDocument document, XWikiContext context)
Check if the user is allowed to save the document.void
checkSavingDocument(DocumentReference userReference, XWikiDocument document, String comment, boolean isMinorEdit, XWikiContext context)
Check if the user is allowed to save the document.void
checkSavingDocument(DocumentReference userReference, XWikiDocument document, String comment, XWikiContext context)
Check if the user is allowed to save the document.String
clearName(String name, boolean stripDots, boolean ascii, XWikiContext context)
String
clearName(String name, XWikiContext context)
String
convertUsername(String username, XWikiContext context)
boolean
copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, boolean reset, boolean force, boolean resetCreationData, XWikiContext context)
boolean
copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, boolean reset, XWikiContext context)
boolean
copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, XWikiContext context)
boolean
copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, String wikilocale, boolean reset, boolean force, boolean resetCreationData, XWikiContext context)
boolean
copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, String wikilocale, boolean reset, boolean force, XWikiContext context)
boolean
copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, String wikilocale, boolean reset, XWikiContext context)
boolean
copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, String wikilocale, XWikiContext context)
int
copySpaceBetweenWikis(String space, String sourceWiki, String targetWiki, String locale, boolean clean, XWikiContext context)
int
copySpaceBetweenWikis(String space, String sourceWiki, String targetWiki, String locale, XWikiContext context)
int
copyWiki(String sourceWiki, String targetWiki, String locale, boolean clean, XWikiContext context)
Deprecated.since 5.3, useWikiManager.copy(String, String, String, boolean, boolean, boolean)
insteadint
copyWiki(String sourceWiki, String targetWiki, String locale, XWikiContext context)
Deprecated.since 5.3, useWikiManager.copy(String, String, String, boolean, boolean, boolean)
insteadint
countAttachments(String parametrizedSqlClause, List<?> parameterValues, XWikiContext context)
Count attachments returned by a given parameterized queryprotected Object
createClassFromConfig(String param, String defClass, XWikiContext context)
boolean
createEmptyUser(String xwikiname, String userRights, XWikiContext context)
Method allows to create an empty user with no password (he won't be able to login) This method is usefull for authentication like LDAP or App Server trustedint
createUser(boolean withValidation, String userRights, XWikiContext context)
int
createUser(XWikiContext context)
int
createUser(String userName, Map<String,?> map, XWikiContext context)
Create a new user.int
createUser(String userName, Map<String,?> map, String userRights, XWikiContext context)
Create a new user.int
createUser(String xwikiname, Map<String,?> map, String parent, String content, String userRights, XWikiContext context)
Deprecated.starting with XE 1.8.1 usecreateUser(String, Map, String, String, String, String, XWikiContext)
insteadint
createUser(String userName, Map<String,?> map, String parent, String content, String syntaxId, String userRights, XWikiContext context)
Deprecated.since 2.4RC1 usecreateUser(String, Map, EntityReference, String, Syntax, String, XWikiContext)
insteadint
createUser(String userName, Map<String,?> map, EntityReference parentReference, String content, org.xwiki.rendering.syntax.Syntax syntax, String userRights, XWikiContext context)
Create a new user.void
deleteAllDocuments(XWikiDocument doc, boolean toTrash, XWikiContext context)
void
deleteAllDocuments(XWikiDocument doc, XWikiContext context)
void
deleteDocument(XWikiDocument doc, boolean totrash, XWikiContext context)
void
deleteDocument(XWikiDocument doc, XWikiContext context)
void
deleteDocumentVersions(XWikiDocument document, String version1, String version2, XWikiContext context)
Delete a range of versions from a document history.String
evaluateTemplate(String template, XWikiContext context)
Deprecated.since 7.0M1, useTemplateManager.render(String)
insteadString
evaluateVelocity(String content, String name)
String
evaluateVelocity(String content, String namespace, org.apache.velocity.VelocityContext vcontext)
boolean
exists(String fullname, XWikiContext context)
Deprecated.since 2.2.1 useexists(DocumentReference, XWikiContext)
boolean
exists(DocumentReference documentReference, XWikiContext context)
Check if a document exist.boolean
exists(PageReference reference, XWikiContext context)
Returns whether a page exists or not.void
flushCache(XWikiContext context)
String
formatDate(Date date, String format, XWikiContext context)
long
freeMemory()
void
gc()
String
generateRandomString(int size)
String
generateValidationKey(int size)
String
getAdClientId(XWikiContext context)
String
getAdType(XWikiContext context)
AttachmentRecycleBinStore
getAttachmentRecycleBinStore()
String
getAttachmentRevisionURL(AttachmentReference attachmentReference, String revision, String queryString, XWikiContext context)
XWikiAttachmentStoreInterface
getAttachmentStore()
Deprecated.since 9.9RC1, usegetDefaultAttachmentContentStore()
insteadString
getAttachmentURL(String fullname, String filename, XWikiContext context)
String
getAttachmentURL(String fullname, String filename, String queryString, XWikiContext context)
String
getAttachmentURL(AttachmentReference attachmentReference, String queryString, XWikiContext context)
String
getAttachmentURL(AttachmentReference attachmentReference, String action, String queryString, XWikiContext context)
AttachmentVersioningStore
getAttachmentVersioningStore()
Deprecated.since 9.9RC1, usegetDefaultAttachmentArchiveStore()
insteadXWikiAuthService
getAuthService()
List<Locale>
getAvailableLocales(XWikiContext xcontext)
Get the available locales according to the preferences.String
getBaseSkin(XWikiContext context)
Deprecated.since 7.0M1String
getBaseSkin(XWikiContext context, boolean fromRenderSkin)
Deprecated.since 7.0M1String
getBaseSkin(String skin, XWikiContext context)
Deprecated.since 7.0M1, useSkinManager.getCurrentSkin(boolean)
andSkin.getParent()
insteadBaseClass
getClass(String fullName, XWikiContext context)
Deprecated.since 2.2M2 usegetXClass(DocumentReference, XWikiContext)
List<String>
getClassList(XWikiContext context)
BaseClass
getCommentsClass(XWikiContext context)
XWikiConfig
getConfig()
Deprecated.since 6.1M2, useConfigurationSource
component with hintxwikicfg
insteadstatic String
getConfigPath()
Deprecated.since 6.1M2, useXWikiCfgConfigurationSource.getConfigPath()
insteadString
getConvertingUserNameType(XWikiContext context)
XWikiCriteriaService
getCriteriaService(XWikiContext context)
String
getCurrentContentSyntaxId(XWikiContext context)
Get the syntax of the content currently being executed.String
getCurrentContentSyntaxId(String defaultSyntaxId, XWikiContext context)
Get the syntax of the content currently being executed.String
getDatabase()
AttachmentVersioningStore
getDefaultAttachmentArchiveStore()
XWikiAttachmentStoreInterface
getDefaultAttachmentContentStore()
String
getDefaultBaseSkin(XWikiContext context)
Deprecated.since 7.0M1, useSkinManager.getDefaultParentSkin()
insteadString
getDefaultDocumentSyntax()
String
getDefaultLanguage(XWikiContext xcontext)
Deprecated.since 5.1M2 usegetDefaultLocale(XWikiContext)
insteadLocale
getDefaultLocale(XWikiContext xcontext)
The default locale in the preferences.String
getDefaultPage(XWikiContext context)
String
getDefaultSpace(XWikiContext context)
DeletedAttachment
getDeletedAttachment(String id, XWikiContext context)
Retrieve a specific attachment from the trash.List<DeletedAttachment>
getDeletedAttachments(String docName, XWikiContext context)
Retrieve all the deleted attachments that belonged to a certain document.List<DeletedAttachment>
getDeletedAttachments(String docName, String filename, XWikiContext context)
Retrieve all the deleted attachments that belonged to a certain document and had the specified name.XWikiDeletedDocument
getDeletedDocument(long index, XWikiContext context)
XWikiDeletedDocument
getDeletedDocument(String fullname, String locale, int index, XWikiContext context)
Deprecated.since 9.4RC1.XWikiDeletedDocument[]
getDeletedDocuments(String batchId, XWikiContext context)
XWikiDeletedDocument[]
getDeletedDocuments(String fullname, String locale, XWikiContext context)
String
getDocLanguagePreferenceNew(XWikiContext context)
Deprecated.since 8.0M1, usegetDocLocalePreferenceNew(XWikiContext)
insteadLocale
getDocLocalePreferenceNew(XWikiContext context)
XWikiDocument
getDocument(XWikiDocument doc, XWikiContext context)
XWikiDocument
getDocument(XWikiDocument document, String revision, XWikiContext context)
Deprecated.sine 9.10RC1, useDocumentRevisionProvider.getRevision(XWikiDocument, String)
insteadXWikiDocument
getDocument(String fullname, XWikiContext context)
Deprecated.since 2.2M1 usegetDocument(DocumentReference, XWikiContext)
insteadXWikiDocument
getDocument(String spaces, String fullname, XWikiContext context)
Deprecated.since 2.2M1 usegetDocument(DocumentReference, XWikiContext)
insteadXWikiDocument
getDocument(String reference, EntityType type, XWikiContext xcontext)
Loads a XWikiDocument from the store.XWikiDocument
getDocument(DocumentReference reference, XWikiContext context)
XWikiDocument
getDocument(DocumentReference reference, String revision, XWikiContext context)
Deprecated.sine 9.10RC1, useDocumentRevisionProvider.getRevision(DocumentReference, String)
insteadXWikiDocument
getDocument(EntityReference reference, XWikiContext context)
Loads a XWikiDocument from the store.XWikiDocument
getDocument(PageReference reference, XWikiContext context)
DocumentReference
getDocumentReference(XWikiRequest request, XWikiContext context)
DocumentReference
getDocumentReference(EntityReference reference, XWikiContext context)
Find the document reference corresponding to the entity reference based on what exist in the database (page reference can means two different documents for example).BaseClass
getEditModeClass(XWikiContext context)
Verify if theXWiki.EditModeClass
page exists and that it contains all the required configuration properties to make the edit mode feature work properly.String
getEditorPreference(XWikiContext context)
String
getEncoding()
XWikiEngineContext
getEngineContext()
List<Event>
getEvents()
String
getExternalAttachmentURL(String fullName, String filename, XWikiContext context)
String
getExternalURL(String fullname, String action, XWikiContext context)
String
getExternalURL(String fullname, String action, String querystring, XWikiContext context)
String
getExternalURL(DocumentReference documentReference, String action, String querystring, String anchor, XWikiContext context)
Get the full URL of the givenDocumentReference
.String
getFullNameSQL()
String
getFullNameSQL(boolean newFullName)
BaseClass
getGlobalRightsClass(XWikiContext context)
BaseClass
getGroupClass(XWikiContext context)
XWikiGroupService
getGroupService(XWikiContext context)
XWikiHibernateStore
getHibernateStore()
static org.apache.commons.httpclient.HttpClient
getHttpClient(int timeout, String userAgent)
int
getHttpTimeout(XWikiContext context)
String
getHttpUserAgent(XWikiContext context)
String
getIconURL(String iconName, XWikiContext context)
List<String>
getIncludedMacros(String defaultSpace, String content, XWikiContext context)
String
getInterfaceLanguagePreference(XWikiContext context)
Deprecated.since 8.0M1, usegetInterfaceLocalePreference(XWikiContext)
insteadLocale
getInterfaceLocalePreference(XWikiContext context)
String
getLanguagePreference(XWikiContext context)
Deprecated.since 8.0M1, usegetLocalePreference(XWikiContext)
insteadLocale
getLocalePreference(XWikiContext context)
The algorithm to find the locale to use is the following, in this order: Try to find the current locale in use from the XWiki contex If the wiki is not multilingual use the wiki default locale (default_language
xproperty inXWikiPreferences
xobject or English if not found) If the wiki is multilingual Try to get the locale passed in the request (looking for alanguage
query string parameter).String
getLocalUserName(String user, XWikiContext context)
String
getLocalUserName(String user, String format, boolean link, XWikiContext context)
String
getLocalUserName(String user, String format, XWikiContext context)
String
getMacroList(XWikiContext context)
static XWiki
getMainXWiki(boolean wait, XWikiContext context)
static XWiki
getMainXWiki(XWikiContext context)
int
getMaxRecursiveSpaceChecks(XWikiContext context)
MetaClass
getMetaclass()
String
getName()
XWikiStoreInterface
getNotCacheStore()
BaseObject
getObjectFromRequest(String className, XWikiContext context)
String
getPlainUserName(DocumentReference userReference, XWikiContext context)
Generate and return an unescaped user display name.XWikiPluginInterface
getPlugin(String name, XWikiContext context)
Deprecated.Api
getPluginApi(String name, XWikiContext context)
Deprecated.XWikiPluginManager
getPluginManager()
BaseClass
getPrefsClass(XWikiContext context)
Verify if theXWiki.XWikiPreferences
page exists and that it contains all the required configuration properties to make XWiki work properly.static Object
getPrivateField(Object obj, String fieldName)
Deprecated.useFieldUtils.readDeclaredField(Object, String, boolean)
insteadPropertyClass
getPropertyClassFromName(String propPath, XWikiContext context)
String
getRealPath(String path)
XWikiRecycleBinStoreInterface
getRecycleBinStore()
BaseClass
getRedirectClass(XWikiContext context)
Verify if theXWiki.GlobalRedirect
page exists and that it contains all the required configuration properties to make the redirection feature work properly.String
getRefererText(String referer, XWikiContext context)
static URL
getRequestURL(XWikiRequest request)
URL
getResource(String s)
InputStream
getResourceAsStream(String s)
String
getResourceContent(String name)
byte[]
getResourceContentAsBytes(String name)
Date
getResourceLastModificationDate(String name)
BaseClass
getRightsClass(XWikiContext context)
BaseClass
getRightsClass(String pagename, XWikiContext context)
XWikiRightService
getRightService()
long
getSectionEditingDepth()
URL
getServerURL(String wikiId, XWikiContext xcontext)
static String
getServerWikiPage(String servername)
String
getServletPath(String wikiName, XWikiContext context)
BaseClass
getSheetClass(XWikiContext context)
Deprecated.since 3.1M2 edit mode class should be used for this purpose, not the sheet classString
getSkin(XWikiContext context)
Deprecated.since 7.0M1, useSkinManager.getCurrentSkin(boolean)
insteadBaseClass
getSkinClass(XWikiContext context)
String
getSkinFile(String filename, boolean forceSkinAction, XWikiContext context)
Build and return a skin file url based on the given parameters.String
getSkinFile(String filename, XWikiContext context)
String
getSkinFile(String fileName, String skinId, boolean forceSkinAction, XWikiContext context)
String
getSkinFile(String filename, String skin, XWikiContext context)
String
getSkinPreference(String prefname, XWikiContext context)
String
getSkinPreference(String prefname, String defaultValue, XWikiContext context)
String
getSpaceCopyright(XWikiContext context)
List<String>
getSpaceDocsName(String spaceReference, XWikiContext context)
Deprecated.use query service insteadString
getSpacePreference(String preference, XWikiContext context)
String
getSpacePreference(String preference, String defaultValue, XWikiContext context)
String
getSpacePreference(String preferenceKey, SpaceReference spaceReference, XWikiContext context)
Get the reference of the space and fallback on parent space or wiki in case nothing is found.String
getSpacePreference(String preferenceKey, SpaceReference spaceReference, String defaultValue, XWikiContext context)
Get the preference key for the space and fallback on parent space or wiki in case nothing is found.int
getSpacePreferenceAsInt(String preference, int defaultValue, XWikiContext context)
int
getSpacePreferenceAsInt(String preference, XWikiContext context)
long
getSpacePreferenceAsLong(String preference, long defaultValue, XWikiContext context)
long
getSpacePreferenceAsLong(String preference, XWikiContext context)
List<String>
getSpaces(XWikiContext context)
Deprecated.use query service insteadXWikiStatsService
getStatsService(XWikiContext context)
XWikiStoreInterface
getStore()
BaseClass
getTagClass(XWikiContext context)
Verify if theXWiki.TagClass
page exists and that it contains all the required configuration properties to make the tag feature work properly.static String
getTextArea(String content, XWikiContext context)
int
getTimeDelta(long time)
String
getUniquePageName(String space, XWikiContext context)
Generates a unique page name based on initial page name and already existing pages.String
getUniquePageName(String space, String name, XWikiContext context)
Generates a unique page name based on initial page name and already existing pages.String
getURL(String fullname, String action, XWikiContext context)
Deprecated.since 2.3M2 usegetURL(DocumentReference, String, XWikiContext)
String
getURL(String fullname, String action, String querystring, XWikiContext context)
String
getURL(String fullname, String action, String queryString, String anchor, XWikiContext context)
Deprecated.since 2.2.1 usegetURL(DocumentReference, String, String, String, XWikiContext)
String
getURL(DocumentReference reference, String action, XWikiContext context)
String
getURL(DocumentReference documentReference, String action, String queryString, String anchor, XWikiContext context)
String
getURL(EntityReference reference, XWikiContext context)
String
getURL(EntityReference reference, String action, XWikiContext context)
String
getURL(EntityReference entityReference, String action, String queryString, String anchor, XWikiContext context)
String
getURLContent(String surl, int timeout, String userAgent)
String
getURLContent(String surl, XWikiContext context)
String
getURLContent(String surl, String username, String password, int timeout, String userAgent)
String
getURLContent(String surl, String username, String password, XWikiContext context)
byte[]
getURLContentAsBytes(String surl, int timeout, String userAgent)
byte[]
getURLContentAsBytes(String surl, XWikiContext context)
byte[]
getURLContentAsBytes(String surl, String username, String password, int timeout, String userAgent)
byte[]
getURLContentAsBytes(String surl, String username, String password, XWikiContext context)
XWikiURLFactoryService
getURLFactoryService()
User
getUser(XWikiContext context)
User
getUser(String username, XWikiContext context)
Deprecated.since 11.8RC1 prefer usinggetUser(DocumentReference, XWikiContext)
.User
getUser(DocumentReference userReference, XWikiContext context)
Retrieve a user from its document reference.BaseClass
getUserClass(XWikiContext context)
Verify if theXWiki.XWikiUsers
page exists and that it contains all the required configuration properties to make the user feature work properly.String
getUserName(String user, XWikiContext context)
String
getUserName(String user, String format, boolean link, XWikiContext context)
String
getUserName(String user, String format, XWikiContext context)
String
getUserName(DocumentReference userReference, String format, boolean link, boolean escapeXML, XWikiContext context)
Generate a display user name and return it.String
getUserPreference(String prefname, boolean useCookie, XWikiContext context)
String
getUserPreference(String prefname, XWikiContext context)
int
getUserPreferenceAsInt(String prefname, XWikiContext context)
long
getUserPreferenceAsLong(String preference, XWikiContext context)
String
getUserPreferenceFromCookie(String prefname, XWikiContext context)
String
getUserTimeZone(XWikiContext context)
String
getVersion()
XWikiVersioningStoreInterface
getVersioningStore()
org.xwiki.cache.Cache<DocumentReference>
getVirtualWikiCache()
Deprecated.List<String>
getVirtualWikiList()
Deprecated.List<String>
getVirtualWikisDatabaseNames(XWikiContext context)
Deprecated.since 5.3, useWikiDescriptorManager.getAllIds()
insteadString
getWebAppPath(XWikiContext context)
org.xwiki.job.Job
getWikiInitializerJob(String wikiId)
String
getWikiOwner(String wikiName, XWikiContext context)
Get the reference of the owner for the provider wiki.String
getWysiwygToolbars(XWikiContext context)
BaseClass
getXClass(DocumentReference documentReference, XWikiContext context)
static XWiki
getXWiki(boolean wait, XWikiContext xcontext)
Return the XWiki object (as in "the Wiki API") corresponding to the requested wiki.static XWiki
getXWiki(XWikiContext context)
Return the XWiki object (as in "the Wiki API") corresponding to the requested wiki.String
getXWikiPreference(String prefname, XWikiContext context)
String
getXWikiPreference(String prefname, String defaultValue, XWikiContext context)
String
getXWikiPreference(String prefname, String fallbackParam, String defaultValue, XWikiContext context)
Obtain a preference value for the wiki, looking up first in the XWiki.XWikiPreferences document, then fallbacking on a config parameter when the first lookup gives an empty string, then returning the default value if the config parameter returned itself an empty string.String
getXWikiPreference(String prefname, String wiki, String fallbackParam, String defaultValue, XWikiContext xcontext)
Obtain a preference value for the wiki, looking up first in the XWiki.XWikiPreferences document, then fallbacking on a config parameter when the first lookup gives an empty string, then returning the default value if the config parameter returned itself an empty string.int
getXWikiPreferenceAsInt(String preference, int defaultValue, XWikiContext context)
int
getXWikiPreferenceAsInt(String preference, XWikiContext context)
int
getXWikiPreferenceAsInt(String preference, String fallbackParameter, int defaultValue, XWikiContext context)
long
getXWikiPreferenceAsLong(String preference, long defaultValue, XWikiContext context)
long
getXWikiPreferenceAsLong(String preference, XWikiContext context)
long
getXWikiPreferenceAsLong(String preference, String fallbackParameter, long defaultValue, XWikiContext context)
ZipOutputStream
getZipOutputStream(XWikiContext context)
boolean
hasAttachmentRecycleBin(XWikiContext context)
Indicates whether deleted attachments are stored in a recycle bin or not.boolean
hasAttachmentVersioning(XWikiContext context)
boolean
hasBacklinks(XWikiContext context)
boolean
hasCentralizedAuthentication(XWikiContext context)
boolean
hasCustomMappings()
boolean
hasDynamicCustomMappings()
boolean
hasEditComment(XWikiContext context)
boolean
hasMinorEdit(XWikiContext context)
boolean
hasRecycleBin(XWikiContext context)
boolean
hasSectionEdit(XWikiContext context)
boolean
hasTags(XWikiContext context)
boolean
hasVersioning(XWikiContext context)
String
include(String topic, boolean isForm, XWikiContext context)
void
initializeMandatoryDocuments(XWikiContext context)
Ensure that mandatory classes (ie classes XWiki needs to work properly) exist and create them if they don't exist.boolean
initializeWiki(String wikiId, boolean wait, XWikiContext xcontext)
Make sure the wiki is initializing or wait for it.void
initXWiki(XWikiConfig config, XWikiContext context, XWikiEngineContext engineContext, boolean noupdate)
Deprecated.since 6.1M2, useinitXWiki(XWikiContext, XWikiEngineContext, boolean)
insteadvoid
initXWiki(XWikiContext context, XWikiEngineContext engineContext, boolean noupdate)
Initialize all xwiki subsystems.boolean
isAllGroupImplicit()
boolean
isEditCommentFieldHidden(XWikiContext context)
boolean
isEditCommentMandatory(XWikiContext context)
boolean
isEditCommentSuggested(XWikiContext context)
static boolean
isInitializing(XWikiContext xcontext)
boolean
isLDAP()
boolean
isMultiLingual(XWikiContext context)
boolean
isMySQL()
boolean
isPathBased()
boolean
isReadOnly()
accessor for the isReadOnly instance var.boolean
isTitleInCompatibilityMode()
boolean
isWikiInitialized(String wikiId)
Check if the given wiki initialization has been performed and is finished.long
maxMemory()
void
onEvent(Event event, Object source, Object data)
String
Param(String key)
Deprecated.since 6.1M2, useConfigurationSource
component with hintxwikicfg
insteadString
Param(String key, String default_value)
Deprecated.since 6.1M2, useConfigurationSource
component with hintxwikicfg
insteadlong
ParamAsLong(String key)
Deprecated.since 6.1M2, useConfigurationSource
component with hintxwikicfg
insteadlong
ParamAsLong(String key, long default_value)
Deprecated.since 6.1M2, useConfigurationSource
component with hintxwikicfg
insteadString
ParamAsRealPath(String key)
String
ParamAsRealPath(String key, XWikiContext context)
String
ParamAsRealPathVerified(String param)
String
parseContent(String content, XWikiContext context)
Deprecated.Since 7.2M1.Object
parseGroovyFromPage(String fullName, XWikiContext context)
Object
parseGroovyFromPage(String fullName, String jarWikiPage, XWikiContext context)
Object
parseGroovyFromString(String script, XWikiContext xcontext)
Privileged API to retrieve an object instantiated from groovy code in a String.Object
parseGroovyFromString(String script, String jarWikiPage, XWikiContext xcontext)
Privileged API to retrieve an object instantiated from groovy code in a String, using a classloader including all JAR files located in the passed page as attachments.String
parseTemplate(String template, XWikiContext context)
Deprecated.useevaluateTemplate(String, XWikiContext)
insteadString
parseTemplate(String template, String skinId, XWikiContext context)
Deprecated.since 7.0M1, useTemplateManager.renderFromSkin(java.lang.String, org.xwiki.skin.Skin)
insteadboolean
prepareDocuments(XWikiRequest request, XWikiContext context, org.apache.velocity.VelocityContext vcontext)
void
prepareResources(XWikiContext context)
Prepares the localized resources, according to the selected locale.String
printStrackTrace(Throwable e)
Deprecated.useExceptionUtils.getStackTrace(Throwable)
insteadvoid
protectUserPage(String userName, String userRights, XWikiDocument doc, XWikiContext context)
void
refreshLinks(XWikiContext context)
void
renameByCopyAndDelete(XWikiDocument sourceDoc, DocumentReference newDocumentReference, List<DocumentReference> backlinkDocumentReferences, List<DocumentReference> childDocumentReferences, XWikiContext context)
Deprecated.Old implementation of the rename by copy and delete.boolean
renameDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, boolean overwrite, List<DocumentReference> backlinkDocumentReferences, List<DocumentReference> childDocumentReferences, XWikiContext context)
API to rename a document to another document.String
renderTemplate(String template, XWikiContext context)
String
renderTemplate(String template, String skin, XWikiContext context)
boolean
resourceExists(String name)
void
restoreFromRecycleBin(long index, String comment, XWikiContext context)
Restore a document with passed index from recycle bin.void
restoreFromRecycleBin(XWikiDocument doc, long index, String comment, XWikiContext context)
Deprecated.since 9.4RC1.void
restoreFromRecycleBin(XWikiDocument doc, String comment, XWikiContext context)
Restore a document with passed index from recycle bin.XWikiDocument
rollback(XWikiDocument tdoc, String rev, boolean addRevision, XWikiContext xcontext)
XWikiDocument
rollback(XWikiDocument tdoc, String rev, XWikiContext context)
void
saveDocument(XWikiDocument doc, XWikiContext context)
void
saveDocument(XWikiDocument document, String comment, boolean isMinorEdit, XWikiContext context)
Save the passed document in the store.void
saveDocument(XWikiDocument doc, String comment, XWikiContext context)
<T> List<T>
search(String sql, int nb, int start, XWikiContext context)
<T> List<T>
search(String sql, int nb, int start, Object[][] whereParams, XWikiContext context)
<T> List<T>
search(String sql, XWikiContext context)
<T> List<T>
search(String sql, Object[][] whereParams, XWikiContext context)
List<XWikiAttachment>
searchAttachments(String parametrizedSqlClause, boolean checkRight, int nb, int start, List<?> parameterValues, XWikiContext context)
Deprecated.since 9.7RC1, use the QueryManager instead along with the "attachment" query filtervoid
sendConfirmationEmail(String xwikiname, String password, String email, String message, String contentfield, XWikiContext context)
void
sendValidationEmail(String xwikiname, String password, String email, String validkey, String contentfield, XWikiContext context)
void
sendValidationEmail(String xwikiname, String password, String email, String addfieldname, String addfieldvalue, String contentfield, XWikiContext context)
void
setAttachmentRecycleBinStore(AttachmentRecycleBinStore attachmentRecycleBinStore)
void
setAttachmentStore(XWikiAttachmentStoreInterface attachmentStore)
Deprecated.since 9.9RC1, usesetDefaultAttachmentContentStore(XWikiAttachmentStoreInterface)
insteadvoid
setAttachmentVersioningStore(AttachmentVersioningStore attachmentArchiveStore)
Deprecated.since 9.10RC1, usesetDefaultAttachmentArchiveStore(AttachmentVersioningStore)
insteadvoid
setAuthService(XWikiAuthService authService)
void
setConfig(XWikiConfig config)
Deprecated.since 6.1M2void
setCriteriaService(XWikiCriteriaService criteriaService)
void
setDatabase(String database)
void
setDefaultAttachmentArchiveStore(AttachmentVersioningStore attachmentArchiveStore)
void
setDefaultAttachmentContentStore(XWikiAttachmentStoreInterface attachmentContentStore)
void
setEngineContext(XWikiEngineContext engine_context)
void
setGroupService(XWikiGroupService groupService)
void
setMetaclass(MetaClass metaclass)
void
setPhonyDocument(String docName, XWikiContext context, org.apache.velocity.VelocityContext vcontext)
Deprecated.void
setPhonyDocument(DocumentReference reference, XWikiContext context)
void
setPhonyDocument(DocumentReference reference, XWikiContext context, org.apache.velocity.VelocityContext vcontext)
Deprecated.since 8.3M1, usesetPhonyDocument(DocumentReference, XWikiContext)
insteadvoid
setPluginManager(XWikiPluginManager pluginManager)
void
setReadOnly(boolean readOnly)
void
setRecycleBinStore(XWikiRecycleBinStoreInterface recycleBinStore)
void
setRightService(XWikiRightService rightService)
void
setStore(XWikiStoreInterface store)
void
setUserDefaultGroup(String fullwikiname, XWikiContext context)
void
setVersion(String version)
void
setVersioningStore(XWikiVersioningStoreInterface versioningStore)
boolean
showViewAction(XWikiContext context)
String[]
split(String str, String sep)
static String
stripSegmentFromPath(String path, String segment)
Helper method, removes a predefined path segment (the context path or the servel path) from the start of the requested URI and returns the remainder.long
totalMemory()
void
updateDatabase(String wikiId, boolean force, boolean initDocuments, XWikiContext context)
Deprecated.since 8.4RC1, useinitializeWiki(String, boolean, XWikiContext)
insteadvoid
updateDatabase(String wikiId, boolean force, XWikiContext context)
Deprecated.since 8.4RC1, useinitializeWiki(String, boolean, XWikiContext)
insteadvoid
updateDatabase(String wikiId, XWikiContext context)
Deprecated.since 8.4RC1, useinitializeWiki(String, boolean, XWikiContext)
insteadboolean
useDefaultAction(XWikiContext context)
boolean
validateDocument(XWikiDocument doc, XWikiContext context)
int
validateUser(boolean withConfirmEmail, XWikiContext context)
-
-
-
Field Detail
-
DEFAULT_MAIN_WIKI
public static final String DEFAULT_MAIN_WIKI
Name of the default wiki.- See Also:
- Constant Field Values
-
DEFAULT_HOME_SPACE
public static final String DEFAULT_HOME_SPACE
Name of the default home space.- See Also:
- Constant Field Values
-
SYSTEM_SPACE
public static final String SYSTEM_SPACE
Name of the default system space.- See Also:
- Constant Field Values
-
SYSTEM_SPACE_REFERENCE
public static final EntityReference SYSTEM_SPACE_REFERENCE
Name of the default system space as an EntityReference.- Since:
- 13.2RC1
-
DEFAULT_SPACE_HOMEPAGE
public static final String DEFAULT_SPACE_HOMEPAGE
Name of the default space homepage.- See Also:
- Constant Field Values
-
CKEY_SKIN
public static final String CKEY_SKIN
- See Also:
- Constant Field Values
-
CKEY_BASESKIN
public static final String CKEY_BASESKIN
- See Also:
- Constant Field Values
-
DEFAULT_SKIN
public static final String DEFAULT_SKIN
- See Also:
- Constant Field Values
-
CACHE_VERSION
public static final String CACHE_VERSION
Query parameters used to control the browser cache version of a resource.- See Also:
- Constant Field Values
-
LOGGER
protected static final org.slf4j.Logger LOGGER
Logging helper object.
-
DEFAULT_ENCODING
public static final String DEFAULT_ENCODING
The default encoding, and the internally used encoding when dealing with byte representation of strings.- See Also:
- Constant Field Values
-
CFG_ENV_NAME
@Deprecated public static final String CFG_ENV_NAME
Deprecated.since 6.1M2, useXWikiCfgConfigurationSource.CFG_ENV_NAME
instead- See Also:
- Constant Field Values
-
MACROS_FILE
public static final String MACROS_FILE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
XWiki
public XWiki()
This provide a way to create an XWiki object without initializing the whole XWiki (including plugins, storage, etc.).Needed for tools or tests which need XWiki because it is used everywhere in the API.
-
XWiki
public XWiki(XWikiContext context, XWikiEngineContext engineContext, boolean noupdate) throws XWikiException
Initialize all xwiki subsystems.- Parameters:
context
- seeXWikiContext
engineContext
- the XWiki object wrapping theServletContext
and which allows to set data that live on as long as the XWiki webapp is not stopped in the Servlet Containernoupdate
- true if the whole initialization should be done (create mandatory xlcasses, initialize stats service), i.e. if this is not an update, and false otherwise- Throws:
XWikiException
- if an error happened during initialization (failure to initialize some cache for example)
-
XWiki
public XWiki(XWikiContext context) throws XWikiException
Initialize all xwiki subsystems.- Parameters:
context
- seeXWikiContext
- Throws:
XWikiException
- if an error happened during initialization (failure to initialize some cache for example)
-
XWiki
@Deprecated public XWiki(XWikiConfig config, XWikiContext context) throws XWikiException
Deprecated.since 6.1M3, useXWiki(XWikiContext)
instead- Throws:
XWikiException
-
XWiki
@Deprecated public XWiki(XWikiConfig config, XWikiContext context, XWikiEngineContext engine_context, boolean noupdate) throws XWikiException
Deprecated.since 6.1M3, useXWiki(XWikiContext, XWikiEngineContext, boolean)
instead- Throws:
XWikiException
-
XWiki
@Deprecated public XWiki(String xwikicfgpath, XWikiContext context) throws XWikiException
Deprecated.useXWiki(XWikiContext)
instead- Throws:
XWikiException
-
XWiki
@Deprecated public XWiki(String xwikicfgpath, XWikiContext context, XWikiEngineContext engine_context, boolean noupdate) throws XWikiException
Deprecated.useXWiki(XWikiContext, XWikiEngineContext, boolean)
instead- Throws:
XWikiException
-
XWiki
@Deprecated public XWiki(InputStream is, XWikiContext context, XWikiEngineContext engine_context) throws XWikiException
Deprecated.useXWiki(XWikiContext, XWikiEngineContext, boolean)
instead- Throws:
XWikiException
-
-
Method Detail
-
getMainXWiki
public static XWiki getMainXWiki(XWikiContext context) throws XWikiException
- Parameters:
context
- seeXWikiContext
- Throws:
XWikiException
-
getMainXWiki
public static XWiki getMainXWiki(boolean wait, XWikiContext context) throws XWikiException
- Parameters:
wait
- true if the method should way forXWiki
instance to be initializedcontext
- seeXWikiContext
- Throws:
XWikiException
-
isInitializing
public static boolean isInitializing(XWikiContext xcontext)
-
getXWiki
public static XWiki getXWiki(XWikiContext context) throws XWikiException
Return the XWiki object (as in "the Wiki API") corresponding to the requested wiki.- Parameters:
context
- seeXWikiContext
- Returns:
- an XWiki object configured for the wiki corresponding to the current request
- Throws:
XWikiException
- if the requested URL does not correspond to a real wiki, or if there's an error in the storage
-
getXWiki
public static XWiki getXWiki(boolean wait, XWikiContext xcontext) throws XWikiException
Return the XWiki object (as in "the Wiki API") corresponding to the requested wiki.Unless
wait
is false the method return right away null if XWiki is not yet initialized.- Parameters:
wait
- wait until XWiki is initializedxcontext
- seeXWikiContext
- Returns:
- an XWiki object configured for the wiki corresponding to the current request
- Throws:
XWikiException
- if the requested URL does not correspond to a real wiki, or if there's an error in the storage
-
getWikiInitializerJob
public org.xwiki.job.Job getWikiInitializerJob(String wikiId)
- Parameters:
wikiId
- the identifier of the wiki- Returns:
- the current
WikiInitializerJob
associated to the passed wiki or null if there is none
-
isWikiInitialized
@Unstable public boolean isWikiInitialized(String wikiId)
Check if the given wiki initialization has been performed and is finished.- Parameters:
wikiId
- the identifier of the wiki- Returns:
true
if the wiki has been initialized and the initialization is finished.- Since:
- 14.4RC1
-
initializeWiki
public boolean initializeWiki(String wikiId, boolean wait, XWikiContext xcontext) throws XWikiException
Make sure the wiki is initializing or wait for it.- Parameters:
wikiId
- the identifier of the wiki to initializewait
- true if the method should return only when the wiki is fully initializedxcontext
- the XWiki context- Returns:
- true if the wiki is fully initialized
- Throws:
XWikiException
- when the initialization failed- Since:
- 8.4RC1
-
getRequestURL
public static URL getRequestURL(XWikiRequest request) throws XWikiException
- Throws:
XWikiException
-
callPrivateMethod
public static Object callPrivateMethod(Object obj, String methodName, Class<?>[] classes, Object[] args)
-
getHttpClient
public static org.apache.commons.httpclient.HttpClient getHttpClient(int timeout, String userAgent)
-
getPrivateField
@Deprecated public static Object getPrivateField(Object obj, String fieldName)
Deprecated.useFieldUtils.readDeclaredField(Object, String, boolean)
insteadUsing reflection, read the private value of the passed field name for the passed object.- Parameters:
obj
- the java object on which to read the private field valuefieldName
- the object member field for which to read the value- Returns:
- the private value for the field
-
getTextArea
public static String getTextArea(String content, XWikiContext context)
- Parameters:
content
- the content of the text areacontext
- seeXWikiContext
-
initXWiki
public void initXWiki(XWikiContext context, XWikiEngineContext engineContext, boolean noupdate) throws XWikiException
Initialize all xwiki subsystems.- Parameters:
context
- seeXWikiContext
engineContext
- the XWiki object wrapping theServletContext
and which allows to set data that live on as long as the XWiki webapp is not stopped in the Servlet Containernoupdate
- true if the whole initialization should be done (create mandatory xlcasses, initialize stats service), i.e. if this is not an update, and false otherwise- Throws:
XWikiException
- if an error happened during initialization (failure to initialize some cache for example)
-
initXWiki
@Deprecated public void initXWiki(XWikiConfig config, XWikiContext context, XWikiEngineContext engineContext, boolean noupdate) throws XWikiException
Deprecated.since 6.1M2, useinitXWiki(XWikiContext, XWikiEngineContext, boolean)
insteadInitialize all xwiki subsystems.- Parameters:
config
- the object holding the XWiki configuration read fromxwiki.cfg
context
- seeXWikiContext
engineContext
- the XWiki object wrapping theServletContext
and which allows to set data that live on as long as the XWiki webapp is not stopped in the Servlet Containernoupdate
- true if the whole initialization should be done (create mandatory xlcasses, initialize stats service), i.e. if this is not an update, and false otherwise- Throws:
XWikiException
- if an error happened during initialization (failure to initialize some cache for example)
-
initializeMandatoryDocuments
public void initializeMandatoryDocuments(XWikiContext context)
Ensure that mandatory classes (ie classes XWiki needs to work properly) exist and create them if they don't exist.- Parameters:
context
- seeXWikiContext
-
getNotCacheStore
public XWikiStoreInterface getNotCacheStore()
-
getHibernateStore
public XWikiHibernateStore getHibernateStore()
-
updateDatabase
@Deprecated public void updateDatabase(String wikiId, XWikiContext context) throws org.hibernate.HibernateException, XWikiException
Deprecated.since 8.4RC1, useinitializeWiki(String, boolean, XWikiContext)
instead- Parameters:
wikiId
- the id of the wikicontext
- seeXWikiContext
- Throws:
org.hibernate.HibernateException
XWikiException
-
updateDatabase
@Deprecated public void updateDatabase(String wikiId, boolean force, XWikiContext context) throws org.hibernate.HibernateException, XWikiException
Deprecated.since 8.4RC1, useinitializeWiki(String, boolean, XWikiContext)
instead- Parameters:
wikiId
- the id of the wikicontext
- seeXWikiContext
- Throws:
org.hibernate.HibernateException
XWikiException
-
updateDatabase
@Deprecated public void updateDatabase(String wikiId, boolean force, boolean initDocuments, XWikiContext context) throws org.hibernate.HibernateException, XWikiException
Deprecated.since 8.4RC1, useinitializeWiki(String, boolean, XWikiContext)
instead- Parameters:
wikiId
- the id of the wikiforce
- if the update of the databse should be forcedinitDocuments
- if mandatory document and plugin should be initialized for passed wikicontext
- seeXWikiContext
- Throws:
org.hibernate.HibernateException
XWikiException
-
getVirtualWikiList
@Deprecated public List<String> getVirtualWikiList()
Deprecated.- Returns:
- a cached list of all active virtual wikis (i.e. wikis who have been hit by a user request). To get a full
list of all virtual wikis database names use
WikiDescriptorManager.getAllIds()
.
-
getVirtualWikisDatabaseNames
@Deprecated public List<String> getVirtualWikisDatabaseNames(XWikiContext context) throws XWikiException
Deprecated.since 5.3, useWikiDescriptorManager.getAllIds()
instead- Parameters:
context
- seeXWikiContext
- Returns:
- the full list of all wiki names of all defined wikis. The wiki names are computed from the names of
documents having a
XWiki.XWikiServerClass
object attached to them by removing theXWiki.XWikiServer
prefix and making it lower case. For example a page namedXWiki.XWikiServerMyDatabase
would returnmydatabase
as the wiki name. This list will also contain the main wiki.Note: the wiki name is commonly also the name of the database where the wiki's data is stored. However, if configured accordingly, the database can be diferent from the wiki name, like for example when setting a wiki database prefix.
- Throws:
XWikiException
-
getVirtualWikiCache
@Deprecated public org.xwiki.cache.Cache<DocumentReference> getVirtualWikiCache()
Deprecated.- Returns:
- the cache containing the names of the wikis already initialized.
- Since:
- 1.5M2.
-
getWikiOwner
public String getWikiOwner(String wikiName, XWikiContext context) throws XWikiException
Get the reference of the owner for the provider wiki.- Parameters:
wikiName
- the technical name of the wikicontext
- seeXWikiContext
- Returns:
- the wiki owner or null if none is set
- Throws:
XWikiException
- failed to get wiki descriptor document
-
createClassFromConfig
protected Object createClassFromConfig(String param, String defClass, XWikiContext context) throws XWikiException
- Parameters:
context
- seeXWikiContext
- Throws:
XWikiException
-
getVersion
public String getVersion()
- Returns:
- the XWiki core version as specified in the
VERSION_FILE
file
-
getResource
public URL getResource(String s) throws MalformedURLException
- Throws:
MalformedURLException
-
getResourceAsStream
public InputStream getResourceAsStream(String s) throws MalformedURLException
- Throws:
MalformedURLException
-
getResourceContent
public String getResourceContent(String name) throws IOException
- Throws:
IOException
-
getResourceContentAsBytes
public byte[] getResourceContentAsBytes(String name) throws IOException
- Throws:
IOException
-
resourceExists
public boolean resourceExists(String name)
-
ParamAsRealPath
public String ParamAsRealPath(String key, XWikiContext context)
- Parameters:
context
- seeXWikiContext
-
getStore
public XWikiStoreInterface getStore()
-
getAttachmentStore
@Deprecated public XWikiAttachmentStoreInterface getAttachmentStore()
Deprecated.since 9.9RC1, usegetDefaultAttachmentContentStore()
instead
-
getDefaultAttachmentContentStore
public XWikiAttachmentStoreInterface getDefaultAttachmentContentStore()
- Returns:
- the store to use by default when saving a new attachment content
- Since:
- 9.10RC1
-
getDefaultAttachmentArchiveStore
public AttachmentVersioningStore getDefaultAttachmentArchiveStore()
- Returns:
- the store to use by default when saving a new attachment archive
- Since:
- 9.10RC1
-
getAttachmentVersioningStore
@Deprecated public AttachmentVersioningStore getAttachmentVersioningStore()
Deprecated.since 9.9RC1, usegetDefaultAttachmentArchiveStore()
instead
-
getVersioningStore
public XWikiVersioningStoreInterface getVersioningStore()
-
getRecycleBinStore
public XWikiRecycleBinStoreInterface getRecycleBinStore()
-
getAttachmentRecycleBinStore
public AttachmentRecycleBinStore getAttachmentRecycleBinStore()
-
checkSavingDocument
public void checkSavingDocument(DocumentReference userReference, XWikiDocument document, String comment, XWikiContext context) throws XWikiException
Check if the user is allowed to save the document.- Parameters:
userReference
- the user responsible for the changesdocument
- the document to savecomment
- the comment to associated to the new version of the saved documentcontext
- seeXWikiContext
- Throws:
XWikiException
- Since:
- 10.11.10, 11.6
-
checkSavingDocument
public void checkSavingDocument(DocumentReference userReference, XWikiDocument document, XWikiContext context) throws XWikiException
Check if the user is allowed to save the document.- Parameters:
userReference
- the user responsible for the changesdocument
- the document to savecontext
- seeXWikiContext
- Throws:
XWikiException
- Since:
- 10.11.10, 11.6
-
checkSavingDocument
public void checkSavingDocument(DocumentReference userReference, XWikiDocument document, String comment, boolean isMinorEdit, XWikiContext context) throws XWikiException
Check if the user is allowed to save the document.- Parameters:
userReference
- the user responsible for the changesdocument
- the document to savecomment
- the comment to associated to the new version of the saved documentisMinorEdit
- true if the new version is a minor versioncontext
- seeXWikiContext
- Throws:
XWikiException
- Since:
- 10.11.10, 11.6
-
saveDocument
public void saveDocument(XWikiDocument doc, XWikiContext context) throws XWikiException
- Parameters:
doc
- the document to savecontext
- seeXWikiContext
- Throws:
XWikiException
-
saveDocument
public void saveDocument(XWikiDocument doc, String comment, XWikiContext context) throws XWikiException
- Parameters:
doc
- the document to savecomment
- the comment to associated to the new version of the saved documentcontext
- seeXWikiContext
- Throws:
XWikiException
-
saveDocument
public void saveDocument(XWikiDocument document, String comment, boolean isMinorEdit, XWikiContext context) throws XWikiException
Save the passed document in the store.If document is not new and metadata and content dirty flags are false, the version/history won't be incremented (only the current state will be updated).
Since 11.1, if document#isNew() return true, any pre existing document will be backuped in the deleted documents store automatically and completely replaced.
- Parameters:
document
- the document to savecomment
- the comment to associated to the new version of the saved documentisMinorEdit
- true if the new version is a minor versioncontext
- seeXWikiContext
- Throws:
XWikiException
-
getDocument
public XWikiDocument getDocument(EntityReference reference, XWikiContext context) throws XWikiException
Loads a XWikiDocument from the store.Before 7.2M1 the reference is assumed to be a complete or incomplete document reference.
Since 7.2M1, the passed reference can be anything. If if a document child, the document reference will be extracted from it. If it's a document parent it will be completed with the necessary default references (for example if it's a space reference it will load the space home page).
- Parameters:
reference
- the reference of the documentcontext
- seeXWikiContext
- Throws:
XWikiException
- Since:
- 5.0M1
-
getDocument
public XWikiDocument getDocument(String reference, EntityType type, XWikiContext xcontext) throws XWikiException
Loads a XWikiDocument from the store.- Parameters:
reference
- the reference of the document to be loadedtype
- the type of the reference- Returns:
- a Document object (if the document couldn't be found a new one is created in memory - but not saved, you
can check whether it's a new document or not by using
Document.isNew()
- Throws:
XWikiException
- Since:
- 10.6RC1
-
getDocument
public XWikiDocument getDocument(XWikiDocument doc, XWikiContext context) throws XWikiException
- Parameters:
doc
- the documentcontext
- seeXWikiContext
- Throws:
XWikiException
-
getDocument
@Deprecated public XWikiDocument getDocument(DocumentReference reference, String revision, XWikiContext context) throws XWikiException
Deprecated.sine 9.10RC1, useDocumentRevisionProvider.getRevision(DocumentReference, String)
instead- Parameters:
reference
- the reference of the document to loadrevision
- the revision of the document to loadcontext
- the XWiki context- Returns:
- the document corresponding to the passed revision or a new XWikiDocument instance if none can be found
- Throws:
XWikiException
- when failing to load the document revision- Since:
- 9.4RC1
-
getDocument
@Deprecated public XWikiDocument getDocument(XWikiDocument document, String revision, XWikiContext context) throws XWikiException
Deprecated.sine 9.10RC1, useDocumentRevisionProvider.getRevision(XWikiDocument, String)
instead- Parameters:
document
- the reference documentrevision
- the revision of the document to loadcontext
- the XWiki context- Returns:
- the document corresponding to the passed revision or a new XWikiDocument instance if none can be found
- Throws:
XWikiException
- when failing to load the document revision
-
getDocument
public XWikiDocument getDocument(DocumentReference reference, XWikiContext context) throws XWikiException
- Parameters:
reference
- the reference of the documentcontext
- seeXWikiContext
- Throws:
XWikiException
- Since:
- 2.2M1
-
getDocument
public XWikiDocument getDocument(PageReference reference, XWikiContext context) throws XWikiException
- Parameters:
reference
- the reference of the pagecontext
- seeXWikiContext
- Throws:
XWikiException
- Since:
- 10.6RC1
-
getDocumentReference
public DocumentReference getDocumentReference(EntityReference reference, XWikiContext context)
Find the document reference corresponding to the entity reference based on what exist in the database (page reference can means two different documents for example).- Parameters:
reference
- the reference to resolvecontext
- the XWiki context- Returns:
- the document reference
- Since:
- 10.6RC1
-
getDocument
@Deprecated public XWikiDocument getDocument(String fullname, XWikiContext context) throws XWikiException
Deprecated.since 2.2M1 usegetDocument(DocumentReference, XWikiContext)
instead- Parameters:
fullname
- the reference of the document as Stringcontext
- seeXWikiContext
- Throws:
XWikiException
-
getDocument
@Deprecated public XWikiDocument getDocument(String spaces, String fullname, XWikiContext context) throws XWikiException
Deprecated.since 2.2M1 usegetDocument(DocumentReference, XWikiContext)
instead- Parameters:
spaces
- the reference of the space as Stringfullname
- the reference of the document as Stringcontext
- seeXWikiContext
- Throws:
XWikiException
-
getDeletedDocuments
public XWikiDeletedDocument[] getDeletedDocuments(String fullname, String locale, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- See Also:
XWiki.getDeletedDocuments(String, String)
-
getDeletedDocuments
public XWikiDeletedDocument[] getDeletedDocuments(String batchId, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 9.4RC1
- See Also:
XWiki.getDeletedDocuments(String)
-
getDeletedDocument
@Deprecated public XWikiDeletedDocument getDeletedDocument(String fullname, String locale, int index, XWikiContext context) throws XWikiException
Deprecated.since 9.4RC1. UsegetDeletedDocument(long, XWikiContext)
instead.- Throws:
XWikiException
- See Also:
XWiki.getDeletedDocument(String, String, String)
-
getDeletedDocument
public XWikiDeletedDocument getDeletedDocument(long index, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 9.4RC1
- See Also:
XWiki.getDeletedDocument(String)
-
getDeletedAttachments
public List<DeletedAttachment> getDeletedAttachments(String docName, XWikiContext context) throws XWikiException
Retrieve all the deleted attachments that belonged to a certain document. Note that this does not distinguish between different incarnations of a document name, and it does not require that the document still exists, it returns all the attachments that at the time of their deletion had a document with the specified name as their owner.- Parameters:
docName
- thename
of the owner documentcontext
- seeXWikiContext
- Returns:
- A list with all the deleted attachments which belonged to the specified document. If no such attachments are found in the trash, an empty list is returned.
- Throws:
XWikiException
- if an error occurs while loading the attachments
-
getDeletedAttachments
public List<DeletedAttachment> getDeletedAttachments(String docName, String filename, XWikiContext context) throws XWikiException
Retrieve all the deleted attachments that belonged to a certain document and had the specified name. Multiple versions can be returned since the same file can be uploaded and deleted several times, creating different instances in the trash. Note that this does not distinguish between different incarnations of a document name, and it does not require that the document still exists, it returns all the attachments that at the time of their deletion had a document with the specified name as their owner.- Parameters:
docName
- thename of the document
the attachment belonged tofilename
- thename
of the attachment to search forcontext
- seeXWikiContext
- Returns:
- A list with all the deleted attachments which belonged to the specified document and had the specified filename. If no such attachments are found in the trash, an empty list is returned.
- Throws:
XWikiException
- if an error occurs while loading the attachments
-
getDeletedAttachment
public DeletedAttachment getDeletedAttachment(String id, XWikiContext context) throws XWikiException
Retrieve a specific attachment from the trash.- Parameters:
id
- the unique identifier of the entry in the trashcontext
- the XWiki context- Returns:
- specified attachment from the trash,
null
if not found - Throws:
XWikiException
- if an error occurs while loading the attachments
-
getMetaclass
public MetaClass getMetaclass()
-
setMetaclass
public void setMetaclass(MetaClass metaclass)
-
getClassList
public List<String> getClassList(XWikiContext context) throws XWikiException
- Parameters:
context
- seeXWikiContext
- Throws:
XWikiException
-
search
public <T> List<T> search(String sql, XWikiContext context) throws XWikiException
- Parameters:
sql
- the sql query to executecontext
- seeXWikiContext
- Throws:
XWikiException
-
search
public <T> List<T> search(String sql, int nb, int start, XWikiContext context) throws XWikiException
- Parameters:
sql
- the sql query to executenb
- limit the number of results to returnstart
- the offset from which to start return resultscontext
- seeXWikiContext
- Throws:
XWikiException
-
search
public <T> List<T> search(String sql, Object[][] whereParams, XWikiContext context) throws XWikiException
- Parameters:
sql
- the sql query to executecontext
- seeXWikiContext
- Throws:
XWikiException
-
search
public <T> List<T> search(String sql, int nb, int start, Object[][] whereParams, XWikiContext context) throws XWikiException
- Parameters:
sql
- the sql query to executenb
- limit the number of results to returnstart
- the offset from which to start return resultscontext
- seeXWikiContext
- Throws:
XWikiException
-
parseContent
@Deprecated public String parseContent(String content, XWikiContext context)
Deprecated.Since 7.2M1. Use specific rendering/parsing options for the content type you want to parse/render.- Parameters:
content
- the content to parsecontext
- seeXWikiContext
-
parseTemplate
@Deprecated public String parseTemplate(String template, XWikiContext context)
Deprecated.useevaluateTemplate(String, XWikiContext)
instead- Parameters:
template
- the name of the templatecontext
- seeXWikiContext
-
evaluateTemplate
@Deprecated public String evaluateTemplate(String template, XWikiContext context) throws IOException
Deprecated.since 7.0M1, useTemplateManager.render(String)
insteadEvaluate provided template content using velocity engine.- Parameters:
template
- the template to evaluatecontext
- seeXWikiContext
- Returns:
- the return of the velocity script
- Throws:
IOException
- failed to get the template content- Since:
- 2.2.2
-
parseTemplate
@Deprecated public String parseTemplate(String template, String skinId, XWikiContext context)
Deprecated.since 7.0M1, useTemplateManager.renderFromSkin(java.lang.String, org.xwiki.skin.Skin)
instead- Parameters:
template
- the name of the templateskinId
- the id of the skin from which to load the templatecontext
- seeXWikiContext
-
renderTemplate
public String renderTemplate(String template, String skin, XWikiContext context)
- Parameters:
template
- the name of the templateskin
- the id of the skin from which to load the templatecontext
- seeXWikiContext
-
renderTemplate
public String renderTemplate(String template, XWikiContext context)
- Parameters:
template
- the name of the templatecontext
- seeXWikiContext
-
getIconURL
public String getIconURL(String iconName, XWikiContext context)
- Parameters:
iconName
- the standard name of an icon (it's not the name of the file on the filesystem, it's a generic name, for example "success" for a success iconcontext
- seeXWikiContext
- Returns:
- the URL to the icon resource
- Since:
- 2.6M1
-
getSkinFile
public String getSkinFile(String filename, XWikiContext context)
-
getSkinFile
public String getSkinFile(String filename, boolean forceSkinAction, XWikiContext context)
Build and return a skin file url based on the given parameters.- Parameters:
filename
- the file name of the skin file wantedforceSkinAction
- if true force the usage of directory /skins/ in the URLcontext
- current context for the request- Returns:
- a resource URL for the asked filename
-
getSkinFile
public String getSkinFile(String filename, String skin, XWikiContext context)
-
getSkinFile
public String getSkinFile(String fileName, String skinId, boolean forceSkinAction, XWikiContext context)
-
getSkin
@Deprecated public String getSkin(XWikiContext context)
Deprecated.since 7.0M1, useSkinManager.getCurrentSkin(boolean)
instead
-
getSkinPreference
public String getSkinPreference(String prefname, XWikiContext context)
-
getSkinPreference
public String getSkinPreference(String prefname, String defaultValue, XWikiContext context)
-
getDefaultBaseSkin
@Deprecated public String getDefaultBaseSkin(XWikiContext context)
Deprecated.since 7.0M1, useSkinManager.getDefaultParentSkin()
instead
-
getBaseSkin
@Deprecated public String getBaseSkin(XWikiContext context)
Deprecated.since 7.0M1
-
getBaseSkin
@Deprecated public String getBaseSkin(XWikiContext context, boolean fromRenderSkin)
Deprecated.since 7.0M1
-
getBaseSkin
@Deprecated public String getBaseSkin(String skin, XWikiContext context)
Deprecated.since 7.0M1, useSkinManager.getCurrentSkin(boolean)
andSkin.getParent()
instead- Parameters:
skin
- the name of the skin for which to return the base skin. For example :XWiki.DefaultSkin
context
- seeXWikiContext
- Returns:
- if found, the name of the base skin the asked skin inherits from. If not found, returns an empty string.
- Since:
- 2.0.2, 2.1M1
-
getSpaceCopyright
public String getSpaceCopyright(XWikiContext context)
-
getXWikiPreference
public String getXWikiPreference(String prefname, XWikiContext context)
-
getXWikiPreference
public String getXWikiPreference(String prefname, String fallbackParam, String defaultValue, XWikiContext context)
Obtain a preference value for the wiki, looking up first in the XWiki.XWikiPreferences document, then fallbacking on a config parameter when the first lookup gives an empty string, then returning the default value if the config parameter returned itself an empty string.- Parameters:
prefname
- the parameter to look for in the XWiki.XWikiPreferences object in the XWiki.XWikiPreferences document of the wiki.fallbackParam
- the parameter in xwiki.cfg to fallback on, in case the XWiki.XWikiPreferences object gave no resultdefaultValue
- the default value to fallback on, in case both XWiki.XWikiPreferences and the fallback xwiki.cfg parameter gave no result
-
getXWikiPreference
public String getXWikiPreference(String prefname, String wiki, String fallbackParam, String defaultValue, XWikiContext xcontext)
Obtain a preference value for the wiki, looking up first in the XWiki.XWikiPreferences document, then fallbacking on a config parameter when the first lookup gives an empty string, then returning the default value if the config parameter returned itself an empty string.- Parameters:
prefname
- the parameter to look for in the XWiki.XWikiPreferences object in the XWiki.XWikiPreferences document of the wiki.wiki
- the wiki to get preference fromfallbackParam
- the parameter in xwiki.cfg to fallback on, in case the XWiki.XWikiPreferences object gave no resultdefaultValue
- the default value to fallback on, in case both XWiki.XWikiPreferences and the fallback xwiki.cfg parameter gave no result- Since:
- 7.4M1
-
getXWikiPreference
public String getXWikiPreference(String prefname, String defaultValue, XWikiContext context)
-
getSpacePreference
public String getSpacePreference(String preference, XWikiContext context)
-
getSpacePreference
public String getSpacePreference(String preference, String defaultValue, XWikiContext context)
-
getSpacePreference
public String getSpacePreference(String preferenceKey, SpaceReference spaceReference, XWikiContext context)
Get the reference of the space and fallback on parent space or wiki in case nothing is found.If the property is not set on any level then empty String is returned.
- Parameters:
preferenceKey
- the name of the preference keyspaceReference
- the reference of the spacecontext
- seeXWikiContext
- Returns:
- the value of the preference or empty String if it could not be found
- Since:
- 7.4M1
-
getSpacePreference
public String getSpacePreference(String preferenceKey, SpaceReference spaceReference, String defaultValue, XWikiContext context)
Get the preference key for the space and fallback on parent space or wiki in case nothing is found.If the property is not set on any level then
defaultValue
is returned.- Parameters:
preferenceKey
- the name of the preference keyspaceReference
- the reference of the space. If null and there's a current document then the current space is used. If null and there's no current document then fall back to the wiki preferences.defaultValue
- the value to return if the preference can't be foundcontext
- seeXWikiContext
- Returns:
- the value of the preference or
defaultValue
if it could not be found - Since:
- 7.4M1
-
getUserPreference
public String getUserPreference(String prefname, XWikiContext context)
-
getUserPreferenceFromCookie
public String getUserPreferenceFromCookie(String prefname, XWikiContext context)
-
getUserPreference
public String getUserPreference(String prefname, boolean useCookie, XWikiContext context)
-
getLocalePreference
public Locale getLocalePreference(XWikiContext context)
The algorithm to find the locale to use is the following, in this order:- Try to find the current locale in use from the XWiki contex
- If the wiki is not multilingual use the wiki default locale (
default_language
xproperty inXWikiPreferences
xobject or English if not found) - If the wiki is multilingual
- Try to get the locale passed in the request (looking for a
language
query string parameter). If the language value isdefault
use the wiki default locale. If a parameter is found sets alanguage
cookie to remember the language in use. - Try to get the locale from the
language
cookie - If the default language is preferred (
xwiki.language.preferDefault
fromxwiki.cfg
orpreferDefaultLanguage
property from the space preferences (WebPreferences
xobject) or wiki preferences (XWikiPreferences
xobject})), and since the user didn't explicitly ask for a language already, then use the wiki default locale. - Try to use the browser's
Accept-Language
header sent in HTTP request. - Fallback to the wiki default locale
- Try to get the locale passed in the request (looking for a
- Returns:
- the locale to use
- Since:
- 8.0M1
-
getLanguagePreference
@Deprecated public String getLanguagePreference(XWikiContext context)
Deprecated.since 8.0M1, usegetLocalePreference(XWikiContext)
insteadFirst try to find the current locale in use from the XWiki context. If none is used and if the wiki is not multilingual use the default locale defined in the XWiki preferences. If the wiki is multilingual try to get the locale passed in the request. If none was passed try to get it from a cookie. If no locale cookie exists then use the user default locale and barring that use the browser's "Accept-Language" header sent in HTTP request. If none is defined use the default locale.- Returns:
- the locale to use
-
getDefaultLanguage
@Deprecated public String getDefaultLanguage(XWikiContext xcontext)
Deprecated.since 5.1M2 usegetDefaultLocale(XWikiContext)
instead
-
getDefaultLocale
public Locale getDefaultLocale(XWikiContext xcontext)
The default locale in the preferences.- Parameters:
xcontext
- the XWiki context.- Returns:
- the default locale
- Since:
- 5.1M2
-
getAvailableLocales
public List<Locale> getAvailableLocales(XWikiContext xcontext)
Get the available locales according to the preferences.- Parameters:
xcontext
- the XWiki context- Returns:
- all the available locales
- Since:
- 5.1M2
-
getDocLocalePreferenceNew
public Locale getDocLocalePreferenceNew(XWikiContext context)
- Since:
- 8.0M1
-
getDocLanguagePreferenceNew
@Deprecated public String getDocLanguagePreferenceNew(XWikiContext context)
Deprecated.since 8.0M1, usegetDocLocalePreferenceNew(XWikiContext)
instead
-
getInterfaceLocalePreference
public Locale getInterfaceLocalePreference(XWikiContext context)
- Since:
- 8.0M1
-
getInterfaceLanguagePreference
@Deprecated public String getInterfaceLanguagePreference(XWikiContext context)
Deprecated.since 8.0M1, usegetInterfaceLocalePreference(XWikiContext)
instead
-
getXWikiPreferenceAsLong
public long getXWikiPreferenceAsLong(String preference, XWikiContext context)
-
getSpacePreferenceAsLong
public long getSpacePreferenceAsLong(String preference, XWikiContext context)
-
getXWikiPreferenceAsLong
public long getXWikiPreferenceAsLong(String preference, long defaultValue, XWikiContext context)
-
getXWikiPreferenceAsLong
public long getXWikiPreferenceAsLong(String preference, String fallbackParameter, long defaultValue, XWikiContext context)
-
getSpacePreferenceAsLong
public long getSpacePreferenceAsLong(String preference, long defaultValue, XWikiContext context)
-
getUserPreferenceAsLong
public long getUserPreferenceAsLong(String preference, XWikiContext context)
-
getXWikiPreferenceAsInt
public int getXWikiPreferenceAsInt(String preference, XWikiContext context)
-
getSpacePreferenceAsInt
public int getSpacePreferenceAsInt(String preference, XWikiContext context)
-
getXWikiPreferenceAsInt
public int getXWikiPreferenceAsInt(String preference, int defaultValue, XWikiContext context)
-
getXWikiPreferenceAsInt
public int getXWikiPreferenceAsInt(String preference, String fallbackParameter, int defaultValue, XWikiContext context)
-
getSpacePreferenceAsInt
public int getSpacePreferenceAsInt(String preference, int defaultValue, XWikiContext context)
-
getUserPreferenceAsInt
public int getUserPreferenceAsInt(String prefname, XWikiContext context)
-
flushCache
public void flushCache(XWikiContext context)
-
getPluginManager
public XWikiPluginManager getPluginManager()
-
setPluginManager
public void setPluginManager(XWikiPluginManager pluginManager)
-
setStore
public void setStore(XWikiStoreInterface store)
-
setDefaultAttachmentContentStore
public void setDefaultAttachmentContentStore(XWikiAttachmentStoreInterface attachmentContentStore)
- Parameters:
attachmentContentStore
- the store to use by default when saving a new attachment content- Since:
- 9.10RC1
-
setAttachmentStore
@Deprecated public void setAttachmentStore(XWikiAttachmentStoreInterface attachmentStore)
Deprecated.since 9.9RC1, usesetDefaultAttachmentContentStore(XWikiAttachmentStoreInterface)
instead
-
setDefaultAttachmentArchiveStore
public void setDefaultAttachmentArchiveStore(AttachmentVersioningStore attachmentArchiveStore)
- Parameters:
attachmentArchiveStore
- the store to use by default when saving a new attachment archive- Since:
- 9.10RC1
-
setAttachmentVersioningStore
@Deprecated public void setAttachmentVersioningStore(AttachmentVersioningStore attachmentArchiveStore)
Deprecated.since 9.10RC1, usesetDefaultAttachmentArchiveStore(AttachmentVersioningStore)
instead
-
setVersioningStore
public void setVersioningStore(XWikiVersioningStoreInterface versioningStore)
-
setRecycleBinStore
public void setRecycleBinStore(XWikiRecycleBinStoreInterface recycleBinStore)
-
setAttachmentRecycleBinStore
public void setAttachmentRecycleBinStore(AttachmentRecycleBinStore attachmentRecycleBinStore)
-
setCriteriaService
public void setCriteriaService(XWikiCriteriaService criteriaService)
-
setVersion
public void setVersion(String version)
-
getTagClass
public BaseClass getTagClass(XWikiContext context) throws XWikiException
Verify if theXWiki.TagClass
page exists and that it contains all the required configuration properties to make the tag feature work properly. If some properties are missing they are created and saved in the database.- Parameters:
context
- seeXWikiContext
- Returns:
- the TagClass Base Class object containing the properties
- Throws:
XWikiException
- if an error happens during the save to the datavase
-
getSheetClass
@Deprecated public BaseClass getSheetClass(XWikiContext context) throws XWikiException
Deprecated.since 3.1M2 edit mode class should be used for this purpose, not the sheet classVerify if theXWiki.SheetClass
page exists and that it contains all the required configuration properties to make the sheet feature work properly. If some properties are missing they are created and saved in the database. SheetClass is used to a page as a sheet. When a page is tagged as a sheet and that page is included in another page using the include macro then editing it triggers automatic inline edition (for XWiki Syntax 2.0 only - for XWiki Syntax 1.0 automatic inline edition is triggered using #includeForm).- Parameters:
context
- seeXWikiContext
- Returns:
- the SheetClass Base Class object containing the properties
- Throws:
XWikiException
- if an error happens during the save to the database- See Also:
getEditModeClass(XWikiContext)
-
getEditModeClass
public BaseClass getEditModeClass(XWikiContext context) throws XWikiException
Verify if theXWiki.EditModeClass
page exists and that it contains all the required configuration properties to make the edit mode feature work properly. If some properties are missing they are created and saved in the database. EditModeClass is used to specify the default edit mode of a page. It can also be used to mark a page as a sheet. When a page is marked as a sheet and that page is included in another page using the include macro then editing it triggers automatic inline edition (for XWiki Syntax 2.0 only - for XWiki Syntax 1.0 automatic inline edition is triggered using #includeForm). It replaces and enhances the SheetClass mechanism (seegetSheetClass(XWikiContext)
).- Parameters:
context
- seeXWikiContext
- Returns:
- the EditModeClass Base Class object containing the properties
- Throws:
XWikiException
- if an error happens during the save to the database- Since:
- 3.1M2
-
getUserClass
public BaseClass getUserClass(XWikiContext context) throws XWikiException
Verify if theXWiki.XWikiUsers
page exists and that it contains all the required configuration properties to make the user feature work properly. If some properties are missing they are created and saved in the database.- Parameters:
context
- seeXWikiContext
- Returns:
- the XWikiUsers Base Class object containing the properties
- Throws:
XWikiException
- if an error happens during the save to the datavase
-
getRedirectClass
public BaseClass getRedirectClass(XWikiContext context) throws XWikiException
Verify if theXWiki.GlobalRedirect
page exists and that it contains all the required configuration properties to make the redirection feature work properly. If some properties are missing they are created and saved in the database.- Parameters:
context
- seeXWikiContext
- Returns:
- the GlobalRedirect Base Class object containing the properties
- Throws:
XWikiException
- if an error happens during the save to the datavase
-
getPrefsClass
public BaseClass getPrefsClass(XWikiContext context) throws XWikiException
Verify if theXWiki.XWikiPreferences
page exists and that it contains all the required configuration properties to make XWiki work properly. If some properties are missing they are created and saved in the database.- Parameters:
context
- seeXWikiContext
- Returns:
- the XWiki Base Class object containing the properties
- Throws:
XWikiException
- if an error happens during the save to the datavase
-
getGroupClass
public BaseClass getGroupClass(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getRightsClass
public BaseClass getRightsClass(String pagename, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getRightsClass
public BaseClass getRightsClass(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getGlobalRightsClass
public BaseClass getGlobalRightsClass(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getCommentsClass
public BaseClass getCommentsClass(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getSkinClass
public BaseClass getSkinClass(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
createUser
public int createUser(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
validateUser
public int validateUser(boolean withConfirmEmail, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
createUser
public int createUser(boolean withValidation, String userRights, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
createEmptyUser
public boolean createEmptyUser(String xwikiname, String userRights, XWikiContext context) throws XWikiException
Method allows to create an empty user with no password (he won't be able to login) This method is usefull for authentication like LDAP or App Server trusted- Parameters:
xwikiname
-userRights
-context
- seeXWikiContext
- Returns:
- true if success
- Throws:
XWikiException
-
sendConfirmationEmail
public void sendConfirmationEmail(String xwikiname, String password, String email, String message, String contentfield, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
sendValidationEmail
public void sendValidationEmail(String xwikiname, String password, String email, String validkey, String contentfield, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
sendValidationEmail
public void sendValidationEmail(String xwikiname, String password, String email, String addfieldname, String addfieldvalue, String contentfield, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
generateRandomString
public String generateRandomString(int size)
-
generateValidationKey
public String generateValidationKey(int size)
-
createUser
public int createUser(String userName, Map<String,?> map, XWikiContext context) throws XWikiException
Create a new user.- Parameters:
userName
- the name of the user (without the space)map
- extra datas to add to user profile objectcontext
- seeXWikiContext
- Returns:
- 1: ok
- -3: user already exists
- Throws:
XWikiException
- failed to create the new user
-
createUser
public int createUser(String userName, Map<String,?> map, String userRights, XWikiContext context) throws XWikiException
Create a new user.- Parameters:
userName
- the name of the user (without the space)map
- extra datas to add to user profile objectuserRights
- the right of the user on his own profile pagecontext
- seeXWikiContext
- Returns:
- 1: ok
- -3: user already exists
- Throws:
XWikiException
- failed to create the new user
-
createUser
@Deprecated public int createUser(String userName, Map<String,?> map, String parent, String content, String syntaxId, String userRights, XWikiContext context) throws XWikiException
Deprecated.since 2.4RC1 usecreateUser(String, Map, EntityReference, String, Syntax, String, XWikiContext)
instead- Throws:
XWikiException
-
createUser
public int createUser(String userName, Map<String,?> map, EntityReference parentReference, String content, org.xwiki.rendering.syntax.Syntax syntax, String userRights, XWikiContext context) throws XWikiException
Create a new user.- Parameters:
userName
- the name of the user (without the space)map
- extra datas to add to user profile objectparentReference
- the parent of the user profilecontent
- the content of the user profilesyntax
- the syntax of the provided contentuserRights
- the right of the user on his own profile pagecontext
- seeXWikiContext
- Returns:
- 1: ok
- -3: user already exists
- Throws:
XWikiException
- failed to create the new user
-
createUser
@Deprecated public int createUser(String xwikiname, Map<String,?> map, String parent, String content, String userRights, XWikiContext context) throws XWikiException
Deprecated.starting with XE 1.8.1 usecreateUser(String, Map, String, String, String, String, XWikiContext)
instead- Throws:
XWikiException
-
setUserDefaultGroup
public void setUserDefaultGroup(String fullwikiname, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
addUserToGroup
protected void addUserToGroup(String userName, String groupName, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
protectUserPage
public void protectUserPage(String userName, String userRights, XWikiDocument doc, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getUser
public User getUser(XWikiContext context)
-
getUser
@Deprecated public User getUser(String username, XWikiContext context)
Deprecated.since 11.8RC1 prefer usinggetUser(DocumentReference, XWikiContext)
.
-
getUser
public User getUser(DocumentReference userReference, XWikiContext context)
Retrieve a user from its document reference.- Parameters:
userReference
- the reference of the user.context
- the current context.- Returns:
- the user corresponding to that document reference.
- Since:
- 11.8RC1
-
prepareResources
public void prepareResources(XWikiContext context)
Prepares the localized resources, according to the selected locale. Set context "msg" and locale.- Parameters:
context
- seeXWikiContext
-
checkAuth
public XWikiUser checkAuth(XWikiContext context) throws XWikiException
Authenticate the user from the context and check if the user is disabled or not. If the user is disabled, the method returnsnull
but set the reference of the authenticated user in the context with theXWikiContext.INACTIVE_USER_REFERENCE
property.- Parameters:
context
- the context used to authenticate the user.- Returns:
- an
XWikiUser
if the user is authenticated and enabled, elsenull
. - Throws:
XWikiException
- in case of problem when dealing with the authentication.
-
checkAccess
public boolean checkAccess(String action, XWikiDocument doc, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
include
public String include(String topic, boolean isForm, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
deleteDocument
public void deleteDocument(XWikiDocument doc, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
deleteDocument
public void deleteDocument(XWikiDocument doc, boolean totrash, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
checkDeletingDocument
public void checkDeletingDocument(DocumentReference userReference, XWikiDocument document, XWikiContext context) throws XWikiException
Check if the user is allowed to delete the document.- Parameters:
userReference
- the user responsible for the deletedocument
- the document to deletecontext
- the XWiki context- Throws:
XWikiException
- when failing to delete- Since:
- 11.6, 10.11.10
-
deleteDocumentVersions
@Unstable public void deleteDocumentVersions(XWikiDocument document, String version1, String version2, XWikiContext context) throws XWikiException
Delete a range of versions from a document history.- Parameters:
document
- the document from which to delete versionsversion1
- one end of the versions range to removeversion2
- the other end of the versions range to removecontext
- the XWiki context- Throws:
XWikiException
- Since:
- 13.6RC1
-
getDatabase
public String getDatabase()
-
setDatabase
public void setDatabase(String database)
-
gc
public void gc()
-
freeMemory
public long freeMemory()
-
totalMemory
public long totalMemory()
-
maxMemory
public long maxMemory()
-
printStrackTrace
@Deprecated public String printStrackTrace(Throwable e)
Deprecated.useExceptionUtils.getStackTrace(Throwable)
instead
-
renameDocument
public boolean renameDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, boolean overwrite, List<DocumentReference> backlinkDocumentReferences, List<DocumentReference> childDocumentReferences, XWikiContext context) throws XWikiException
API to rename a document to another document.- Parameters:
sourceDocumentReference
- the source document to rename.targetDocumentReference
- the target reference to rename the document to.overwrite
- iftrue
the target document reference will be overwritten if it exists (deleted to the recycle bin before the rename). Iffalse
and the target document exist the rename won't be performed.backlinkDocumentReferences
- the list of references of documents to parse and for which links will be modified to point to the new document referencechildDocumentReferences
- the list of references of document whose parent field will be set to the new document reference- Returns:
true
if the rename succeeded.false
if there was any issue.- Throws:
XWikiException
- if the document cannot be renamed properly.- Since:
- 12.5RC1
-
renameByCopyAndDelete
@Deprecated public void renameByCopyAndDelete(XWikiDocument sourceDoc, DocumentReference newDocumentReference, List<DocumentReference> backlinkDocumentReferences, List<DocumentReference> childDocumentReferences, XWikiContext context) throws XWikiException
Deprecated.Old implementation of the rename by copy and delete. Since 12.5 the implementation usingXWikiStoreInterface.renameXWikiDoc(XWikiDocument, DocumentReference, XWikiContext)
should be preferred.Perform a rename of document by copying the document and deleting the old one. This operation must be used only in case of document rename from one wiki to another, since it's not supported by the atomic store operation.- Parameters:
newDocumentReference
- the new document referencebacklinkDocumentReferences
- the list of references of documents to parse and for which links will be modified to point to the new document referencechildDocumentReferences
- the list of references of document whose parent field will be set to the new document referencecontext
- the ubiquitous XWiki Context- Throws:
XWikiException
- in case of an error- Since:
- 12.5
-
copyDocument
public boolean copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.2M2
-
copyDocument
public boolean copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, boolean reset, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.2M2
-
copyDocument
public boolean copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, boolean reset, boolean force, boolean resetCreationData, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.2M2
-
copyDocument
public boolean copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, String wikilocale, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.2M2
-
copyDocument
public boolean copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, String wikilocale, boolean reset, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.2M2
-
copyDocument
public boolean copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, String wikilocale, boolean reset, boolean force, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.2M2
-
copyDocument
public boolean copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, String wikilocale, boolean reset, boolean force, boolean resetCreationData, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.2M2
-
copySpaceBetweenWikis
public int copySpaceBetweenWikis(String space, String sourceWiki, String targetWiki, String locale, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
copySpaceBetweenWikis
public int copySpaceBetweenWikis(String space, String sourceWiki, String targetWiki, String locale, boolean clean, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
copyWiki
@Deprecated public int copyWiki(String sourceWiki, String targetWiki, String locale, XWikiContext context) throws XWikiException
Deprecated.since 5.3, useWikiManager.copy(String, String, String, boolean, boolean, boolean)
insteadCopy an entire wiki to a target wiki.It does not override document already existing in target wiki.
- Parameters:
sourceWiki
- the source wiki identifiertargetWiki
- the target wiki identifierlocale
- the locale to copycontext
- seeXWikiContext
- Returns:
- the number of copied documents
- Throws:
XWikiException
- failed to copy wiki
-
copyWiki
@Deprecated public int copyWiki(String sourceWiki, String targetWiki, String locale, boolean clean, XWikiContext context) throws XWikiException
Deprecated.since 5.3, useWikiManager.copy(String, String, String, boolean, boolean, boolean)
insteadCopy an entire wiki to a target wiki.- Parameters:
sourceWiki
- the source wiki identifiertargetWiki
- the target wiki identifierlocale
- the locale to copyclean
- clean the target wiki before copyingcontext
- seeXWikiContext
- Returns:
- the number of copied documents
- Throws:
XWikiException
- failed to copy wiki
-
getEncoding
public String getEncoding()
-
getServerURL
public URL getServerURL(String wikiId, XWikiContext xcontext) throws MalformedURLException
- Throws:
MalformedURLException
-
getServletPath
public String getServletPath(String wikiName, XWikiContext context)
-
getWebAppPath
public String getWebAppPath(XWikiContext context)
-
getURL
public String getURL(EntityReference entityReference, String action, String queryString, String anchor, XWikiContext context)
- Since:
- 7.2M1
-
getURL
public String getURL(EntityReference reference, String action, XWikiContext context)
- Since:
- 7.2M1
-
getURL
public String getURL(EntityReference reference, XWikiContext context)
- Since:
- 7.2RC1
-
getURL
public String getURL(DocumentReference documentReference, String action, String queryString, String anchor, XWikiContext context)
- Since:
- 2.2.1
-
getURL
@Deprecated public String getURL(String fullname, String action, String queryString, String anchor, XWikiContext context)
Deprecated.since 2.2.1 usegetURL(DocumentReference, String, String, String, XWikiContext)
-
getURL
public String getURL(String fullname, String action, String querystring, XWikiContext context)
-
getURL
public String getURL(DocumentReference reference, String action, XWikiContext context)
- Since:
- 2.3M2
-
getURL
@Deprecated public String getURL(String fullname, String action, XWikiContext context)
Deprecated.since 2.3M2 usegetURL(DocumentReference, String, XWikiContext)
-
getExternalURL
public String getExternalURL(String fullname, String action, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getExternalURL
public String getExternalURL(String fullname, String action, String querystring, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getExternalURL
public String getExternalURL(DocumentReference documentReference, String action, String querystring, String anchor, XWikiContext context)
Get the full URL of the givenDocumentReference
. This also includes the server name of the wiki.- Parameters:
documentReference
- the document that should be resolvedaction
- the action of the URLquerystring
- the URL parametersanchor
- the anchor of the documentcontext
- the current XWikiContext- Returns:
- the full URL of the given reference
- Since:
- 9.6RC1
-
getAttachmentURL
public String getAttachmentURL(AttachmentReference attachmentReference, String action, String queryString, XWikiContext context)
- Since:
- 7.2M1
-
getAttachmentURL
public String getAttachmentURL(AttachmentReference attachmentReference, String queryString, XWikiContext context)
- Since:
- 7.2M1
-
getAttachmentRevisionURL
public String getAttachmentRevisionURL(AttachmentReference attachmentReference, String revision, String queryString, XWikiContext context)
- Since:
- 7.2M1
-
getAttachmentURL
public String getAttachmentURL(String fullname, String filename, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getAttachmentURL
public String getAttachmentURL(String fullname, String filename, String queryString, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.5RC1
-
getTimeDelta
public int getTimeDelta(long time)
-
isMultiLingual
public boolean isMultiLingual(XWikiContext context)
-
isLDAP
public boolean isLDAP()
-
isAllGroupImplicit
public boolean isAllGroupImplicit()
- Returns:
- true if XWikiAllGroup group should be seen as virtual group containing all users, false to use it as any other group
- Since:
- 9.3RC1
-
checkActive
@Deprecated public int checkActive(XWikiContext context) throws XWikiException
Deprecated.since 11.8RC1 prefer usingXWikiUser.isDisabled(XWikiContext)
.- Throws:
XWikiException
-
checkActive
@Deprecated public int checkActive(String user, XWikiContext context) throws XWikiException
Deprecated.since 11.8RC1 prefer usingXWikiUser.isDisabled(XWikiContext)
.- Throws:
XWikiException
-
getDocumentReference
public DocumentReference getDocumentReference(XWikiRequest request, XWikiContext context)
- Since:
- 2.3M1
-
stripSegmentFromPath
public static String stripSegmentFromPath(String path, String segment)
Helper method, removes a predefined path segment (the context path or the servel path) from the start of the requested URI and returns the remainder. This method is needed because special characters in the path can be URL-encoded, depending on whether the request is forwarded through the request dispatcher or not, and also depending on the client (some browsers encode -, while some don't).- Parameters:
path
- the path, as taken from the requested URIsegment
- the segment to remove, as reported by the container- Returns:
- the path with the specified segment trimmed from its start
-
prepareDocuments
public boolean prepareDocuments(XWikiRequest request, XWikiContext context, org.apache.velocity.VelocityContext vcontext) throws XWikiException
- Throws:
XWikiException
-
setPhonyDocument
public void setPhonyDocument(DocumentReference reference, XWikiContext context)
- Since:
- 8.3M1
-
setPhonyDocument
@Deprecated public void setPhonyDocument(DocumentReference reference, XWikiContext context, org.apache.velocity.VelocityContext vcontext)
Deprecated.since 8.3M1, usesetPhonyDocument(DocumentReference, XWikiContext)
instead- Since:
- 2.3M1
-
setPhonyDocument
@Deprecated public void setPhonyDocument(String docName, XWikiContext context, org.apache.velocity.VelocityContext vcontext)
Deprecated.
-
getEngineContext
public XWikiEngineContext getEngineContext()
-
setEngineContext
public void setEngineContext(XWikiEngineContext engine_context)
-
setAuthService
public void setAuthService(XWikiAuthService authService)
-
setRightService
public void setRightService(XWikiRightService rightService)
-
getGroupService
public XWikiGroupService getGroupService(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
setGroupService
public void setGroupService(XWikiGroupService groupService)
-
getAuthService
public XWikiAuthService getAuthService()
-
getRightService
public XWikiRightService getRightService()
-
getStatsService
public XWikiStatsService getStatsService(XWikiContext context)
-
getURLFactoryService
public XWikiURLFactoryService getURLFactoryService()
-
getCriteriaService
public XWikiCriteriaService getCriteriaService(XWikiContext context)
-
getZipOutputStream
public ZipOutputStream getZipOutputStream(XWikiContext context) throws IOException
- Throws:
IOException
-
getRefererText
public String getRefererText(String referer, XWikiContext context)
-
isMySQL
public boolean isMySQL()
-
getFullNameSQL
public String getFullNameSQL()
-
getFullNameSQL
public String getFullNameSQL(boolean newFullName)
-
getUserName
public String getUserName(String user, XWikiContext context)
-
getUserName
public String getUserName(String user, String format, XWikiContext context)
-
getUserName
public String getUserName(String user, String format, boolean link, XWikiContext context)
- Returns:
- a formatted and pretty printed user name for displaying
-
getUserName
public String getUserName(DocumentReference userReference, String format, boolean link, boolean escapeXML, XWikiContext context)
Generate a display user name and return it.- Parameters:
userReference
-format
- a Velocity scnippet used to format the user namelink
- true if a full html link snippet should be returnedescapeXML
- true if the returned name should be escaped (forced true iflink
is true)context
- seeXWikiContext
- Returns:
- the display user name or a html snippet with the link to the passed user
- Since:
- 6.4RC1
-
evaluateVelocity
public String evaluateVelocity(String content, String namespace, org.apache.velocity.VelocityContext vcontext)
- Parameters:
content
- the Velocity content to evaluatenamespace
- the namespace under which to evaluate it (used for isolation)vcontext
- the Velocity context to use when evaluating. Ifnull
, then a new context will be created, initialized and used.- Returns:
- the evaluated content
- Since:
- 7.2M1
-
evaluateVelocity
public String evaluateVelocity(String content, String name)
- Parameters:
content
- the Velocity content to evaluatename
- the namespace under which to evaluate it (used for isolation)- Returns:
- the evaluated content
- Since:
- 7.2M1
-
getPlainUserName
public String getPlainUserName(DocumentReference userReference, XWikiContext context)
Generate and return an unescaped user display name.- Parameters:
userReference
- the user referencecontext
- seeXWikiContext
- Returns:
- the unescaped display user name
- Since:
- 6.4RC1
-
hasCentralizedAuthentication
public boolean hasCentralizedAuthentication(XWikiContext context)
-
getLocalUserName
public String getLocalUserName(String user, XWikiContext context)
-
getLocalUserName
public String getLocalUserName(String user, String format, XWikiContext context)
-
getLocalUserName
public String getLocalUserName(String user, String format, boolean link, XWikiContext context)
-
formatDate
public String formatDate(Date date, String format, XWikiContext context)
-
getUserTimeZone
public String getUserTimeZone(XWikiContext context)
-
exists
@Deprecated public boolean exists(String fullname, XWikiContext context) throws XWikiException
Deprecated.since 2.2.1 useexists(DocumentReference, XWikiContext)
- Throws:
XWikiException
-
exists
public boolean exists(DocumentReference documentReference, XWikiContext context) throws XWikiException
Check if a document exist.Since 14.9, if the check fail an exception is thrown.
- Parameters:
documentReference
- the reference of the documentcontext
- the XWiki context- Returns:
- true if the document exist or false if it does not
- Throws:
XWikiException
- when failing to check document existence
-
exists
@Unstable public boolean exists(PageReference reference, XWikiContext context) throws XWikiException
Returns whether a page exists or not.Since 14.9, if the check fail an exception is thrown.
- Parameters:
reference
- the reference of the page to check for its existence- Returns:
- true if the page exists, false if not
- Throws:
XWikiException
- when failing to check page existence- Since:
- 13.3RC1, 12.10.7
-
getAdType
public String getAdType(XWikiContext context)
-
getAdClientId
public String getAdClientId(XWikiContext context)
-
getPlugin
@Deprecated public XWikiPluginInterface getPlugin(String name, XWikiContext context)
Deprecated.
-
getPluginApi
@Deprecated public Api getPluginApi(String name, XWikiContext context)
Deprecated.
-
getHttpTimeout
public int getHttpTimeout(XWikiContext context)
-
getHttpUserAgent
public String getHttpUserAgent(XWikiContext context)
-
getURLContent
public String getURLContent(String surl, XWikiContext context) throws IOException
- Throws:
IOException
-
getURLContent
public String getURLContent(String surl, int timeout, String userAgent) throws IOException
- Throws:
IOException
-
getURLContent
public String getURLContent(String surl, String username, String password, XWikiContext context) throws IOException
- Throws:
IOException
-
getURLContent
public String getURLContent(String surl, String username, String password, int timeout, String userAgent) throws IOException
- Throws:
IOException
-
getURLContentAsBytes
public byte[] getURLContentAsBytes(String surl, XWikiContext context) throws IOException
- Throws:
IOException
-
getURLContentAsBytes
public byte[] getURLContentAsBytes(String surl, int timeout, String userAgent) throws IOException
- Throws:
IOException
-
getURLContentAsBytes
public byte[] getURLContentAsBytes(String surl, String username, String password, XWikiContext context) throws IOException
- Throws:
IOException
-
getURLContentAsBytes
public byte[] getURLContentAsBytes(String surl, String username, String password, int timeout, String userAgent) throws IOException
- Throws:
IOException
-
getSpaces
@Deprecated public List<String> getSpaces(XWikiContext context) throws XWikiException
Deprecated.use query service insteadAPI to list all spaces in the current wiki.Hidden spaces are filtered unless current user enabled them.
- Returns:
- a list of string representing all non-hidden spaces (ie spaces that have non-hidden pages) for the current wiki
- Throws:
XWikiException
- if something went wrong
-
getSpaceDocsName
@Deprecated public List<String> getSpaceDocsName(String spaceReference, XWikiContext context) throws XWikiException
Deprecated.use query service insteadAPI to list all non-hidden documents in a space.- Parameters:
spaceReference
- the local reference of the space for which to return all non-hidden documents- Returns:
- the list of document names (in the format
Space.Page
) for non-hidden documents in the specified space - Throws:
XWikiException
- if the loading went wrong
-
getIncludedMacros
public List<String> getIncludedMacros(String defaultSpace, String content, XWikiContext context)
-
isReadOnly
public boolean isReadOnly()
accessor for the isReadOnly instance var.- See Also:
isReadOnly
-
setReadOnly
public void setReadOnly(boolean readOnly)
-
deleteAllDocuments
public void deleteAllDocuments(XWikiDocument doc, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
deleteAllDocuments
public void deleteAllDocuments(XWikiDocument doc, boolean toTrash, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
refreshLinks
public void refreshLinks(XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
hasBacklinks
public boolean hasBacklinks(XWikiContext context)
-
hasTags
public boolean hasTags(XWikiContext context)
-
hasCustomMappings
public boolean hasCustomMappings()
-
hasDynamicCustomMappings
public boolean hasDynamicCustomMappings()
-
getDefaultSpace
public String getDefaultSpace(XWikiContext context)
-
showViewAction
public boolean showViewAction(XWikiContext context)
-
useDefaultAction
public boolean useDefaultAction(XWikiContext context)
-
getDefaultPage
public String getDefaultPage(XWikiContext context)
-
hasEditComment
public boolean hasEditComment(XWikiContext context)
-
isEditCommentFieldHidden
public boolean isEditCommentFieldHidden(XWikiContext context)
-
isEditCommentSuggested
public boolean isEditCommentSuggested(XWikiContext context)
-
isEditCommentMandatory
public boolean isEditCommentMandatory(XWikiContext context)
-
hasMinorEdit
public boolean hasMinorEdit(XWikiContext context)
- See Also:
XWiki.hasMinorEdit()
-
hasRecycleBin
public boolean hasRecycleBin(XWikiContext context)
- Parameters:
context
- seeXWikiContext
- See Also:
XWiki.hasRecycleBin()
-
hasAttachmentRecycleBin
public boolean hasAttachmentRecycleBin(XWikiContext context)
Indicates whether deleted attachments are stored in a recycle bin or not. This can be configured using the key storage.attachment.recyclebin.- Parameters:
context
- seeXWikiContext
-
getXClass
public BaseClass getXClass(DocumentReference documentReference, XWikiContext context) throws XWikiException
- Throws:
XWikiException
- Since:
- 2.2M2
-
getClass
@Deprecated public BaseClass getClass(String fullName, XWikiContext context) throws XWikiException
Deprecated.since 2.2M2 usegetXClass(DocumentReference, XWikiContext)
- Throws:
XWikiException
-
getEditorPreference
public String getEditorPreference(XWikiContext context)
-
parseGroovyFromString
public Object parseGroovyFromString(String script, XWikiContext xcontext) throws XWikiException
Privileged API to retrieve an object instantiated from groovy code in a String. Note that Groovy scripts compilation is cached.- Parameters:
script
- the Groovy class definition string (public class MyClass { ... })- Returns:
- An object instantiating this class
- Throws:
XWikiException
-
parseGroovyFromString
public Object parseGroovyFromString(String script, String jarWikiPage, XWikiContext xcontext) throws XWikiException
Privileged API to retrieve an object instantiated from groovy code in a String, using a classloader including all JAR files located in the passed page as attachments. Note that Groovy scripts compilation is cached- Parameters:
script
- the Groovy class definition string (public class MyClass { ... })- Returns:
- An object instantiating this class
- Throws:
XWikiException
-
parseGroovyFromPage
public Object parseGroovyFromPage(String fullName, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
parseGroovyFromPage
public Object parseGroovyFromPage(String fullName, String jarWikiPage, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getMacroList
public String getMacroList(XWikiContext context)
-
getObjectFromRequest
public BaseObject getObjectFromRequest(String className, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
getConvertingUserNameType
public String getConvertingUserNameType(XWikiContext context)
-
convertUsername
public String convertUsername(String username, XWikiContext context)
-
hasSectionEdit
public boolean hasSectionEdit(XWikiContext context)
-
getSectionEditingDepth
public long getSectionEditingDepth()
- Returns:
- The maximum section depth for which section editing is available. This can be customized through the
xwiki.section.depth
configuration property. Defaults to 2 when not defined.
-
getWysiwygToolbars
public String getWysiwygToolbars(XWikiContext context)
-
clearName
public String clearName(String name, XWikiContext context)
-
clearName
public String clearName(String name, boolean stripDots, boolean ascii, XWikiContext context)
-
getUniquePageName
public String getUniquePageName(String space, XWikiContext context) throws XWikiException
Generates a unique page name based on initial page name and already existing pages.Since 14.9, if the document exist check fail an exception is thrown.
- Parameters:
space
- the space where to add a new documentcontext
- the XWiki context- Returns:
- a unique document name
- Throws:
XWikiException
- when failing to check document existence
-
getUniquePageName
public String getUniquePageName(String space, String name, XWikiContext context) throws XWikiException
Generates a unique page name based on initial page name and already existing pages.Since 14.9, if the document exist check fail an exception is thrown.
- Parameters:
space
- the space where to add a new documentname
- the prefix of the document namecontext
- the XWiki context- Returns:
- a unique document name
- Throws:
XWikiException
- when failing to check document existence
-
getPropertyClassFromName
public PropertyClass getPropertyClassFromName(String propPath, XWikiContext context)
-
validateDocument
public boolean validateDocument(XWikiDocument doc, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
addTooltip
public String addTooltip(String html, String message, String params, XWikiContext context)
-
addTooltipJS
public String addTooltipJS(XWikiContext context)
-
addTooltip
public String addTooltip(String html, String message, XWikiContext context)
-
addMandatory
public String addMandatory(XWikiContext context)
-
hasVersioning
public boolean hasVersioning(XWikiContext context)
- Since:
- 2.3M1
-
hasAttachmentVersioning
public boolean hasAttachmentVersioning(XWikiContext context)
-
getExternalAttachmentURL
public String getExternalAttachmentURL(String fullName, String filename, XWikiContext context)
-
getMaxRecursiveSpaceChecks
public int getMaxRecursiveSpaceChecks(XWikiContext context)
-
restoreFromRecycleBin
public void restoreFromRecycleBin(XWikiDocument doc, String comment, XWikiContext context) throws XWikiException
Restore a document with passed index from recycle bin.- Parameters:
doc
- the document to restorecomment
- the comment to use when saving the documentcontext
- seeXWikiContext
- Throws:
XWikiException
- when failing to restore document- Since:
- 5.4RC1
-
restoreFromRecycleBin
@Deprecated public void restoreFromRecycleBin(XWikiDocument doc, long index, String comment, XWikiContext context) throws XWikiException
Deprecated.since 9.4RC1. UserestoreFromRecycleBin(long, String, XWikiContext)
instead.Restore a document with passed index from recycle bin.- Parameters:
doc
- the document to restoreindex
- the index of the document in the recycle bincomment
- the comment to use when saving the documentcontext
- seeXWikiContext
- Throws:
XWikiException
- when failing to restore document- Since:
- 5.4RC1
-
restoreFromRecycleBin
public void restoreFromRecycleBin(long index, String comment, XWikiContext context) throws XWikiException
Restore a document with passed index from recycle bin.- Parameters:
index
- the index of the document in the recycle bincomment
- the comment to use when saving the documentcontext
- seeXWikiContext
- Throws:
XWikiException
- when failing to restore document- Since:
- 9.4RC1
-
rollback
public XWikiDocument rollback(XWikiDocument tdoc, String rev, XWikiContext context) throws XWikiException
- Throws:
XWikiException
-
rollback
public XWikiDocument rollback(XWikiDocument tdoc, String rev, boolean addRevision, XWikiContext xcontext) throws XWikiException
- Parameters:
tdoc
- the document to rollbackrev
- the revision to rollback toaddRevision
- true if a new revision should be createdxcontext
- the XWiki context- Returns:
- the new document
- Throws:
XWikiException
- when failing to rollback the document- Since:
- 10.7RC1, 9.11.8
-
getDefaultDocumentSyntax
public String getDefaultDocumentSyntax()
- Returns:
- the syntax id of the syntax to use when creating new documents
-
getCurrentContentSyntaxId
public String getCurrentContentSyntaxId(String defaultSyntaxId, XWikiContext context)
Get the syntax of the content currently being executed.The document currently being executed is not the same than the actual content syntax since the executed code might come from an included page or some macro that change the context syntax. The same logic used inside rendering macros is used (see
MacroContentParser
).If the current document can't be found, the method assume that the executed document is the context document (it's generally the case when a document is directly rendered with
XWikiDocument.getRenderedContent(XWikiContext)
for example).- Parameters:
defaultSyntaxId
- the default value to return if no document can be found- Returns:
- the syntax identifier
-
getCurrentContentSyntaxId
public String getCurrentContentSyntaxId(XWikiContext context)
Get the syntax of the content currently being executed.The document currently being executed is not the same than the actual content syntax since the executed code might come from an included page or some macro that change the context syntax. The same logic used inside rendering macros is used (see
MacroContentParser
).If the current document can't be found, the method assume that the executed document is the context document (it's generally the case when a document is directly rendered with
XWikiDocument.getRenderedContent(XWikiContext)
for example).- Returns:
- the syntax identifier
-
isTitleInCompatibilityMode
public boolean isTitleInCompatibilityMode()
- Returns:
- true if title handling should be using the compatibility mode or not. When the compatibility mode is active, if the document's content first header (level 1 or level 2) matches the document's title the first header is stripped.
-
onEvent
public void onEvent(Event event, Object source, Object data)
- Specified by:
onEvent
in interfaceorg.xwiki.observation.EventListener
-
getEvents
public List<Event> getEvents()
- Specified by:
getEvents
in interfaceorg.xwiki.observation.EventListener
-
getName
public String getName()
- Specified by:
getName
in interfaceorg.xwiki.observation.EventListener
-
searchAttachments
@Deprecated public List<XWikiAttachment> searchAttachments(String parametrizedSqlClause, boolean checkRight, int nb, int start, List<?> parameterValues, XWikiContext context) throws XWikiException
Deprecated.since 9.7RC1, use the QueryManager instead along with the "attachment" query filterSearch attachments by passing HQL where clause values as parameters. You can specify properties of the "attach" (the attachment) or "doc" (the document it is attached to)- Parameters:
parametrizedSqlClause
- The HQL where clause. For examplewhere doc.fullName <> ?1 and (attach.author = ?2 or (attach.filename = ?3 and doc.space = ?4))
checkRight
- if true, only return attachments in documents which the "current user" has permission to view.nb
- The number of rows to return. If 0 then all rows are returnedstart
- The number of rows to skip at the beginning.parameterValues
- AList
of the where clause values that replace the question marks (?)context
- seeXWikiContext
- Returns:
- A List of
XWikiAttachment
objects. - Throws:
XWikiException
- in case of error while performing the query- Since:
- 5.0M2
- See Also:
XWikiStoreInterface.searchDocuments(String, int, int, java.util.List, XWikiContext)
-
countAttachments
public int countAttachments(String parametrizedSqlClause, List<?> parameterValues, XWikiContext context) throws XWikiException
Count attachments returned by a given parameterized query- Parameters:
parametrizedSqlClause
- Everything which would follow the "WHERE" in HQLparameterValues
- AList
of the where clause values that replace the question marks (?)context
- seeXWikiContext
- Returns:
- int number of attachments found.
- Throws:
XWikiException
- in event of an exception querying the database- Since:
- 5.0M2
- See Also:
searchAttachments(String, boolean, int, int, java.util.List, XWikiContext)
-
getConfigPath
@Deprecated public static String getConfigPath() throws NamingException
Deprecated.since 6.1M2, useXWikiCfgConfigurationSource.getConfigPath()
instead- Throws:
NamingException
-
getConfig
@Deprecated public XWikiConfig getConfig()
Deprecated.since 6.1M2, useConfigurationSource
component with hintxwikicfg
instead
-
setConfig
@Deprecated public void setConfig(XWikiConfig config)
Deprecated.since 6.1M2
-
Param
@Deprecated public String Param(String key)
Deprecated.since 6.1M2, useConfigurationSource
component with hintxwikicfg
instead
-
Param
@Deprecated public String Param(String key, String default_value)
Deprecated.since 6.1M2, useConfigurationSource
component with hintxwikicfg
instead
-
ParamAsLong
@Deprecated public long ParamAsLong(String key)
Deprecated.since 6.1M2, useConfigurationSource
component with hintxwikicfg
instead
-
ParamAsLong
@Deprecated public long ParamAsLong(String key, long default_value)
Deprecated.since 6.1M2, useConfigurationSource
component with hintxwikicfg
instead
-
isPathBased
public boolean isPathBased()
- Returns:
- true if the wiki is in path based mode, fale otherwise
- Since:
- 11.9RC1
-
-