com.atlassian.confluence.util
Class DiffUtils
java.lang.Object
com.atlassian.confluence.util.DiffUtils
public class DiffUtils
- extends java.lang.Object
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
WORD_DIFF_MAX
public static final byte WORD_DIFF_MAX
- maximum percentage of words to diff in a line. If the percentage of diffed words exceed this number only
line diffing is displayed
- See Also:
- Constant Field Values
DIFF_MODE_NONE
public static final byte DIFF_MODE_NONE
- See Also:
- Constant Field Values
DIFF_MODE_ADD
public static final byte DIFF_MODE_ADD
- See Also:
- Constant Field Values
DIFF_MODE_DELETE
public static final byte DIFF_MODE_DELETE
- See Also:
- Constant Field Values
DIFF_MODE_CHANGE_DELETE
public static final byte DIFF_MODE_CHANGE_DELETE
- See Also:
- Constant Field Values
DIFF_MODE_CHANGE_ADD
public static final byte DIFF_MODE_CHANGE_ADD
- See Also:
- Constant Field Values
STYLE_NONE
public static final java.lang.String STYLE_NONE
- See Also:
- Constant Field Values
STYLE_ADDED
public static final java.lang.String STYLE_ADDED
- See Also:
- Constant Field Values
STYLE_DELETED
public static final java.lang.String STYLE_DELETED
- See Also:
- Constant Field Values
STYLE_ERROR
public static final java.lang.String STYLE_ERROR
- See Also:
- Constant Field Values
DiffUtils
public DiffUtils()
generateDiff
public static DiffResult generateDiff(ContentEntityObject originalPage,
ContentEntityObject revisedPage)
throws org.apache.commons.jrcs.diff.DifferentiationFailedException
- Calculates the difference between two pages and returns the result as HTML.
The CSS styles used are:
- diff-added-lines - section has been added
- diff-deleted-lines - section has been removed
- diff-snipped - section has not been changed
- differror - (rare) used if there is an error
- Parameters:
originalPage
- The original pagerevisedPage
- The revised page
- Returns:
- A DiffResult
- Throws:
org.apache.commons.jrcs.diff.DifferentiationFailedException
loadPage
public static java.lang.Object[] loadPage(ContentEntityObject page)
diffLine
public static java.lang.String diffLine(java.lang.String orig,
java.lang.String rev)
throws org.apache.commons.jrcs.diff.DifferentiationFailedException
- Will perform a diff on two lines. This works similar to the deff above and if I had more time
I would like to refactor the methods and merge them.
//TODO Refactor the diff methods into one clean method
- Parameters:
orig
- the original linerev
- the revised line
- Returns:
- a html diff of the two lines
- Throws:
org.apache.commons.jrcs.diff.DifferentiationFailedException
getDiffMode
public static byte getDiffMode()
setDiffMode
public static void setDiffMode(byte mode)
mergeChanges
public static java.lang.String mergeChanges(java.lang.String originalPage,
java.lang.String revisionA,
java.lang.String revisionB)
- Returns:
- null if the merge was unsuccessful
Copyright © 2003-2010 Atlassian. All Rights Reserved.