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.ObjectTheDiffInfocan 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 classDiffInfo.TYPEThe general information about the diff 
- 
Field Summary
Fields Modifier and Type Field Description static FastDateFormatDATE_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 ResourcegetContent()Return the content to diff.java.lang.StringgetDiffOutput(DiffService service, java.lang.String current, java.lang.String oldText, boolean isRichText)Helper method to generate the diff output.DiffInfo.TYPEgetType()Return the type information.static ResourcegetVersionedResource(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 
 
 - 
 
 -