com.xpn.xwiki.plugin.wikimanager
Class WikiCopy

java.lang.Object
  extended by com.xpn.xwiki.plugin.wikimanager.WikiCopy

public final class WikiCopy
extends Object

Utility classe used to fill a newly created wiki.

Version:
$Id: 474d4917e52cb08b0d2c68ff08852207e97e9383 $

Field Summary
protected static org.slf4j.Logger LOGGER
          The logging tool.
 
Constructor Summary
WikiCopy()
          Default constructor.
WikiCopy(XWikiPluginMessageTool messageTool)
          Deprecated. 
 
Method Summary
 void copyWiki(String sourceWiki, String targetWiki, String comment, XWikiContext context)
          Copy all documents from sourceWiki wiki to targetWiki wiki.
 XWikiPluginMessageTool getMessageTool(XWikiContext context)
          Deprecated. 
 XWikiServer getWikiTemplateAlias(String wikiName, int objectId, XWikiContext context, boolean validate)
          Get template wiki descriptor document.
 List<XWikiServer> getWikiTemplateAliasList(XWikiContext context)
          Get all the templates wikis descriptors documents.
 void importPackage(String packageName, String targetWiki, XWikiContext context)
          Import XAR package into wiki.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final org.slf4j.Logger LOGGER
The logging tool.

Constructor Detail

WikiCopy

@Deprecated
public WikiCopy(XWikiPluginMessageTool messageTool)
Deprecated. 

Parameters:
messageTool - the message tool

WikiCopy

public WikiCopy()
Default constructor.

Method Detail

getMessageTool

@Deprecated
public XWikiPluginMessageTool getMessageTool(XWikiContext context)
Deprecated. 

Get the XWikiPluginMessageTool to use with WikiManager.

Parameters:
context - the XWiki context.
Returns:
a translated strings manager.

copyWiki

public void copyWiki(String sourceWiki,
                     String targetWiki,
                     String comment,
                     XWikiContext context)
              throws XWikiException
Copy all documents from sourceWiki wiki to targetWiki wiki.

It also take care of ApplicationManager descriptors "documents to include" and "documents to link".

Parameters:
sourceWiki - the wiki from where to copy documents and get lists of "document to link" and "documents to copy".
targetWiki - the wiki where to copy documents.
comment - the comment to use when saving documents.
context - the XWiki context.
Throws:
XWikiException - error when:
  • copying on of the source wiki to target wiki.
  • or getting documents to include.
  • or getting documents to link.

importPackage

public void importPackage(String packageName,
                          String targetWiki,
                          XWikiContext context)
                   throws XWikiException
Import XAR package into wiki.

Parameters:
packageName - the name of the attached package file.
targetWiki - the name of the wiki where to install loaded XWikiDocument from XAR package.
context - the XWiki context.
Throws:
XWikiException - error when:

getWikiTemplateAlias

public XWikiServer getWikiTemplateAlias(String wikiName,
                                        int objectId,
                                        XWikiContext context,
                                        boolean validate)
                                 throws XWikiException
Get template wiki descriptor document.

A template wiki is a wiki which the XWiki.XWikiServerClass "visibility" field is set to "template".

Parameters:
wikiName - the name of the template wiki.
objectId - the id of the XWiki object included in the document to manage.
context - the XWiki context.
validate - when wiki descriptor document does not exist :
Returns:
a wiki descriptor document.
Throws:
XWikiException - error when:
  • getting XWikiServerClass unique instance.
  • or when searching for wiki descriptor with "visibility" field equals to "template".

getWikiTemplateAliasList

public List<XWikiServer> getWikiTemplateAliasList(XWikiContext context)
                                           throws XWikiException
Get all the templates wikis descriptors documents.

A template wiki is a wiki which the XWiki.XWikiServerClass "visibility" field is set to "template".

Parameters:
context - the XWiki context.
Returns:
a list of XWikiServer.
Throws:
XWikiException - eeor when:
  • getting XWikiServerClass unique instance.
  • or when searching for all wikis descriptors with "visibility" field equals to "template".


Copyright © 2004-2013 XWiki. All Rights Reserved.