Class DefaultDifferenceManager

java.lang.Object
org.apache.wiki.diff.DefaultDifferenceManager
All Implemented Interfaces:
DifferenceManager

public class DefaultDifferenceManager
extends java.lang.Object
implements DifferenceManager
Load, initialize and delegate to the DiffProvider that will actually do the work.
  • Field Summary

    Fields inherited from interface org.apache.wiki.diff.DifferenceManager

    PROP_DIFF_PROVIDER
  • Constructor Summary

    Constructors
    Constructor Description
    DefaultDifferenceManager​(Engine engine, java.util.Properties props)
    Creates a new DifferenceManager for the given engine.
  • Method Summary

    Modifier and Type Method Description
    java.lang.String getDiff​(Context context, int version1, int version2)
    Returns a diff of two versions of a page.
    java.lang.String makeDiff​(Context context, java.lang.String firstWikiText, java.lang.String secondWikiText)
    Returns valid XHTML string to be used in any way you please.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultDifferenceManager

      public DefaultDifferenceManager​(Engine engine, java.util.Properties props)
      Creates a new DifferenceManager for the given engine.
      Parameters:
      engine - The Engine.
      props - A set of properties.
  • Method Details

    • makeDiff

      public java.lang.String makeDiff​(Context context, java.lang.String firstWikiText, java.lang.String secondWikiText)
      Returns valid XHTML string to be used in any way you please.
      Specified by:
      makeDiff in interface DifferenceManager
      Parameters:
      context - The Wiki Context
      firstWikiText - The old text
      secondWikiText - the new text
      Returns:
      XHTML, or empty string, if no difference detected.
    • getDiff

      public java.lang.String getDiff​(Context context, int version1, int version2)
      Returns a diff of two versions of a page.

      Note that the API was changed in 2.6 to provide a WikiContext object!

      Specified by:
      getDiff in interface DifferenceManager
      Parameters:
      context - The WikiContext of the page you wish to get a diff from
      version1 - Version number of the old page. If WikiPageProvider.LATEST_VERSION (-1), then uses current page.
      version2 - Version number of the new page. If WikiPageProvider.LATEST_VERSION (-1), then uses current page.
      Returns:
      A HTML-ized difference between two pages. If there is no difference, returns an empty string.