public class XWiki extends Api
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
LOGGER
Logging helper object.
|
Constructor and Description |
---|
XWiki(XWiki xwiki,
XWikiContext context)
XWiki API Constructor
|
Modifier and Type | Method and Description |
---|---|
String |
addMandatory() |
void |
addToAllGroup(String fullwikiname)
Privileged API to add a user to the XWiki.XWikiAllGroup
|
String |
addTooltip(String html,
String message)
Inserts a tooltip using toolTip.js
|
String |
addTooltip(String html,
String message,
String params)
Inserts a tooltip using toolTip.js
|
String |
addTooltipJS()
Inserts the tooltip Javascript
|
boolean |
checkAccess(String docname,
String right)
Verify the rights the current user has on a document.
|
XWikiUser |
checkAuth()
Check authentication from request and set according persitent login information If it fails user is unlogged
|
XWikiUser |
checkAuth(String username,
String password,
String rememberme)
Check authentication from username and password and set according persitent login information If it fails user is
unlogged
|
String |
convertUsername(String username)
API to convert the username depending on the configuration The username can be converted from email to a valid
XWiki page name hidding the email address The username can be then used to login and link to the right user page
|
boolean |
copyDocument(DocumentReference sourceDocumentReference,
DocumentReference targetDocumentReference,
String wikilocale,
boolean resetHistory,
boolean overwrite)
API to copy a translation of a document to another document of the same name in another wiki additionally
resetting the version and overwriting the previous document
|
boolean |
copyDocument(String docname,
String targetdocname)
API to copy a document to another document in the same wiki
|
boolean |
copyDocument(String docname,
String targetdocname,
String wikilocale)
API to copy a translation of a document to another document in the same wiki
|
boolean |
copyDocument(String docname,
String sourceWiki,
String targetWiki,
String wikilocale)
API to copy a translation of a document to another document of the same name in another wiki
|
boolean |
copyDocument(String docname,
String targetdocname,
String sourceWiki,
String targetWiki,
String wikilocale,
boolean reset)
API to copy a translation of a document to another document of the same name in another wiki additionally
resetting the version
|
boolean |
copyDocument(String docname,
String targetdocname,
String sourceWiki,
String targetWiki,
String wikilocale,
boolean reset,
boolean force)
API to copy a translation of a document to another document of the same name in another wiki additionally
resetting the version and overwriting the previous document
|
int |
copySpaceBetweenWikis(String space,
String sourceWiki,
String targetWiki,
String locale,
boolean clean)
Privileged API to copy a space to another wiki, optionally deleting all document of the target space
|
int |
countAttachments(String parametrizedSqlClause,
List<?> parameterValues)
Count attachments returned by a given parameterized query
|
Document |
createDocument()
API to create an empty document
|
int |
createUser()
Privileged API to create a new user from the request This API is used by RegisterNewUser wiki page
|
int |
createUser(boolean withValidation)
Privileged API to create a new user from the request This API is used by RegisterNewUser wiki page This version
sends a validation email to the user Configuration of validation email is in the XWiki Preferences
|
int |
createUser(boolean withValidation,
String userRights)
Privileged API to create a new user from the request.
|
boolean |
exists(DocumentReference reference)
Returns whether a document exists or not
|
boolean |
exists(PageReference reference)
Returns whether a page exists or not.
|
boolean |
exists(String fullname)
Returns whether a document exists or not
|
void |
flushCache()
Privileged API to flush the cache of the Wiki installation This flushed the cache of all wikis, all plugins, all
renderers
|
String |
formatDate(Date date)
API allowing to format a date according to the default Wiki setting The date format is provided in the
'dateformat' parameter of the XWiki Preferences
|
String |
formatDate(Date date,
String format)
API allowing to format a date according to a custom format The date format is from java.text.SimpleDateFormat
Example: "dd/MM/yyyy HH:mm:ss" or "d MMM yyyy" If the format is invalid the default format will be used to show
the date
|
Api |
get(String name)
Returns a plugin from the plugin API.
|
String |
getAdClientId()
Returns the Advertisement client ID from the preferences
|
String |
getAdType()
Returns the Advertisement system from the preferences
|
String |
getAttachmentURL(String fullname,
String filename)
API to retrieve the URL of an attached file in a Wiki Document The URL is generated differently depending on the
environment (Servlet, Portlet, PDF, etc..) The URL generation can be modified by implementing a new
XWikiURLFactory object For compatibility with any target environment (and especially the portlet environment) It
is important to always use the URL functions to generate URL and never hardcode URLs
|
List<Locale> |
getAvailableLocales()
Get the available locales according to the preferences.
|
org.xwiki.rendering.syntax.Syntax |
getAvailableRendererSyntax(String syntaxType,
String syntaxVersion)
Find the corresponding available renderer syntax.
|
String |
getBaseSkin()
API to retrieve the current skin for this request and user.
|
Class |
getClass(EntityReference docReference)
Get the XWiki Class object defined in the passed Document name.
|
Class |
getClass(String documentName)
Get the XWiki Class object defined in the passed Document name.
|
List<String> |
getClassList()
Get the list of available classes in the wiki
|
String |
getCounter(String name)
Provides an absolute counter
|
CriteriaService |
getCriteriaService()
API to get the xwiki criteria service which allow to create various criteria : integer ranges, date periods, date
intervals, etc.
|
String |
getCurrentContentSyntaxId()
Get the syntax of the content currently being executed.
|
org.xwiki.job.event.status.JobStatus |
getCurrentInitializerJobStatus() |
String |
getDefaultDocumentSyntax() |
DeletedAttachment |
getDeletedAttachment(String id)
Retrieve a specific attachment from the trash.
|
List<DeletedAttachment> |
getDeletedAttachments(String docName)
Retrieve all the deleted attachments that belonged to a certain document.
|
List<DeletedAttachment> |
getDeletedAttachments(String docName,
String filename)
Retrieve all the deleted attachments that belonged to a certain document and had the specified name.
|
DeletedDocument |
getDeletedDocument(String index) |
DeletedDocument |
getDeletedDocument(String fullname,
String locale,
String index)
Deprecated.
since 9.4RC1. Use
getDeletedDocument(String) instead. |
List<DeletedDocument> |
getDeletedDocuments(String batchId) |
List<DeletedDocument> |
getDeletedDocuments(String fullname,
String locale) |
Document |
getDocument(DocumentReference reference)
Loads a Document from the database.
|
Document |
getDocument(DocumentReference reference,
String revision)
Load a specific revision of a document
|
Document |
getDocument(Document doc,
String rev)
Load a specific revision of a document
|
Document |
getDocument(EntityReference reference)
Loads a Document from the store.
|
Document |
getDocument(String documentReference)
Loads an Document from the database.
|
Document |
getDocument(String space,
String fullname)
Loads an Document from the database.
|
Document |
getDocumentAsAuthor(DocumentReference reference)
Loads an Document from the database.
|
Document |
getDocumentAsAuthor(String fullName)
Loads an Document from the database.
|
String |
getEditorPreference()
Retrieves the current editor preference for the request The preference is first looked up in the user preference
and then in the space and wiki preference
|
String |
getEncoding()
API to retrieve the current encoding of the wiki engine The encoding is stored in xwiki.cfg Default encoding is
ISO-8891-1
|
Document |
getEntityDocument(String reference,
EntityType type)
Loads an Document from the database.
|
List<String> |
getIncludedMacros(String defaultSpace,
String content)
Returns the list of Macros documents in the specified content
|
String |
getInterfaceLanguagePreference()
Deprecated.
since 8.0M1, use
getInterfaceLocalePreference() instead |
Locale |
getInterfaceLocalePreference()
API to access the interface locale preference for the request Order of evaluation is: locale of the wiki in
mono-lingual mode locale request parameter locale in context locale user preference locale in cookie locale
accepted by the navigator
|
com.xpn.xwiki.internal.XWikiInitializerJobStatus |
getJobStatus() |
String |
getLanguagePreference()
Deprecated.
since 8.0M1, use
getLocalePreference() instead |
Locale |
getLocalePreference()
First try to find the current locale in use from the XWiki context.
|
String |
getLocalUserName(String user)
API to retrieve a link to the User Name page displayed for the first name and last name of the user.
|
String |
getLocalUserName(String user,
boolean link)
API to retrieve a text representing the user with the first name and last name of the user.
|
String |
getLocalUserName(String user,
String format)
API to retrieve a link to the User Name page displayed with a custom view.
|
String |
getLocalUserName(String user,
String format,
boolean link)
API to retrieve a text representing the user with a custom view.
|
String |
getMacroList()
API to get the macro list from the XWiki Preferences The macro list are the macros available from the Macro
Mapping System
|
MetaClass |
getMetaclass()
Get the global MetaClass object
|
Object |
getObjectFromRequest(String className)
API to create an object from the request The parameters are the ones that are created from
doc.display("field","edit") calls
|
String |
getPlainUserName(DocumentReference userReference)
Generate and return an unescaped user display name.
|
Api |
getPlugin(String name)
Returns a plugin from the plugin API.
|
PropertyClass |
getPropertyClassFromName(String propPath)
API to get the Property object from a class based on a property path A property path looks like
XWiki.ArticleClass_fieldname
|
String |
getRefererText(String referer)
API to retrieve a viewable referer text for a referer Referers are URL where users have clicked on a link to an
XWiki page Search engine referer URLs are transformed to a nicer view (Google: search query string) For other URL
the http:// part is stripped
|
String |
getRelativeRequestURL()
API Allowing to access the current request URL being requested as a relative URL.
|
String |
getRequestURL()
API Allowing to access the current request URL being requested.
|
long |
getSectionEditingDepth() |
String |
getServletPath()
API to get the Servlet path for the current wiki.
|
String |
getServletPath(String wikiName)
API to get the Servlet path for a given wiki.
|
String |
getShortRefererText(String referer,
int length)
API to retrieve a viewable referer text for a referer with a maximum length Referers are URL where users have
clicked on a link to an XWiki page Search engine referer URLs are transformed to a nicer view (Google: search
query string) For other URL the http:// part is stripped
|
String |
getSkin()
API to retrieve the current skin for this request and user The skin is first derived from the request "skin"
parameter If this parameter does not exist, the user preference "skin" is looked up If this parameter does not
exist or is empty, the space preference "skin" is looked up If this parameter does not exist or is empty, the
XWiki preference "skin" is looked up If this parameter does not exist or is empty, the xwiki.cfg parameter
xwiki.defaultskin is looked up If this parameter does not exist or is empty, the xwiki.cfg parameter
xwiki.defaultbaseskin is looked up If this parameter does not exist or is empty, the skin is "colibri"
|
String |
getSkinFile(String filename)
Return the URL of the static file provided by the current skin The file is first looked in the skin active for
the user, the space or the wiki.
|
String |
getSkinFile(String filename,
boolean forceSkinAction)
Return the URL of the static file provided by the current skin The file is first looked in the skin active for
the user, the space or the wiki.
|
String |
getSkinPreference(String preference)
API to access a Skin Preference The skin object is the current user's skin
|
String |
getSkinPreference(String preference,
String defaultValue)
API to access a Skin Preference The skin object is the current user's skin
|
String |
getSpaceCopyright()
API to access the copyright for this space.
|
List<String> |
getSpaceDocsName(String spaceReference)
Deprecated.
use query service instead
|
String |
getSpacePreference(String preference)
API to access an Space Preference There can be one preference object per locale This function will find the right
preference object associated to the current active locale If no preference is found it will look in the XWiki
Preferences
|
String |
getSpacePreference(String preference,
String defaultValue)
API to access an Space Preference There can be one preference object per locale This function will find the right
preference object associated to the current active locale If no preference is found it will look in the XWiki
Preferences
|
int |
getSpacePreferenceAsInt(String preference)
API to access a Space Preference as a int number There can be one preference object per locale This function will
find the right preference object associated to the current active locale If no preference is found it will look
for the XWiki Preference
|
int |
getSpacePreferenceAsInt(String preference,
int defaultValue)
API to access a space Preference as a int number There can be one preference object per locale This function will
find the right preference object associated to the current active locale If no preference is found it will look
for the XWiki Preference
|
long |
getSpacePreferenceAsLong(String preference)
API to access a Space Preference as a long number There can be one preference object per locale This function
will find the right preference object associated to the current active locale If no preference is found it will
look for the XWiki Preference
|
long |
getSpacePreferenceAsLong(String preference,
long defaultValue)
API to access a Space Preference as a long number There can be one preference object per locale This function
will find the right preference object associated to the current active locale If no preference is found it will
look for the XWiki Preference
|
String |
getSpacePreferenceFor(String preference,
SpaceReference spaceReference)
Get the reference of the space and fallback on parent space or wiki in case nothing is found.
|
String |
getSpacePreferenceFor(String preference,
SpaceReference spaceReference,
String defaultValue)
Get the reference of the space and fallback on parent space or wiki in case nothing is found.
|
String |
getSpacePreferenceFor(String preference,
String space)
Get the reference of the space and fallback on parent space or wiki in case nothing is found.
|
String |
getSpacePreferenceFor(String preference,
String space,
String defaultValue)
Get the reference of the space and fallback on parent space or wiki in case nothing is found.
|
List<String> |
getSpaces()
Deprecated.
use query service instead
|
StatsService |
getStatsService()
Access statistics api
|
String |
getTextArea(String content)
Output content in the edit content textarea
|
String |
getUniquePageName(String name)
Generates a unique page name based on initial page name and already existing pages
|
String |
getUniquePageName(String space,
String name)
Generates a unique page name based on initial page name and already existing pages
|
String |
getURL(DocumentReference reference)
API to retrieve the URL of an a Wiki Document in view mode The URL is generated differently depending on the
environment (Servlet, Portlet, PDF, etc..) The URL generation can be modified by implementing a new
XWikiURLFactory object For compatibility with any target environment (and especially the portlet environment) It
is important to always use the URL functions to generate URL and never hardcode URLs
|
String |
getURL(DocumentReference reference,
String action,
String querystring)
API to retrieve the URL of a Wiki Document in any mode, optionally adding a query string The URL is generated
differently depending on the environment (Servlet, Portlet, PDF, etc..) The URL generation can be modified by
implementing a new XWikiURLFactory object.
|
String |
getURL(EntityReference reference)
Retrieve the URL of an entity using the default mode/action for that entity type.
|
String |
getURL(EntityReference reference,
String action,
String querystring)
API to retrieve the URL of an entity in any mode, optionally adding a query string The URL is generated
differently depending on the environment (Servlet, Portlet, PDF, etc..) The URL generation can be modified by
implementing a new XWikiURLFactory object.
|
String |
getURL(String fullname)
API to retrieve the URL of an a Wiki Document in view mode The URL is generated differently depending on the
environment (Servlet, Portlet, PDF, etc..) The URL generation can be modified by implementing a new
XWikiURLFactory object For compatibility with any target environment (and especially the portlet environment) It
is important to always use the URL functions to generate URL and never hardcode URLs
|
String |
getURL(String fullname,
String action)
API to retrieve the URL of an a Wiki Document in any mode.
|
String |
getURL(String fullname,
String action,
String querystring)
API to retrieve the URL of a Wiki Document in any mode, optionally adding a query string The URL is generated
differently depending on the environment (Servlet, Portlet, PDF, etc..) The URL generation can be modified by
implementing a new XWikiURLFactory object.
|
String |
getURL(String fullname,
String action,
String querystring,
String anchor)
API to retrieve the URL of an a Wiki Document in any mode, optionally adding an anchor.
|
String |
getURLContent(String surl)
Returns the content of an HTTP/HTTPS URL
|
String |
getURLContent(String surl,
int timeout)
Returns the content of an HTTP/HTTPS URL
|
String |
getURLContent(String surl,
String username,
String password)
Returns the content of an HTTP/HTTPS URL protected using Basic Authentication
|
String |
getURLContent(String surl,
String username,
String password,
int timeout)
Returns the content of an HTTP/HTTPS URL protected using Basic Authentication
|
byte[] |
getURLContentAsBytes(String surl)
Returns the content of an HTTP/HTTPS URL as Bytes
|
byte[] |
getURLContentAsBytes(String surl,
String username,
String password)
Returns the content of an HTTP/HTTPS URL protected using Basic Authentication as Bytes
|
User |
getUser() |
User |
getUser(DocumentReference userReference)
Retrieve a user from its document reference.
|
User |
getUser(String username) |
String |
getUserName(String user)
API to retrieve a link to the User Name page displayed for the first name and last name of the user.
|
String |
getUserName(String user,
boolean link)
API to retrieve a text representing the user with the first name and last name of the user.
|
String |
getUserName(String user,
String format)
API to retrieve a link to the User Name page displayed with a custom view.
|
String |
getUserName(String user,
String format,
boolean link)
API to retrieve a text representing the user with a custom view With the link param set to false it will not link
to the user page.
|
String |
getUserPreference(String preference)
API to access a User Preference This function will look in the User profile for the preference If no preference
is found it will look in the Space Preferences If no preference is found it will look in the XWiki Preferences
|
String |
getUserPreferenceFromCookie(String preference)
API to access a User Preference from cookie This function will look in the session cookie for the preference
|
String |
getUserTimeZone() |
String |
getVersion() |
String |
getWebAppPath()
API to get the webapp path for the current wiki.
|
List<String> |
getWikiNames() |
String |
getWysiwygToolbars()
API to check if using which toolbars in Wysiwyg editor
|
XWiki |
getXWiki()
Privileged API allowing to access the underlying main XWiki Object
|
String |
getXWikiPreference(String preference)
API to access an XWiki Preference There can be one preference object per locale This function will find the right
preference object associated to the current active locale
|
String |
getXWikiPreference(String preference,
String defaultValue)
API to access an XWiki Preference There can be one preference object per locale This function will find the right
preference object associated to the current active locale
|
int |
getXWikiPreferenceAsInt(String preference)
API to access an XWiki Preference as a int number There can be one preference object per locale This function
will find the right preference object associated to the current active locale
|
int |
getXWikiPreferenceAsInt(String preference,
int defaultValue)
API to access an XWiki Preference as an int number There can be one preference object per locale This function
will find the right preference object associated to the current active locale
|
long |
getXWikiPreferenceAsLong(String preference)
API to access an XWiki Preference as a long number There can be one preference object per locale This function
will find the right preference object associated to the current active locale
|
long |
getXWikiPreferenceAsLong(String preference,
long defaultValue)
API to access an XWiki Preference as a long number There can be one preference object per locale This function
will find the right preference object associated to the current active locale
|
boolean |
hasAccessLevel(String level)
API to check rights on the current document for the current user
|
boolean |
hasAccessLevel(String level,
String user,
String docname)
API to check rights on a document for a given user
|
boolean |
hasBacklinks()
API to check if the backlinks feature is active Backlinks are activated in xwiki.cfg or in the XWiki Preferences
|
boolean |
hasEditComment()
API to check if the edit comment feature is active Edit comments are activated in xwiki.cfg or in the XWiki
Preferences
|
boolean |
hasMinorEdit()
API to check if the minor edit feature is active minor edit is activated in xwiki.cfg or in the XWiki Preferences
|
boolean |
hasRecycleBin()
API to check if the recycle bin feature is active recycle bin is activated in xwiki.cfg or in the XWiki
Preferences
|
boolean |
hasSectionEdit() |
boolean |
hasSubWikis()
Convenience method to ask if the current XWiki instance contains subwikis (in addition to the main wiki)
|
boolean |
hasTags()
API to check if the tags feature is active.
|
String |
includeForm(String topic)
API to execute a form in the context of an including topic The rendering is evaluated in the context of the
including topic All velocity variables are the one of the including topic This api is usually called using
#includeForm in a page, which modifies the behavior of "Edit this page" button to direct for Form mode (inline)
|
String |
includeForm(String topic,
boolean pre)
API to execute a form in the context of an including topic, optionnaly surrounding the content with {pre}{/pre}
to avoid future wiki rendering The rendering is evaluated in the context of the including topic All velocity
variables are the one of the including topic This api is usually called using #includeForm in a page, which
modifies the behavior of "Edit this page" button to direct for Form mode (inline).
|
String |
includeTopic(String topic)
API to include a topic into another The topic is rendered fully in the context of itself
|
String |
includeTopic(String topic,
boolean pre)
API to include a topic into another, optionally surrounding the content with {pre}{/pre} to avoid future wiki
rendering.
|
String |
invokeServletAndReturnAsString(String url)
Designed to include dynamic content, such as Servlets or JSPs, inside Velocity templates; works by creating a
RequestDispatcher, buffering the output, then returning it as a string.
|
boolean |
isEditCommentFieldHidden()
API to check if the edit comment field is shown in the edit form Edit comments are activated in xwiki.cfg or in
the XWiki Preferences
|
boolean |
isEditCommentMandatory()
API to check if the edit comment is mandatory (prompted by Javascript if empty) Edit comments are activated in
xwiki.cfg or in the XWiki Preferences
|
boolean |
isEditCommentSuggested()
API to check if the edit comment is suggested (prompted once by Javascript if empty) Edit comments are activated
in xwiki.cfg or in the XWiki Preferences
|
boolean |
isMultiLingual()
API to check is wiki is multi-lingual
|
boolean |
isReadOnly()
returns true if xwiki.readonly is set in the configuration file
|
boolean |
isTitleInCompatibilityMode() |
String |
parseContent(String content)
Deprecated.
Since 7.2M1. Use specific rendering/parsing options for the content type you want to parse/render.
|
Object |
parseGroovyFromPage(String fullname)
Privileged API to retrieve an object instanciated from groovy code in a String Groovy scripts compilation is
cached
|
Object |
parseGroovyFromPage(String script,
String jarWikiPage)
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.
|
Object |
parseGroovyFromString(String script)
Privileged API to retrieve an object instantiated from groovy code in a String.
|
String |
parseTemplate(String template)
API to parse a velocity template provided by the current Skin The template is first looked in the skin active for
the user, the space or the wiki.
|
void |
refreshLinks()
Priviledge API to regenerate the links/backlinks table Normally links and backlinks are stored when a page is
modified This function will regenerate all the backlinks This function can be long to run
|
boolean |
renameDocument(DocumentReference sourceDocumentReference,
DocumentReference targetDocumentReference,
boolean overwrite,
List<DocumentReference> backlinkDocumentReferences,
List<DocumentReference> childDocumentReferences)
API to rename a document to another document.
|
String |
renderTemplate(String template)
API to render a velocity template provided by the current Skin The template is first looked in the skin active
for the user, the space or the wiki.
|
List<Attachment> |
searchAttachments(String parametrizedSqlClause,
int nb,
int start,
List<?> parameterValues)
Search attachments by passing HQL where clause values as parameters.
|
List<String> |
searchDocuments(String wheresql)
Deprecated.
use query service instead
|
List<Document> |
searchDocuments(String wheresql,
boolean distinctbylocale)
API allowing to search for documents allowing to have mutliple entries per locale
|
List<Document> |
searchDocuments(String wheresql,
boolean distinctbylocale,
int nb,
int start)
API allowing to search for documents allowing to have multiple entries per locale
|
List<String> |
searchDocuments(String wheresql,
int nb,
int start)
Deprecated.
use query service instead
|
List<String> |
searchDocuments(String parameterizedWhereClause,
int maxResults,
int startOffset,
List<?> parameterValues)
Deprecated.
use query service instead
|
List<String> |
searchDocuments(String wheresql,
int nb,
int start,
String selectColumns)
Deprecated.
use query service instead
|
List<String> |
searchDocuments(String parameterizedWhereClause,
List<?> parameterValues)
Deprecated.
use query service instead
|
List<String> |
searchDocumentsNames(String wikiName,
String parameterizedWhereClause,
int maxResults,
int startOffset,
List<?> parameterValues)
Deprecated.
use query service instead
|
List<String> |
searchSpacesNames(String parametrizedSqlClause,
int nb,
int start,
List<?> parameterValues)
Search spaces by passing HQL where clause values as parameters.
|
void |
sendConfirmationMail(String xwikiname,
String password,
String email,
String contentfield)
Privileged API to send a confirmation email to a user
|
void |
sendConfirmationMail(String xwikiname,
String password,
String email,
String add_message,
String contentfield)
Privileged API to send a confirmation email to a user
|
void |
setReadOnly(boolean ro)
Privileged API to set/unset the readonly status of the Wiki After setting this to true no writing to the database
will be performed All Edit buttons will be removed and save actions disabled This is used for maintenance
purposes
|
int |
validateUser(boolean withConfirmEmail)
Privileged API to validate the return code given by a user in response to an email validation email The
validation information are taken from the request object
|
List<Document> |
wrapDocs(List<?> docs)
Function to wrap a list of XWikiDocument into Document objects
|
convert, convert, convert, convertAttachments, getAuthorizationManager, getContextualAuthorizationManager, getXWikiContext, hasAccess, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights
public XWiki(XWiki xwiki, XWikiContext context)
xwiki
- XWiki Main Object to wrapcontext
- XWikiContext to wrap@Programming public XWiki getXWiki()
public com.xpn.xwiki.internal.XWikiInitializerJobStatus getJobStatus()
XWiki
instancepublic org.xwiki.job.event.status.JobStatus getCurrentInitializerJobStatus()
public String getVersion()
(version).(SVN build number)
, or "Unknown version" if it
failed to be retrievedpublic String getRequestURL() throws XWikiException
XWikiException
- failed to create the URLpublic String getRelativeRequestURL() throws XWikiException
XWikiException
- failed to create the URLpublic Document getDocument(String documentReference) throws XWikiException
This is a helper for document reference but you can use getEntityDocument(String, EntityType)
for any
other kind of reference.
documentReference
- the reference of the document to be loadedDocument.isNew()
XWikiException
getEntityDocument(String, EntityType)
public Document getEntityDocument(String reference, EntityType type) throws XWikiException
reference
- the reference of the document to be loadedtype
- the type of the referenceDocument.isNew()
XWikiException
public Document getDocument(DocumentReference reference) throws XWikiException
reference
- the reference of the XWiki document to be loadedDocument.isNew()
XWikiException
public Document getDocument(EntityReference reference) throws XWikiException
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).
reference
- the reference close to the XWiki document to be loadedDocument.isNew()
XWikiException
public Document getDocumentAsAuthor(String fullName) throws XWikiException
fullName
- the full name of the XWiki document to be loadedDocument.isNew()
XWikiException
public Document getDocumentAsAuthor(DocumentReference reference) throws XWikiException
reference
- the reference of the XWiki document to be loadedDocument.isNew()
XWikiException
public List<DeletedDocument> getDeletedDocuments(String fullname, String locale) throws XWikiException
fullname
- the name
of the document to search for.locale
- an optional locale
to filter results.XWikiException
- if any errorpublic List<DeletedDocument> getDeletedDocuments(String batchId) throws XWikiException
batchId
- id of the operation that deleted multiple documents at the same time; useful when trying to revert
the operationXWikiException
- if any error@Deprecated public DeletedDocument getDeletedDocument(String fullname, String locale, String index) throws XWikiException
getDeletedDocument(String)
instead.fullname
- - XWikiDocument.getFullName()
locale
- - XWikiDocument.getLocale()
index
- - XWikiDocument.getId()
XWikiException
- if any errorpublic DeletedDocument getDeletedDocument(String index) throws XWikiException
XWikiException
- if any errorpublic List<DeletedAttachment> getDeletedAttachments(String docName)
docName
- the name
of the owner documentpublic List<DeletedAttachment> getDeletedAttachments(String docName, String filename)
docName
- the name of the document
the attachment belonged tofilename
- the name
of the attachment to search forpublic DeletedAttachment getDeletedAttachment(String id)
id
- the unique identifier of the entry in the trashnull
if not foundpublic boolean exists(String fullname) throws XWikiException
fullname
- Fullname of the XWiki document to be loadedXWikiException
public boolean exists(DocumentReference reference) throws XWikiException
reference
- the reference of the document to check for its existenceXWikiException
@Unstable public boolean exists(PageReference reference)
reference
- the reference of the page to check for its existencepublic boolean checkAccess(String docname, String right)
docname
- fullname of the documentright
- right to check ("view", "edit", "admin", "delete")public Document getDocument(String space, String fullname) throws XWikiException
space
- Space to use in case no space is defined in the provided fullname
fullname
- the full name or relative name of the document to loadDocument.isNew()
XWikiException
public Document getDocument(Document doc, String rev) throws XWikiException
doc
- Document for which to load a specific revisionrev
- Revision numberXWikiException
- is never thrownpublic Document getDocument(DocumentReference reference, String revision) throws XWikiException
reference
- Document for which to load a specific revisionrevision
- Revision numberXWikiException
- is never thrownpublic String getTextArea(String content)
content
- content to outputpublic List<String> getClassList() throws XWikiException
XWikiException
public MetaClass getMetaclass()
@Deprecated public List<String> searchDocuments(String wheresql) throws XWikiException
where doc.space='Main' order by doc.creationDate desc
. Result: All the documents in space
'Main' ordered by the creation date from the most recentwhere doc.name like '%sport%' order by doc.name asc
. Result: All the documents containing
'sport' in their name ordered by document namewhere doc.content like '%sport%' order by doc.author
Result: All the documents containing
'sport' in their content ordered by the authorwhere doc.creator = 'XWiki.LudovicDubost' order by doc.creationDate
desc
. Result: All the documents with creator LudovicDubost ordered by the creation date from the
most recentwhere doc.author = 'XWiki.LudovicDubost' order by doc.date desc
. Result: All the
documents with last author LudovicDubost ordered by the last modification date from the most recent.,BaseObject as obj where doc.fullName=obj.name and
obj.className='XWiki.XWikiComments' order by doc.date desc
. Result: All the documents with at least
one comment ordered by the last modification date from the most recent,BaseObject as obj, StringProperty as prop where
doc.fullName=obj.name and obj.className='XWiki.XWikiComments' and obj.id=prop.id.id
and prop.id.name='author' and prop.value='XWiki.LudovicDubost' order by doc.date
desc
. Result: All the documents with at least one comment from LudovicDubost ordered by the last
modification date from the most recentwheresql
- Query to be run (either starting with ", BaseObject as obj where.." or by "where ..."XWikiException
@Deprecated public List<String> searchDocuments(String wheresql, int nb, int start) throws XWikiException
wheresql
- query to use similar to searchDocuments(wheresql)nb
- return only 'nb' rowsstart
- skip the first 'start' rowsXWikiException
searchDocuments(String where sql)
@Deprecated public List<String> searchDocuments(String wheresql, int nb, int start, String selectColumns) throws XWikiException
wheresql
- query to use similar to searchDocuments(wheresql)nb
- return only 'nb' rowsstart
- skip the first 'start' rowsselectColumns
- List of columns to add to the resultXWikiException
public List<Document> searchDocuments(String wheresql, boolean distinctbylocale) throws XWikiException
wheresql
- query to use similar to searchDocuments(wheresql)distinctbylocale
- true to return multiple rows per localeXWikiException
public List<Document> searchDocuments(String wheresql, boolean distinctbylocale, int nb, int start) throws XWikiException
wheresql
- query to use similar to searchDocuments(wheresql)distinctbylocale
- true to return multiple rows per localenb
- return only 'nb' rowsstart
- skip the first 'start' rowsXWikiException
@Deprecated public List<String> searchDocuments(String parameterizedWhereClause, int maxResults, int startOffset, List<?> parameterValues) throws XWikiException
Example
<code> #set($orphans = $xwiki.searchDocuments(" where doc.fullName <> ?1 and (doc.parent = ?2 or " + "(doc.parent = ?3 and doc.space = ?4))", ["${doc.fullName}as", ${doc.fullName}, ${doc.name}, ${doc.space}])) </code>
parameterizedWhereClause
- the HQL where clause. For example
where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
maxResults
- the number of rows to return. If 0 then all rows are returnedstartOffset
- the number of rows to skip. If 0 don't skip any rowparameterValues
- the where clause values that replace the question marks (?1, ?2, etc.)XWikiException
- in case of error while performing the query@Deprecated public List<String> searchDocuments(String parameterizedWhereClause, List<?> parameterValues) throws XWikiException
searchDocuments(String, int, int, java.util.List)
but returns all rows.XWikiException
searchDocuments(String, int, int, java.util.List)
@Deprecated public List<String> searchDocumentsNames(String wikiName, String parameterizedWhereClause, int maxResults, int startOffset, List<?> parameterValues) throws XWikiException
searchDocuments(String, int, int, java.util.List)
for more details.wikiName
- the name of the wiki where to search.parameterizedWhereClause
- the HQL where clause. For example
where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
maxResults
- the number of rows to return. If 0 then all rows are returnedstartOffset
- the number of rows to skip. If 0 don't skip any rowparameterValues
- the where clause values that replace the question marks (?)XWikiException
- in case of error while performing the querysearchDocuments(String, int, int, java.util.List)
public List<String> searchSpacesNames(String parametrizedSqlClause, int nb, int start, List<?> parameterValues) throws XWikiException
searchDocuments(String, int, int, List)
for more about parameterized hql clauses.parametrizedSqlClause
- the HQL where clause. For example
where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
nb
- the number of rows to return. If 0 then all rows are returnedstart
- the number of rows to skip. If 0 don't skip any rowparameterValues
- the where clause values that replace the question marks (?)XWikiException
- in case of error while performing the querypublic List<Attachment> searchAttachments(String parametrizedSqlClause, int nb, int start, List<?> parameterValues) throws XWikiException
searchDocuments(String, int, int, List)
for more about parameterized hql clauses. You can specify
properties of attach (the attachment) or doc (the document it is attached to)parametrizedSqlClause
- The HQL where clause. For example
where doc.fullName <> ?1 and (doc.parent = ?2 or (doc.parent = ?3 and doc.space = ?4))
nb
- The number of rows to return. If 0 then all rows are returnedstart
- The number of rows to skip at the beginning.parameterValues
- A List
of the where clause values that replace the question marks (?)Attachment
objects.XWikiException
- in case of error while performing the querypublic int countAttachments(String parametrizedSqlClause, List<?> parameterValues) throws XWikiException
parametrizedSqlClause
- Everything which would follow the "WHERE" in HQL see:
searchDocuments(String, int, int, List)
parameterValues
- A List
of the where clause values that replace the question marks (?)XWikiException
searchAttachments(String, int, int, List)
public List<Document> wrapDocs(List<?> docs)
docs
- list of XWikiDocument@Deprecated public String parseContent(String content)
content
- public String parseTemplate(String template)
template
- Template name ("view", "edit", "comment")public String renderTemplate(String template)
template
- Template name ("view", "edit", "comment")public String invokeServletAndReturnAsString(String url)
url
- URL of the servletpublic String getSkinFile(String filename)
filename
- Filename to be looked up in the skin (logo.gif, style.css)public String getSkinFile(String filename, boolean forceSkinAction)
filename
- Filename to be looked up in the skin (logo.gif, style.css)forceSkinAction
- true to make sure that static files are retrieved through the skin action, to allow
parsing of velocity on CSS filespublic String getSkin()
public String getBaseSkin()
public String getSpaceCopyright()
public String getXWikiPreference(String preference)
preference
- Preference namepublic String getXWikiPreference(String preference, String defaultValue)
preference
- Preference namedefaultValue
- default value to return if the preference does not exist or is emptypublic String getSpacePreference(String preference)
preference
- Preference namepublic String getSpacePreference(String preference, String defaultValue)
preference
- Preference namedefaultValue
- default value to return if the preference does not exist or is emptypublic String getSkinPreference(String preference)
preference
- Preference namepublic String getSkinPreference(String preference, String defaultValue)
preference
- Preference namedefaultValue
- default value to return if the preference does not exist or is emptypublic String getSpacePreferenceFor(String preference, String space)
If the property is not set on any level then empty String is returned.
preference
- Preference namespace
- The space for which this preference is requestedpublic String getSpacePreferenceFor(String preference, String space, String defaultValue)
If the property is not set on any level then defaultValue
is returned.
preference
- Preference namespace
- The space for which this preference is requesteddefaultValue
- default value to return if the preference does not exist or is emptypublic String getSpacePreferenceFor(String preference, SpaceReference spaceReference)
If the property is not set on any level then empty String is returned.
preference
- the name of the preference keyspaceReference
- the reference of the spacepublic String getSpacePreferenceFor(String preference, SpaceReference spaceReference, String defaultValue)
If the property is not set on any level then defaultValue
is returned.
preference
- the name of the preference keyspaceReference
- the reference of the spacedefaultValue
- the value to return if the preference can't be founddefaultValue
if it could not be foundpublic long getXWikiPreferenceAsLong(String preference, long defaultValue)
preference
- Preference namedefaultValue
- default value to return if the preference does not exist or is emptypublic long getXWikiPreferenceAsLong(String preference)
preference
- Preference namepublic long getSpacePreferenceAsLong(String preference, long defaultValue)
preference
- Preference namedefaultValue
- default value to return if the prefenrece does not exist or is emptypublic long getSpacePreferenceAsLong(String preference)
preference
- Preference namepublic int getXWikiPreferenceAsInt(String preference, int defaultValue)
preference
- Preference namedefaultValue
- default value to return if the prefenrece does not exist or is emptypublic int getXWikiPreferenceAsInt(String preference)
preference
- Preference namepublic int getSpacePreferenceAsInt(String preference, int defaultValue)
preference
- Preference namedefaultValue
- default value to return if the prefenrece does not exist or is emptypublic int getSpacePreferenceAsInt(String preference)
preference
- Preference namepublic String getUserPreference(String preference)
preference
- Preference namepublic String getUserPreferenceFromCookie(String preference)
preference
- Preference name@Deprecated public String getLanguagePreference()
getLocalePreference()
insteadgetLocalePreference()
but as a String.public Locale getLocalePreference()
@Deprecated public String getInterfaceLanguagePreference()
getInterfaceLocalePreference()
insteadgetInterfaceLocalePreference()
but as a String.public Locale getInterfaceLocalePreference()
@Unstable public List<Locale> getAvailableLocales()
public List<String> getWikiNames()
XWiki.getVirtualWikisDatabaseNames(XWikiContext)
public boolean hasSubWikis()
getWikiNames()
public boolean isMultiLingual()
public void flushCache()
public int createUser() throws XWikiException
XWikiException
public int createUser(boolean withValidation) throws XWikiException
withValidation
- true to send the validationemailXWikiException
public int createUser(boolean withValidation, String userRights) throws XWikiException
This API is used by the RegisterNewUser wiki page.
This version sends a validation email to the user. Configuration of validation email is in the XWiki Preferences.
withValidation
- true to send the validation emailuserRights
- Rights to set for the user for it's own page(defaults to "edit")XWikiException
public int validateUser(boolean withConfirmEmail) throws XWikiException
withConfirmEmail
- true to send a account confirmation email/false to not send itXWikiException
public void addToAllGroup(String fullwikiname) throws XWikiException
fullwikiname
- user name to addXWikiException
public void sendConfirmationMail(String xwikiname, String password, String email, String add_message, String contentfield) throws XWikiException
xwikiname
- user to send the email topassword
- password to put in the mailemail
- email to send toadd_message
- Additional message to send to the usercontentfield
- Preference field to use as a mail templateXWikiException
- if the mail was not send successfullypublic void sendConfirmationMail(String xwikiname, String password, String email, String contentfield) throws XWikiException
xwikiname
- user to send the email topassword
- password to put in the mailemail
- email to send tocontentfield
- Preference field to use as a mail templateXWikiException
- if the mail was not send successfully@Unstable public boolean renameDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, boolean overwrite, List<DocumentReference> backlinkDocumentReferences, List<DocumentReference> childDocumentReferences) throws XWikiException
Document.getBackLinkedReferences()
and the list of children with Document.getChildrenReferences()
.
Warning: Be aware that this method never triggers any event related to the rename
of the document. If you want the right events to be sent for the event, please use the dedicated Refactoring
Module API (see
RequestFactory.createRenameRequest(EntityReference, EntityReference)
and MoveRequest
).sourceDocumentReference
- the source document to rename.targetDocumentReference
- the target reference to rename the document to.overwrite
- if true
the target document reference will be overwritten if it exists
(deleted to the recycle bin before the rename). If false
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 referencetrue
if the rename succeeded. false
if there was any issue.XWikiException
- if the document cannot be renamed properly.public boolean copyDocument(String docname, String targetdocname) throws XWikiException
docname
- source documenttargetdocname
- target documentXWikiException
- if the document was not copied properlypublic boolean copyDocument(String docname, String targetdocname, String wikilocale) throws XWikiException
docname
- source documenttargetdocname
- target documentwikilocale
- locale to copyXWikiException
- if the document was not copied properlypublic boolean copyDocument(String docname, String sourceWiki, String targetWiki, String wikilocale) throws XWikiException
docname
- source documentsourceWiki
- source wikitargetWiki
- target wikiwikilocale
- locale to copyXWikiException
- if the document was not copied properlypublic boolean copyDocument(String docname, String targetdocname, String sourceWiki, String targetWiki, String wikilocale, boolean reset) throws XWikiException
docname
- source documentsourceWiki
- source wikitargetWiki
- target wikiwikilocale
- locale to copyreset
- true to reset versionsXWikiException
- if the document was not copied properlypublic boolean copyDocument(String docname, String targetdocname, String sourceWiki, String targetWiki, String wikilocale, boolean reset, boolean force) throws XWikiException
docname
- source document nametargetdocname
- target document namesourceWiki
- source wikitargetWiki
- target wikiwikilocale
- locale to copyreset
- true to reset versionsforce
- true to overwrite the previous documentXWikiException
- if the document was not copied properlypublic boolean copyDocument(DocumentReference sourceDocumentReference, DocumentReference targetDocumentReference, String wikilocale, boolean resetHistory, boolean overwrite) throws XWikiException
sourceDocumentReference
- the reference to the document to copytargetDocumentReference
- the reference to the document to createwikilocale
- locale to copyresetHistory
- true
to reset versionsoverwrite
- true
to overwrite the previous documenttrue
if the copy was sucessfulXWikiException
- if the document was not copied properlypublic int copySpaceBetweenWikis(String space, String sourceWiki, String targetWiki, String locale, boolean clean) throws XWikiException
space
- source SpacesourceWiki
- source WikitargetWiki
- target Wikilocale
- locale to copyclean
- true to delete all document of the target spaceXWikiException
- if the space was not copied properlypublic String includeTopic(String topic) throws XWikiException
topic
- page name of the topic to includeXWikiException
- if the include failedpublic String includeForm(String topic) throws XWikiException
topic
- page name of the form to executeXWikiException
- if the include failedpublic String includeTopic(String topic, boolean pre) throws XWikiException
topic
- page name of the topic to includepre
- true to add {pre} {/pre} (only if includer document is 1.0 syntax)XWikiException
- if the include failedpublic String includeForm(String topic, boolean pre) throws XWikiException
topic
- page name of the form to executepre
- true to add {pre} {/pre} (only if includer document is 1.0 syntax)XWikiException
- if the include failedpublic boolean hasAccessLevel(String level)
level
- right to check (view, edit, comment, delete)public boolean hasAccessLevel(String level, String user, String docname)
level
- right to check (view, edit, comment, delete)user
- user for which to check the rightdocname
- document on which to check the rights@Deprecated public List<String> getSpaces() throws XWikiException
Hidden spaces are filtered unless current user enabled them.
XWikiException
- if something went wrong@Deprecated public List<String> getSpaceDocsName(String spaceReference) throws XWikiException
Hidden spaces are filtered unless current user enabled them.
spaceReference
- the local reference of the space for which to return all non-hidden documentsSpace.Page
) for non-hidden documents in the specified
spaceXWikiException
- if the loading went wrongpublic String getEncoding()
public String getAttachmentURL(String fullname, String filename) throws XWikiException
fullname
- page name which includes the attached filefilename
- attached filename to create a link forXWikiException
- if the URL could not be generated properlypublic String getURL(String fullname) throws XWikiException
fullname
- the name of the document for which to return the URL forXWikiException
- if the URL could not be generated properlypublic String getURL(EntityReference reference) throws XWikiException
reference
- the reference to the entity for which to return the URLXWikiException
- if the URL could not be generated properlypublic String getURL(EntityReference reference, String action, String querystring) throws XWikiException
reference
- the reference to the entity for which to return the URL foraction
- the mode in which to access the entity (view/edit/save/..). Any valid XWiki action is possiblequerystring
- the Query String to provide in the usual mode (name1=value1&name2=value=2
) including
encodingXWikiException
- if the URL could not be generated properlypublic String getURL(DocumentReference reference) throws XWikiException
reference
- the reference to the document for which to return the URL forXWikiException
- if the URL could not be generated properlypublic String getURL(String fullname, String action) throws XWikiException
fullname
- the page name which includes the attached fileaction
- the mode in which to access the document (view/edit/save/..). Any valid XWiki action is possible.XWikiException
- if the URL could not be generated properlypublic String getURL(String fullname, String action, String querystring) throws XWikiException
fullname
- the page name which includes the attached fileaction
- the mode in which to access the document (view/edit/save/..). Any valid XWiki action is possiblequerystring
- the Query String to provide in the usual mode (name1=value1&name2=value=2
) including
encodingXWikiException
- if the URL could not be generated properlypublic String getURL(DocumentReference reference, String action, String querystring) throws XWikiException
reference
- the reference to the document for which to return the URL foraction
- the mode in which to access the document (view/edit/save/..). Any valid XWiki action is possiblequerystring
- the Query String to provide in the usual mode (name1=value1&name2=value=2
) including
encodingXWikiException
- if the URL could not be generated properlypublic String getURL(String fullname, String action, String querystring, String anchor) throws XWikiException
fullname
- the page name which includes the attached fileaction
- the mode in which to access the document (view/edit/save/..). Any valid XWiki action is possiblequerystring
- the Query String to provide in the usual mode (name1=value1&name2=value=2
) including
encodinganchor
- the anchor that points at a location within the passed document nameXWikiException
- if the URL could not be generated properlypublic String getRefererText(String referer)
referer
- referer URL to transformpublic String getShortRefererText(String referer, int length)
referer
- referer URL to transformlength
- Maximum length. "..." is added to the end of the textpublic String getPlainUserName(DocumentReference userReference)
userReference
- the user referencepublic String getUserName(String user)
user
- Fully qualified username as retrieved from $xcontext.user (XWiki.LudovicDubost)public String getUserName(String user, String format)
user
- Fully qualified username as retrieved from $xcontext.user (XWiki.LudovicDubost)format
- formatting to be used ("$first_name $last_name", "$first_name")public String getLocalUserName(String user)
user
- Fully qualified username as retrieved from $xcontext.user (XWiki.LudovicDubost)public String getLocalUserName(String user, String format)
user
- Fully qualified username as retrieved from $xcontext.user (XWiki.LudovicDubost)format
- formatting to be used ("$first_name $last_name", "$first_name")public String getUserName(String user, boolean link)
user
- Fully qualified username as retrieved from $xcontext.user (XWiki.LudovicDubost)link
- false to not add an HTML link to the user profilepublic String getUserName(String user, String format, boolean link)
user
- Fully qualified username as retrieved from $xcontext.user (XWiki.LudovicDubost)format
- formatting to be used ("$first_name $last_name", "$first_name")link
- false to not add an HTML link to the user profilepublic String getLocalUserName(String user, boolean link)
user
- Fully qualified username as retrieved from $xcontext.user (XWiki.LudovicDubost)link
- false to not add an HTML link to the user profilepublic String getLocalUserName(String user, String format, boolean link)
user
- Fully qualified username as retrieved from $xcontext.user (XWiki.LudovicDubost)format
- formatting to be used ("$first_name $last_name", "$first_name")link
- false to not add an HTML link to the user profilepublic User getUser()
public User getUser(DocumentReference userReference)
userReference
- the reference of the user.public String formatDate(Date date)
date
- date object to formatpublic String formatDate(Date date, String format)
date
- date to formatformat
- format of the date to be usedSimpleDateFormat
public String getUserTimeZone()
public Api get(String name)
getPlugin(String)
it used to provide an easy access from Velocity to XWiki plugins. Indeed Velocity
has a feature in that if a class has a get method, using the dot notation will automatically call the get method
for the class. See http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html#propertylookuprules.
This this allows the following constructs: $xwiki.pluginName.somePluginMethod()
name
- Name of the plugin to retrieve (either short of full class name)public Api getPlugin(String name)
name
- Name of the plugin to retrieve (either short of full class name)public String getAdType()
public String getAdClientId()
@Programming public String getURLContent(String surl, String username, String password) throws IOException
surl
- url to retrieveusername
- username for the basic authenticationpassword
- password for the basic authenticationIOException
@Programming public String getURLContent(String surl) throws IOException
surl
- url to retrieveIOException
@Programming public String getURLContent(String surl, String username, String password, int timeout) throws IOException
surl
- url to retrieveusername
- username for the basic authenticationpassword
- password for the basic authenticationtimeout
- manuel timeout in millisecondsIOException
@Programming public String getURLContent(String surl, int timeout) throws IOException
surl
- url to retrievetimeout
- manuel timeout in millisecondsIOException
@Programming public byte[] getURLContentAsBytes(String surl, String username, String password) throws IOException
surl
- url to retrieveusername
- username for the basic authenticationpassword
- password for the basic authenticationIOException
@Programming public byte[] getURLContentAsBytes(String surl) throws IOException
surl
- url to retrieveIOException
public List<String> getIncludedMacros(String defaultSpace, String content)
defaultSpace
- Default space to use for relative path namescontent
- Content to parsepublic boolean isReadOnly()
XWiki
public void setReadOnly(boolean ro)
ro
- true to set read-only mode/false to unsetpublic void refreshLinks() throws XWikiException
XWikiException
- exception if the generation failspublic boolean hasBacklinks() throws XWikiException
XWikiException
- exception if the preference could not be retrievedpublic boolean hasTags() throws XWikiException
XWikiException
- exception if the preference could not be retrievedpublic boolean hasEditComment()
public boolean isEditCommentFieldHidden()
public boolean isEditCommentSuggested()
public boolean isEditCommentMandatory()
public boolean hasMinorEdit()
public boolean hasRecycleBin()
public String getEditorPreference()
public Object parseGroovyFromString(String script) throws XWikiException
script
- the Groovy class definition string (public class MyClass { ... })XWikiException
public Object parseGroovyFromPage(String script, String jarWikiPage) throws XWikiException
script
- the Groovy class definition string (public class MyClass { ... })XWikiException
public Object parseGroovyFromPage(String fullname) throws XWikiException
fullname
- // script containing a Groovy class definition (public class MyClass { ... })XWikiException
public String getMacroList()
public String getWysiwygToolbars()
public Object getObjectFromRequest(String className) throws XWikiException
className
- XWiki Class Name to create the object fromXWikiException
- exception if the object could not be readpublic Document createDocument()
public String convertUsername(String username)
username
- username to use for loginpublic PropertyClass getPropertyClassFromName(String propPath)
propPath
- Property pathpublic String getUniquePageName(String name)
name
- public String getUniquePageName(String space, String name)
space
- name
- public String addTooltip(String html, String message, String params)
html
- HTML viewedmessage
- HTML Tooltip messageparams
- Parameters in Javascropt added to the tooltip configpublic String addTooltip(String html, String message)
html
- HTML viewedmessage
- HTML Tooltip messagepublic String addTooltipJS()
public String addMandatory()
public Class getClass(String documentName) throws XWikiException
Note: This method doesn't require any rights for accessing the passed Document (as opposed to the
Object.getClass()
method which does require to get a Document object first. This is
thus useful in cases where the calling code doesn't have the access right to the specified Document. It is safe
because there are no sensitive data stored in a Class definition.
documentName
- the name of the document for which to get the Class object. For example
"XWiki.XWikiPreferences"XWikiException
- if the passed document name doesn't point to a valid Documentpublic Class getClass(EntityReference docReference) throws XWikiException
Note: This method doesn't require any rights for accessing the passed Document (as opposed to the
Object.getClass()
method which does require to get a Document object first. This is
thus useful in cases where the calling code doesn't have the access right to the specified Document. It is safe
because there are no sensitive data stored in a Class definition.
docReference
- the reference of the document for which to get the Class object.XWikiException
- if the reference doesn't exist.public String getCounter(String name)
name
- Counter namepublic XWikiUser checkAuth() throws XWikiException
XWikiException
public XWikiUser checkAuth(String username, String password, String rememberme) throws XWikiException
username
- username to checkpassword
- password to checkrememberme
- "1" if you want to remember the login accross navigator restartXWikiException
public StatsService getStatsService()
public CriteriaService getCriteriaService()
public String getServletPath(String wikiName)
wikiName
- wiki for which to get the pathpublic String getServletPath()
public String getWebAppPath()
public String getDefaultDocumentSyntax()
public org.xwiki.rendering.syntax.Syntax getAvailableRendererSyntax(String syntaxType, String syntaxVersion)
If syntaxVersion
is null the last version of the available provided syntax type is returned.
syntaxType
- the syntax typesyntaxVersion
- the syntax versionSyntax
. Null if no available renderer can be found.public boolean hasSectionEdit()
xwiki.section.edit
configuration property. Defaults to 1 (=enabled) when not definedpublic long getSectionEditingDepth()
xwiki.section.depth
configuration property. Defaults to 2 when not definedpublic boolean isTitleInCompatibilityMode()
public String getCurrentContentSyntaxId()
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).
Copyright © 2004–2021 XWiki. All rights reserved.