Class 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 Detail

      • XWikiPatch

        public XWikiPatch()
        Default constructor, need for hibernate.
      • XWikiPatch

        public XWikiPatch​(String content,
                          boolean isDiff)
        Parameters:
        content - - patch content
        isDiff - - 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