|
||||||||||
| 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 java.lang.String |
CONTEXT_LASTERRORCODE
Field name of the last error code inserted in context. |
static java.lang.String |
CONTEXT_LASTEXCEPTION
Field name of the last API exception inserted in context. |
protected static org.apache.commons.logging.Log |
LOG
Logging tool. |
| Fields inherited from class com.xpn.xwiki.api.Api |
|---|
context |
| Constructor Summary | |
|---|---|
WikiManagerPluginApi(WikiManagerPlugin plugin,
com.xpn.xwiki.XWikiContext context)
Create an instance of the Wiki Manager plugin user api. |
|
| Method Summary | |
|---|---|
boolean |
canCreateWiki()
|
boolean |
canDeleteWiki()
|
boolean |
canEditWiki()
|
int |
createNewWiki(java.lang.String wikiName,
java.lang.String templateWiki,
java.lang.String pkgName,
XWikiServer wikiXObjectDocument,
boolean failOnExist)
Create a new wiki from template. |
XWikiServer |
createWikiDocument()
Create an empty not saved XWikiServer. |
int |
createWikiTemplate(java.lang.String templateName,
java.lang.String templateDescription,
java.lang.String packageName)
Create a new xiki with XWikiServerClass "visibility" field set to "template". |
int |
deleteWiki(java.lang.String wikiName)
Delete wiki descriptor document and wiki's database. |
int |
deleteWiki(java.lang.String wikiName,
boolean deleteDatabase)
Delete wiki descriptor document and wiki's database. |
int |
deleteWiki(java.lang.String wikiName,
int objectId)
Deprecated. Use deleteWikiAlias(String, int) since 1.1. |
int |
deleteWikiAlias(java.lang.String wikiName,
int objectId)
Delete wiki descriptor alias document from database. |
java.util.List<Wiki> |
getAllWikis()
|
com.xpn.xwiki.plugin.applicationmanager.core.api.XWikiExceptionApi |
getDefaultException()
|
com.xpn.xwiki.web.XWikiMessageTool |
getMessageTool()
|
GlobalSearchPluginApi |
getSearchApi()
|
XWikiServer |
getWikiDocument(java.lang.String wikiName)
Get wiki descriptor document corresponding to provided wiki name. |
XWikiServer |
getWikiDocument(java.lang.String wikiName,
int objectId)
Get wiki descriptor document corresponding to provided wiki name. |
java.util.List<XWikiServer> |
getWikiDocumentList()
Get the list of all wiki descriptor documents. |
Wiki |
getWikiFromDocumentName(java.lang.String documentFullName)
Get Wiki described by document with provided full name. |
Wiki |
getWikiFromName(java.lang.String wikiName)
Get Wiki with provided name. |
XWikiServer |
getWikiTemplateDocument(java.lang.String wikiName)
Get wiki descriptor document corresponding to provided wiki name with XWikiServerClass "visibility" field
set to "template". |
XWikiServer |
getWikiTemplateDocument(java.lang.String wikiName,
int objectId)
Get wiki descriptor document corresponding to provided wiki name with XWikiServerClass "visibility" field
set to "template". |
java.util.List<XWikiServer> |
getWikiTemplateList()
|
boolean |
isWikiExist(java.lang.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(java.lang.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(java.lang.String wikiName)
Indicate if the provided wiki name could be used to create a new wiki. |
void |
logError(java.lang.String errorMessage,
com.xpn.xwiki.XWikiException e)
Log error and store details in the context. |
int |
setIsWikiTemplate(java.lang.String wikiName,
boolean isWikiTemplate)
Change the XWikiServerClass "visibility" field of a wiki descriptor document. |
int |
setWikiVisibility(java.lang.String wikiName,
int objectId,
java.lang.String visibility)
Change the XWikiServerClass "visibility" field of a wiki descriptor document. |
int |
setWikiVisibility(java.lang.String wikiName,
java.lang.String visibility)
Change the XWikiServerClass "visibility" field of a wiki descriptor document. |
| Methods inherited from class com.xpn.xwiki.plugin.PluginApi |
|---|
getInternalPlugin, getPlugin, getProtectedPlugin, setPlugin |
| Methods inherited from class com.xpn.xwiki.api.Api |
|---|
checkProgrammingRights, convert, convert, getXWikiContext, hasAccessLevel, hasAdminRights, hasProgrammingRights |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CONTEXT_LASTERRORCODE
public static final java.lang.String CONTEXT_LASTEXCEPTION
protected static final org.apache.commons.logging.Log LOG
| Constructor Detail |
|---|
public WikiManagerPluginApi(WikiManagerPlugin plugin,
com.xpn.xwiki.XWikiContext context)
plugin - the entry point of the Wiki Manager plugin.context - the XWiki context.| Method Detail |
|---|
public com.xpn.xwiki.plugin.applicationmanager.core.api.XWikiExceptionApi getDefaultException()
public com.xpn.xwiki.web.XWikiMessageTool getMessageTool()
public GlobalSearchPluginApi getSearchApi()
public void logError(java.lang.String errorMessage,
com.xpn.xwiki.XWikiException e)
errorMessage - error message.e - the catched exception.public boolean canCreateWiki()
public boolean canEditWiki()
public boolean canDeleteWiki()
public int createNewWiki(java.lang.String wikiName,
java.lang.String templateWiki,
java.lang.String pkgName,
XWikiServer wikiXObjectDocument,
boolean failOnExist)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public int deleteWiki(java.lang.String wikiName,
boolean deleteDatabase)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public int deleteWiki(java.lang.String wikiName)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
@Deprecated
public int deleteWiki(java.lang.String wikiName,
int objectId)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public int deleteWikiAlias(java.lang.String wikiName,
int objectId)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public Wiki getWikiFromName(java.lang.String wikiName)
throws com.xpn.xwiki.XWikiException
Wiki with provided name.
wikiName - the name of the wiki.
Wiki object.
com.xpn.xwiki.XWikiException - error when getting document from wiki name.
public java.util.List<Wiki> getAllWikis()
throws com.xpn.xwiki.XWikiException
Wiki.
com.xpn.xwiki.XWikiException - error when getting wiki documents descriptors.
public Wiki getWikiFromDocumentName(java.lang.String documentFullName)
throws com.xpn.xwiki.XWikiException
Wiki described by document with provided full name.
documentFullName - the full name of the wiki document descriptor.
Wiki object.
com.xpn.xwiki.XWikiException - error when getting document.
public XWikiServer getWikiDocument(java.lang.String wikiName)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public XWikiServer getWikiDocument(java.lang.String wikiName,
int objectId)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public java.util.List<XWikiServer> getWikiDocumentList()
throws com.xpn.xwiki.XWikiException
XWikiServer.
com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public XWikiServer createWikiDocument()
throws com.xpn.xwiki.XWikiException
XWikiServer.
XWikiServer.
com.xpn.xwiki.XWikiException - critical error in xwiki engine.public boolean isWikiExist(java.lang.String wikiName)
wikiName - the name of the server to be checked
public boolean isWikiExist(java.lang.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(java.lang.String wikiName)
throws com.xpn.xwiki.XWikiException
wikiName - the name of the wiki.
com.xpn.xwiki.XWikiException - error when trying to find an existing database/schema by name.
public int setWikiVisibility(java.lang.String wikiName,
java.lang.String visibility)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public int setWikiVisibility(java.lang.String wikiName,
int objectId,
java.lang.String visibility)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public int setIsWikiTemplate(java.lang.String wikiName,
boolean isWikiTemplate)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public int createWikiTemplate(java.lang.String templateName,
java.lang.String templateDescription,
java.lang.String packageName)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public XWikiServer getWikiTemplateDocument(java.lang.String wikiName)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public XWikiServer getWikiTemplateDocument(java.lang.String wikiName,
int objectId)
throws com.xpn.xwiki.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.com.xpn.xwiki.XWikiException - critical error in xwiki engine.
public java.util.List<XWikiServer> getWikiTemplateList()
throws com.xpn.xwiki.XWikiException
com.xpn.xwiki.XWikiException - critical error in xwiki engine.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||