Package com.xpn.xwiki.doc.rcs
Class XWikiPatch
- java.lang.Object
-
- com.xpn.xwiki.doc.rcs.XWikiPatch
-
public class XWikiPatch extends Object
Contains differences between revisions. One field (diff for xml or full xml) for now. Created for easy migration to future XWikiPatch system.- Since:
- 1.2M1
- Version:
- $Id: 20be04bcd1aec6b754c7611f4caa9daf1e79882e $
-
-
Constructor Summary
Constructors Constructor Description XWikiPatch()
Default constructor, need for hibernate.XWikiPatch(String content, boolean isDiff)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContent()
boolean
isDiff()
void
patch(List<String> origText)
Patch text.void
setContent(String content)
void
setDiff(boolean isDiff)
XWikiPatch
setDiffVersion(XWikiDocument originalVersion, XWikiDocument newVersion, XWikiContext context)
Create history patch between originalVersion and newVersion as difference on the XML export of the two versions.XWikiPatch
setDiffVersion(String originalVersionXml, XWikiDocument newVersion, XWikiContext context)
Create history patch between originalVersion and newVersion as difference on the XML export of the two versions.XWikiPatch
setDiffVersion(String originalVersionXml, String newVersionXml, String docName)
Create history patch between originalVersion and newVersion as difference on the XML export of the two versions.XWikiPatch
setFullVersion(XWikiDocument version, XWikiContext context)
Store the XML export of the document as the history patch; this will be a history milestone.XWikiPatch
setFullVersion(String versionXml)
Store the XML export of the document as the history patch; this will be a history milestone.
-
-
-
Constructor Detail
-
XWikiPatch
public XWikiPatch()
Default constructor, need for hibernate.
-
XWikiPatch
public XWikiPatch(String content, boolean isDiff)
- Parameters:
content
- - patch contentisDiff
- - is patch a difference or full version
-
-
Method Detail
-
getContent
public String getContent()
- Returns:
- string serialization for patch
-
setContent
public void setContent(String content)
- Parameters:
content
- - string serialization for patch
-
isDiff
public boolean isDiff()
- Returns:
- is content a difference, or full version
-
setDiff
public void setDiff(boolean isDiff)
- Parameters:
isDiff
- - is content a difference, or full version
-
setFullVersion
public XWikiPatch setFullVersion(XWikiDocument version, XWikiContext context) throws XWikiException
Store the XML export of the document as the history patch; this will be a history milestone.- Parameters:
version
- Document version to store in the history patch.context
- Needed for serializing documents to xml.- Returns:
- Self, with the patch content set to the XML export of the document version.
- Throws:
XWikiException
- if any error
-
setFullVersion
public XWikiPatch setFullVersion(String versionXml) throws XWikiException
Store the XML export of the document as the history patch; this will be a history milestone.- Parameters:
versionXml
- Document version to store in the history patch, in the XML export format.- Returns:
- Self, with the patch content set to the XML export of the document version.
- Throws:
XWikiException
- if any error occurs
-
setDiffVersion
public XWikiPatch setDiffVersion(XWikiDocument originalVersion, XWikiDocument newVersion, XWikiContext context) throws XWikiException
Create history patch between originalVersion and newVersion as difference on the XML export of the two versions. The patch is created between newVersion and originalVersion.- Parameters:
originalVersion
- Original version of the document document.newVersion
- Current version of the document.context
- Needed for serializing documents to xml.- Returns:
- Self, with the patch content set to the generated diff between the two version.
- Throws:
XWikiException
- if any error occurs
-
setDiffVersion
public XWikiPatch setDiffVersion(String originalVersionXml, XWikiDocument newVersion, XWikiContext context) throws XWikiException
Create history patch between originalVersion and newVersion as difference on the XML export of the two versions. The patch is created between newVersion and originalVersion.- Parameters:
originalVersionXml
- Original version of the document document, in the XML export format.newVersion
- Current version of the document.context
- Needed for serializing documents to xml.- Returns:
- Self, with the patch content set to the generated diff between the two version.
- Throws:
XWikiException
- if any error occurs
-
setDiffVersion
public XWikiPatch setDiffVersion(String originalVersionXml, String newVersionXml, String docName) throws XWikiException
Create history patch between originalVersion and newVersion as difference on the XML export of the two versions. The patch is created between newVersion and originalVersion.- Parameters:
originalVersionXml
- Original version of the document document, in the XML export format.newVersionXml
- Current version of the document, in the XML export format.docName
- Needed for the exception report.- Returns:
- Self, with the patch content set to the generated diff between the two version.
- Throws:
XWikiException
- if any error occurs
-
patch
public void patch(List<String> origText) throws XWikiException
Patch text.- Parameters:
origText
- - text to patch- Throws:
XWikiException
- if exception while patching
-
-