Package com.day.cq.commons
Class DiffInfo
- java.lang.Object
-
- com.day.cq.commons.DiffInfo
-
- Direct Known Subclasses:
DiffInfo
public class DiffInfo extends java.lang.Object
TheDiffInfo
can be used by components to display a diff to a previous version. A component has access to the diff information by callingAdaptable.adaptTo(Class)
with this class as the argument.- Since:
- 5.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
DiffInfo.TYPE
The general information about the diff
-
Field Summary
Fields Modifier and Type Field Description static FastDateFormat
DATE_DEFAULT
-
Constructor Summary
Constructors Constructor Description DiffInfo(Resource c, DiffInfo.TYPE l)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Resource
getContent()
Return the content to diff.java.lang.String
getDiffOutput(DiffService service, java.lang.String current, java.lang.String oldText, boolean isRichText)
Helper method to generate the diff output.DiffInfo.TYPE
getType()
Return the type information.static Resource
getVersionedResource(Resource res, java.lang.String versionLabel)
Helper method that returns the versioned counterpart of the given resource with the specified version label.
-
-
-
Field Detail
-
DATE_DEFAULT
public static final FastDateFormat DATE_DEFAULT
-
-
Constructor Detail
-
DiffInfo
public DiffInfo(Resource c, DiffInfo.TYPE l)
-
-
Method Detail
-
getContent
public Resource getContent()
Return the content to diff.- Returns:
- The content or
null
-
getType
public DiffInfo.TYPE getType()
Return the type information.- Returns:
- The type information.
-
getDiffOutput
public java.lang.String getDiffOutput(DiffService service, java.lang.String current, java.lang.String oldText, boolean isRichText)
Helper method to generate the diff output.- Parameters:
service
- The diff service.current
- The current text (right).oldText
- The old text (left).isRichText
- Is this rich text?- Returns:
- The complete output or null.
-
getVersionedResource
public static Resource getVersionedResource(Resource res, java.lang.String versionLabel)
Helper method that returns the versioned counterpart of the given resource with the specified version label. The label can be a version name, a version label or a version date.- Parameters:
res
- the resourceversionLabel
- the version specifier- Returns:
- the versioned resource or
null
-
-