|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xpn.xwiki.api.Api
com.xpn.xwiki.plugin.PluginApi<WikiManagerPlugin>
com.xpn.xwiki.plugin.wikimanager.WikiManagerPluginApi
public class WikiManagerPluginApi
API for managing wikis (create wiki, delete wiki, create wiki from template, etc).
WikiManagerPlugin| Field Summary | |
|---|---|
static String |
CONTEXT_LASTERRORCODE
Field name of the last error code inserted in context. |
static String |
CONTEXT_LASTEXCEPTION
Field name of the last API exception inserted in context. |
protected static org.slf4j.Logger |
LOGGER
Logging tool. |
| Fields inherited from class com.xpn.xwiki.api.Api |
|---|
context |
| Constructor Summary | |
|---|---|
WikiManagerPluginApi(WikiManagerPlugin plugin,
XWikiContext context)
Create an instance of the Wiki Manager plugin user api. |
|
| Method Summary | |
|---|---|
boolean |
canCreateWiki()
|
boolean |
canDeleteWiki()
|
boolean |
canEditWiki()
|
int |
createNewWiki(String wikiName,
String templateWiki,
String pkgName,
XWikiServer wikiXObjectDocument,
boolean failOnExist)
Create a new wiki from template. |
XWikiServer |
createWikiDocument()
Create an empty not saved XWikiServer. |
int |
createWikiTemplate(String templateName,
String templateDescription,
String packageName)
Create a new xiki with XWikiServerClass "visibility" field set to "template". |
int |
deleteWiki(String wikiName)
Delete wiki descriptor document and wiki's database. |
int |
deleteWiki(String wikiName,
boolean deleteDatabase)
Delete wiki descriptor document and wiki's database. |
int |
deleteWiki(String wikiName,
int objectId)
Deprecated. Use deleteWikiAlias(String, int) since 1.1. |
int |
deleteWikiAlias(String wikiName,
int objectId)
Delete wiki descriptor alias document from database. |
List<Wiki> |
getAllWikis()
|
XWikiExceptionApi |
getDefaultException()
|
XWikiMessageTool |
getMessageTool()
Deprecated. |
GlobalSearchPluginApi |
getSearchApi()
|
XWikiServer |
getWikiDocument(String wikiName)
Get wiki descriptor document corresponding to provided wiki name. |
XWikiServer |
getWikiDocument(String wikiName,
int objectId)
Get wiki descriptor document corresponding to provided wiki name. |
List<XWikiServer> |
getWikiDocumentList()
Get the list of all wiki descriptor documents. |
Wiki |
getWikiFromDocumentName(String documentFullName)
Get Wiki described by document with provided full name. |
Wiki |
getWikiFromName(String wikiName)
Get Wiki with provided name. |
XWikiServer |
getWikiTemplateDocument(String wikiName)
Get wiki descriptor document corresponding to provided wiki name with XWikiServerClass "visibility" field
set to "template". |
XWikiServer |
getWikiTemplateDocument(String wikiName,
int objectId)
Get wiki descriptor document corresponding to provided wiki name with XWikiServerClass "visibility" field
set to "template". |
List<XWikiServer> |
getWikiTemplateList()
|
boolean |
isWikiExist(String wikiName)
Check if a Server of the given name exists in the master Wiki by checking if the "XWiki.XWikiServer{serverName}" document is new. |
boolean |
isWikiExist(String wikiName,
int objectId)
Check if a Server of the given name exists in the master Wiki by checking if the "XWiki.XWikiServer{serverName}" document is new. |
boolean |
isWikiNameAvailable(String wikiName)
Indicate if the provided wiki name could be used to create a new wiki. |
int |
setIsWikiTemplate(String wikiName,
boolean isWikiTemplate)
Change the XWikiServerClass "visibility" field of a wiki descriptor document. |
int |
setWikiVisibility(String wikiName,
int objectId,
String visibility)
Change the XWikiServerClass "visibility" field of a wiki descriptor document. |
int |
setWikiVisibility(String wikiName,
String visibility)
Change the XWikiServerClass "visibility" field of a wiki descriptor document. |
| Methods inherited from class com.xpn.xwiki.plugin.PluginApi |
|---|
getInternalPlugin, getProtectedPlugin, setPlugin |
| Methods inherited from class com.xpn.xwiki.api.Api |
|---|
convert, convert, getXWikiContext, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CONTEXT_LASTERRORCODE
public static final String CONTEXT_LASTEXCEPTION
protected static final org.slf4j.Logger LOGGER
| Constructor Detail |
|---|
public WikiManagerPluginApi(WikiManagerPlugin plugin,
XWikiContext context)
plugin - the entry point of the Wiki Manager plugin.context - the XWiki context.| Method Detail |
|---|
public XWikiExceptionApi getDefaultException()
@Deprecated public XWikiMessageTool getMessageTool()
public GlobalSearchPluginApi getSearchApi()
public boolean canCreateWiki()
public boolean canEditWiki()
public boolean canDeleteWiki()
public int createNewWiki(String wikiName,
String templateWiki,
String pkgName,
XWikiServer wikiXObjectDocument,
boolean failOnExist)
throws XWikiException
wikiName - the name of the new wiki.templateWiki - the name of the wiki from where to copy document to the new wiki.pkgName - the name of the attached XAR file to import in the new wiki.wikiXObjectDocument - a wiki descriptor document from which the new wiki descriptor document will be
created.failOnExist - if true throw exception when wiki already exist. If false overwrite existing wiki.
CONTEXT_LASTERRORCODE field and exception in
context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_XWIKINOTVIRTUAL: xwiki is not in virtual mode.WikiManagerException.ERROR_XWIKI_USERDOESNOTEXIST: provided user does not exists.WikiManagerException.ERROR_WM_WIKINAMEFORBIDDEN: provided wiki name can't be used to create
new wiki.WikiManagerException.ERROR_WM_WIKIALREADYEXISTS: wiki descriptor already exists.WikiManagerException.ERROR_WM_UPDATEDATABASE: error occurred when updating database.WikiManagerException.ERROR_WM_PACKAGEDOESNOTEXISTS: attached package does not exists.WikiManagerException.ERROR_WM_PACKAGEIMPORT: package loading failed.WikiManagerException.ERROR_WM_PACKAGEINSTALL: loaded package insertion into database failed.XWikiException - critical error in xwiki engine.
public int deleteWiki(String wikiName,
boolean deleteDatabase)
throws XWikiException
wikiName - the name of the wiki to delete.deleteDatabase - if true wiki's database is also removed.
CONTEXT_LASTERRORCODE field and exception in
context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException.ERROR_XWIKI_ACCESS_DENIED: you don't have right to delete wiki.XWikiException - critical error in xwiki engine.
public int deleteWiki(String wikiName)
throws XWikiException
wikiName - the name of the wiki to delete.
CONTEXT_LASTERRORCODE field and exception in
context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException.ERROR_XWIKI_ACCESS_DENIED: you don't have right to delete wiki.XWikiException - critical error in xwiki engine.
@Deprecated
public int deleteWiki(String wikiName,
int objectId)
throws XWikiException
deleteWikiAlias(String, int) since 1.1.
wikiName - the name of the wiki to delete.objectId - the id of the XWiki object included in the document to manage.
CONTEXT_LASTERRORCODE field and exception in
context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException.ERROR_XWIKI_ACCESS_DENIED: you don't have right to delete wiki.XWikiException - critical error in xwiki engine.
public int deleteWikiAlias(String wikiName,
int objectId)
throws XWikiException
wikiName - the name of the wiki to delete.objectId - the id of the XWiki object included in the document to manage.
CONTEXT_LASTERRORCODE field and exception in
context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException.ERROR_XWIKI_ACCESS_DENIED: you don't have right to delete wiki.XWikiException - critical error in xwiki engine.
public Wiki getWikiFromName(String wikiName)
throws XWikiException
Wiki with provided name.
wikiName - the name of the wiki.
Wiki object.
XWikiException - error when getting document from wiki name.
public List<Wiki> getAllWikis()
throws XWikiException
Wiki.
XWikiException - error when getting wiki documents descriptors.
public Wiki getWikiFromDocumentName(String documentFullName)
throws XWikiException
Wiki described by document with provided full name.
documentFullName - the full name of the wiki document descriptor.
Wiki object.
XWikiException - error when getting document.
public XWikiServer getWikiDocument(String wikiName)
throws XWikiException
wikiName - the name of the wiki.
CONTEXT_LASTERRORCODE field and
exception in context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException - critical error in xwiki engine.
public XWikiServer getWikiDocument(String wikiName,
int objectId)
throws XWikiException
wikiName - the name of the wiki.objectId - the id of the XWiki object included in the document to manage.
CONTEXT_LASTERRORCODE field and
exception in context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException - critical error in xwiki engine.
public List<XWikiServer> getWikiDocumentList()
throws XWikiException
XWikiServer.
XWikiException - critical error in xwiki engine.
public XWikiServer createWikiDocument()
throws XWikiException
XWikiServer.
XWikiServer.
XWikiException - critical error in xwiki engine.public boolean isWikiExist(String wikiName)
wikiName - the name of the server to be checked
public boolean isWikiExist(String wikiName,
int objectId)
wikiName - the name of the server to be checkedobjectId - the id of the XWiki object included in the document to manage.
public boolean isWikiNameAvailable(String wikiName)
throws XWikiException
wikiName - the name of the wiki.
XWikiException - error when trying to find an existing database/schema by name.
public int setWikiVisibility(String wikiName,
String visibility)
throws XWikiException
XWikiServerClass "visibility" field of a wiki descriptor document.
wikiName - the name of the wiki descriptor.visibility - the new value of "visibility" field. Can be "public", "private" or "template".
CONTEXT_LASTERRORCODE field and exception in
context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException - critical error in xwiki engine.
public int setWikiVisibility(String wikiName,
int objectId,
String visibility)
throws XWikiException
XWikiServerClass "visibility" field of a wiki descriptor document.
wikiName - the name of the wiki descriptor.objectId - the id of the XWiki object included in the document to manage.visibility - the new value of "visibility" field. Can be "public", "private" or "template".
CONTEXT_LASTERRORCODE field and exception in
context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException - critical error in xwiki engine.
public int setIsWikiTemplate(String wikiName,
boolean isWikiTemplate)
throws XWikiException
XWikiServerClass "visibility" field of a wiki descriptor document.
wikiName - the name of the wiki descriptor.isWikiTemplate - true if it's a wiki template, false otherwise.
CONTEXT_LASTERRORCODE field and exception in
context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException - critical error in xwiki engine.
public int createWikiTemplate(String templateName,
String templateDescription,
String packageName)
throws XWikiException
XWikiServerClass "visibility" field set to "template".
templateName - the name of the new wiki template to create.templateDescription - the description of the new wiki template to create.packageName - the name of the attached XAR file to import in the new wiki.
CONTEXT_LASTERRORCODE field and exception in
context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_XWIKINOTVIRTUAL: xwiki is not in virtual mode.WikiManagerException.ERROR_XWIKI_USERDOESNOTEXIST: provided user does not exists.WikiManagerException.ERROR_WM_WIKINAMEFORBIDDEN: provided wiki name can't be used to create
new wiki.WikiManagerException.ERROR_WM_WIKIALREADYEXISTS: wiki descriptor already exists.WikiManagerException.ERROR_WM_UPDATEDATABASE: error occurred when updating database.WikiManagerException.ERROR_WM_PACKAGEDOESNOTEXISTS: attached package does not exists.WikiManagerException.ERROR_WM_PACKAGEIMPORT: package loading failed.WikiManagerException.ERROR_WM_PACKAGEINSTALL: loaded package insertion into database failed.XWikiException - critical error in xwiki engine.
public XWikiServer getWikiTemplateDocument(String wikiName)
throws XWikiException
XWikiServerClass "visibility" field
set to "template".
wikiName - the name of the wiki template.
CONTEXT_LASTERRORCODE field and
exception in context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException - critical error in xwiki engine.
public XWikiServer getWikiTemplateDocument(String wikiName,
int objectId)
throws XWikiException
XWikiServerClass "visibility" field
set to "template".
wikiName - the name of the wiki template.objectId - the id of the XWiki object included in the document to manage.
CONTEXT_LASTERRORCODE field and
exception in context's CONTEXT_LASTEXCEPTION field.
Error codes can be :
XWikiExceptionApi.ERROR_NOERROR: methods succeed.WikiManagerException.ERROR_WM_WIKIDOESNOTEXISTS: wiki to delete does not exists.XWikiException - critical error in xwiki engine.
public List<XWikiServer> getWikiTemplateList()
throws XWikiException
XWikiException - critical error in xwiki engine.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||